File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -121,38 +121,38 @@ static int w_request(lua_State *L)
121121 lua_pop (L, 1 );
122122 }
123123
124- for (size_t i = 0 ; clients[i]; ++i)
125- {
126- HTTPSClient &client = *clients[i];
127- if (!client.valid ())
128- continue ;
129-
130- auto reply = client.request (req);
131- lua_pushinteger (L, reply.responseCode );
132- w_pushstring (L, reply.body );
133-
134- if (advanced)
135- {
136- lua_newtable (L);
137- for (const auto &header : reply.headers )
138- {
139- w_pushstring (L, header.first );
140- w_pushstring (L, header.second );
141- lua_settable (L, -3 );
142- }
143- }
144-
145- foundClient = true ;
146- break ;
147- }
148-
149- if (!foundClient)
150- {
151- lua_pushnil (L);
152- lua_pushstring (L, " No applicable implementation found" );
153- if (advanced)
154- lua_pushnil (L);
155- }
124+ for (size_t i = 0 ; clients[i]; ++i)
125+ {
126+ HTTPSClient &client = *clients[i];
127+ if (!client.valid ())
128+ continue ;
129+
130+ auto reply = client.request (req);
131+ lua_pushinteger (L, reply.responseCode );
132+ w_pushstring (L, reply.body );
133+
134+ if (advanced)
135+ {
136+ lua_newtable (L);
137+ for (const auto &header : reply.headers )
138+ {
139+ w_pushstring (L, header.first );
140+ w_pushstring (L, header.second );
141+ lua_settable (L, -3 );
142+ }
143+ }
144+
145+ foundClient = true ;
146+ break ;
147+ }
148+
149+ if (!foundClient)
150+ {
151+ lua_pushnil (L);
152+ lua_pushstring (L, " No applicable implementation found" );
153+ if (advanced)
154+ lua_pushnil (L);
155+ }
156156
157157 return advanced ? 3 : 2 ;
158158}
Original file line number Diff line number Diff line change 3939 }
4040
4141 for (auto &header : req.headers )
42- [request setValue: toNSString (header.second) forHTTPHeaderField: toNSString (header.first)];
42+ [request setValue: toNSString (header.second) forHTTPHeaderField: toNSString (header.first)];
4343
4444 __block NSHTTPURLResponse *response = nil ;
4545 __block NSError *error = nil ;
46- __block NSData *body = nil ;
46+ __block NSData *body = nil ;
4747
48- dispatch_semaphore_t sem = dispatch_semaphore_create (0 );
48+ dispatch_semaphore_t sem = dispatch_semaphore_create (0 );
4949
50- NSURLSessionTask *task = [[NSURLSession sharedSession ] dataTaskWithRequest: request
51- completionHandler: ^(NSData *data, NSURLResponse *resp, NSError *err) {
52- body = data;
53- response = (NSHTTPURLResponse *)resp;
54- error = err;
55- dispatch_semaphore_signal (sem);
56- }];
50+ NSURLSessionTask *task = [[NSURLSession sharedSession ] dataTaskWithRequest: request
51+ completionHandler: ^(NSData *data, NSURLResponse *resp, NSError *err) {
52+ body = data;
53+ response = (NSHTTPURLResponse *)resp;
54+ error = err;
55+ dispatch_semaphore_signal (sem);
56+ }];
5757
58- [task resume ];
58+ [task resume ];
5959
60- dispatch_semaphore_wait (sem, DISPATCH_TIME_FOREVER);
60+ dispatch_semaphore_wait (sem, DISPATCH_TIME_FOREVER);
6161
6262 HTTPSClient::Reply reply;
6363 reply.responseCode = 400 ;
You can’t perform that action at this time.
0 commit comments