161 fprintf(stderr, "%s\n", "Error: Cannot read from socket"); |
161 fprintf(stderr, "%s\n", "Error: Cannot read from socket"); |
162 return NULL; |
162 return NULL; |
163 } |
163 } |
164 buf->cursize += r; |
164 buf->cursize += r; |
165 } |
165 } |
|
166 if(!http_parser_validate(parser)) { |
|
167 log_ereport(LOG_FAILURE, "http_parser_validate failed"); |
|
168 // TODO: send error 400 bad request |
|
169 return NULL; |
|
170 } |
166 |
171 |
167 // process request |
172 // process request |
168 r = handle_request(&request, NULL); // TODO: use correct thread pool |
173 r = handle_request(&request, NULL); // TODO: use correct thread pool |
169 |
174 |
170 // TODO: free, see evt_request_finish |
175 // TODO: free, see evt_request_finish |
311 if (fcntl(request->connection->fd, F_SETFL, flags & ~O_NONBLOCK) != 0) { |
316 if (fcntl(request->connection->fd, F_SETFL, flags & ~O_NONBLOCK) != 0) { |
312 // just close the connection if fcntl fails |
317 // just close the connection if fcntl fails |
313 event->finish = evt_request_error; |
318 event->finish = evt_request_error; |
314 io->error = 3; |
319 io->error = 3; |
315 return 0; |
320 return 0; |
316 } |
321 } |
317 |
322 |
|
323 if(!http_parser_validate(parser)) { |
|
324 log_ereport(LOG_FAILURE, "http_parser_validate failed"); |
|
325 // TODO: send error 400 bad request |
|
326 //event->finish = evt_request_error; |
|
327 //return 0; |
|
328 } |
|
329 |
318 /* |
330 /* |
319 * process request |
331 * process request |
320 * |
332 * |
321 * We return 0 to finish request input. The event handler than stops |
333 * We return 0 to finish request input. The event handler than stops |
322 * polling and executes event->finish (evt_request_input_finish) |
334 * polling and executes event->finish (evt_request_input_finish) |