Lines Matching refs:r
35 #define connection_set_state(r, n) ((r)->state = (n)) argument
38 static void connection_set_state_error(request_st * const r, const request_state_t state) { in connection_set_state_error() argument
39 connection_set_state(r, state); in connection_set_state_error()
83 request_st * const r = &con->request; in connection_close() local
84 request_reset_ex(r); /*(r->conf.* is still valid below)*/ in connection_close()
85 connection_set_state(r, CON_STATE_CONNECT); in connection_close()
102 log_perror(r->conf.errh, __FILE__, __LINE__, in connection_close()
105 if (r->conf.log_state_handling) { in connection_close()
106 log_error(r->conf.errh, __FILE__, __LINE__, in connection_close()
167 request_st * const r = &con->request; in connection_handle_shutdown() local
168 connection_set_state(r, CON_STATE_CLOSE); in connection_handle_shutdown()
169 if (r->conf.log_state_handling) { in connection_handle_shutdown()
170 log_error(r->conf.errh, __FILE__, __LINE__, in connection_handle_shutdown()
179 static void connection_handle_response_end_state(request_st * const r, connection * const con) { in connection_handle_response_end_state() argument
180 if (r->http_version > HTTP_VERSION_1_1) { in connection_handle_response_end_state()
181 h2_retire_con(r, con); in connection_handle_response_end_state()
182 r->keep_alive = 0; in connection_handle_response_end_state()
185 r->http_status = 100; /* XXX: what if con->state == CON_STATE_ERROR? */ in connection_handle_response_end_state()
190 if (r->http_status) plugins_call_handle_request_done(r); in connection_handle_response_end_state()
192 if (r->reqbody_length != r->reqbody_queue.bytes_in in connection_handle_response_end_state()
193 || r->state == CON_STATE_ERROR) { in connection_handle_response_end_state()
195 r->keep_alive = 0; in connection_handle_response_end_state()
197 if (&r->write_queue != con->write_queue) { /*(for HTTP/1.1)*/ in connection_handle_response_end_state()
199 con->write_queue = &r->write_queue; in connection_handle_response_end_state()
203 if (r->keep_alive > 0) { in connection_handle_response_end_state()
204 request_reset(r); in connection_handle_response_end_state()
208 r->bytes_read_ckpt = r->read_queue.bytes_in; in connection_handle_response_end_state()
209 r->bytes_written_ckpt = r->write_queue.bytes_out; in connection_handle_response_end_state()
211 r->start_hp.tv_sec = log_epoch_secs; in connection_handle_response_end_state()
214 connection_set_state(r, CON_STATE_REQUEST_START); in connection_handle_response_end_state()
316 request_st * const r = &con->request; in connection_write_chunkqueue() local
317 if (r->conf.global_bytes_per_second_cnt_ptr) in connection_write_chunkqueue()
318 *(r->conf.global_bytes_per_second_cnt_ptr) += written; in connection_write_chunkqueue()
325 connection_write_1xx_info (request_st * const r, connection * const con) in connection_write_1xx_info() argument
337 if (r->conf.global_bytes_per_second_cnt_ptr) in connection_write_1xx_info()
338 *(r->conf.global_bytes_per_second_cnt_ptr) += written; in connection_write_1xx_info()
341 connection_set_state_error(r, CON_STATE_ERROR); in connection_write_1xx_info()
347 if (cq == &r->write_queue) { in connection_write_1xx_info()
370 r->write_queue.bytes_in = r->write_queue.bytes_out = 0; in connection_write_1xx_info()
378 connection_send_1xx (request_st * const r, connection * const con) in connection_send_1xx() argument
392 http_status_append(b, r->http_status); in connection_send_1xx()
393 for (uint32_t i = 0; i < r->resp_headers.used; ++i) { in connection_send_1xx()
394 const data_string * const ds = (data_string *)r->resp_headers.data[i]; in connection_send_1xx()
407 return connection_write_1xx_info(r, con); in connection_send_1xx()
412 connection_write_100_continue (request_st * const r, connection * const con) in connection_write_100_continue() argument
422 return connection_write_1xx_info(r, con); in connection_write_100_continue()
426 static int connection_handle_write(request_st * const r, connection * const con) { in connection_handle_write() argument
433 if (r->resp_body_finished) { in connection_handle_write()
434 connection_set_state(r, CON_STATE_RESPONSE_END); in connection_handle_write()
439 log_error(r->conf.errh, __FILE__, __LINE__, in connection_handle_write()
443 connection_set_state_error(r, CON_STATE_ERROR); in connection_handle_write()
458 static int connection_handle_write_state(request_st * const r, connection * const con) { in connection_handle_write_state() argument
461 if (!chunkqueue_is_empty(&r->write_queue)) { in connection_handle_write_state()
462 if (r->http_version <= HTTP_VERSION_1_1) { in connection_handle_write_state()
463 int rc = connection_handle_write(r, con); in connection_handle_write_state()
466 } else if (r->resp_body_finished) { in connection_handle_write_state()
467 connection_set_state(r, CON_STATE_RESPONSE_END); in connection_handle_write_state()
471 if (r->handler_module && !r->resp_body_finished) { in connection_handle_write_state()
472 const plugin * const p = r->handler_module; in connection_handle_write_state()
473 int rc = p->handle_subrequest(r, p->data); in connection_handle_write_state()
481 log_error(r->conf.errh, __FILE__, __LINE__, in connection_handle_write_state()
486 connection_set_state_error(r, CON_STATE_ERROR); in connection_handle_write_state()
490 } while (r->http_version <= HTTP_VERSION_1_1 in connection_handle_write_state()
491 && (!chunkqueue_is_empty(&r->write_queue) in connection_handle_write_state()
493 : r->resp_body_finished)); in connection_handle_write_state()
507 request_st * const r = &con->request; in connection_init() local
508 request_init_data(r, con, srv); in connection_init()
509 con->write_queue = &r->write_queue; in connection_init()
510 con->read_queue = &r->read_queue; in connection_init()
520 request_st * const r = &con->request; in connection_free() local
523 if (con->write_queue != &r->write_queue) in connection_free()
525 if (con->read_queue != &r->read_queue) in connection_free()
527 request_free_data(r); in connection_free()
554 request_st * const r = &con->request; in connection_reset() local
555 request_reset(r); in connection_reset()
556 r->bytes_read_ckpt = 0; in connection_reset()
557 r->bytes_written_ckpt = 0; in connection_reset()
582 request_st * const r = &con->request; in connection_read_header_more() local
583 connection_set_state_error(r, CON_STATE_ERROR); in connection_read_header_more()
586 request_st * const r = &con->request; in connection_read_header_more() local
587 if (r->http_version == HTTP_VERSION_2) return NULL; in connection_read_header_more()
645 request_st * const r = &con->request; in connection_handle_read_state() local
653 if (cq->bytes_in == r->bytes_read_ckpt) { in connection_handle_read_state()
683 const uint32_t max_request_field_size = r->conf.max_request_field_size; in connection_handle_read_state()
686 log_error(r->conf.errh, __FILE__, __LINE__, "%s", in connection_handle_read_state()
688 r->http_status = 431; /* Request Header Fields Too Large */ in connection_handle_read_state()
689 r->keep_alive = 0; in connection_handle_read_state()
714 log_error(r->conf.errh, __FILE__, __LINE__, "%s (%s)", in connection_handle_read_state()
719 r->http_status = 400; /* Bad Request */ in connection_handle_read_state()
720 r->keep_alive = 0; in connection_handle_read_state()
726 if (cq->bytes_in > r->bytes_read_ckpt) { in connection_handle_read_state()
729 r->start_hp.tv_sec = log_epoch_secs; in connection_handle_read_state()
730 if (r->conf.high_precision_timestamps) in connection_handle_read_state()
731 log_clock_gettime_realtime(&r->start_hp); in connection_handle_read_state()
750 r->bytes_read_ckpt = cq->bytes_out; in connection_handle_read_state()
753 request_reset_ex(r); in connection_handle_read_state()
761 else if (!con->is_ssl_sock && r->conf.h2proto in connection_handle_read_state()
764 r->http_version = HTTP_VERSION_2; in connection_handle_read_state()
768 r->rqst_header_len = header_len; in connection_handle_read_state()
769 if (r->conf.log_request_header) in connection_handle_read_state()
770 log_error_multiline(r->conf.errh, __FILE__, __LINE__, in connection_handle_read_state()
772 http_request_headers_process(r, hdrs, hoff, con->proto_default_port); in connection_handle_read_state()
773 chunkqueue_mark_written(cq, r->rqst_header_len); in connection_handle_read_state()
775 if (light_btst(r->rqst_htags, HTTP_HEADER_UPGRADE) in connection_handle_read_state()
776 && 0 == r->http_status in connection_handle_read_state()
777 && h2_check_con_upgrade_h2c(r)) { in connection_handle_read_state()
779 r->conditional_is_valid = (1 << COMP_SERVER_SOCKET) in connection_handle_read_state()
781 r->bytes_read_ckpt = 0; in connection_handle_read_state()
816 request_st * const r = &con->request; in connection_read_cq_err() local
830 log_error(r->conf.errh, __FILE__, __LINE__, in connection_read_cq_err()
846 log_perror(r->conf.errh, __FILE__, __LINE__, in connection_read_cq_err()
852 connection_set_state_error(r, CON_STATE_ERROR); in connection_read_cq_err()
897 request_st * const r = &con->request; in connection_write_cq() local
898 return con->srv->network_backend_write(con->fd,cq,max_bytes,r->conf.errh); in connection_write_cq()
902 static handler_t connection_handle_read_post_state(request_st * const r);
922 request_st * const r = &con->request; in connection_accepted() local
923 connection_set_state(r, CON_STATE_REQUEST_START); in connection_accepted()
933 config_cond_cache_reset(r); in connection_accepted()
934 r->conditional_is_valid = (1 << COMP_SERVER_SOCKET) in connection_accepted()
942 if (r->http_status < 0) connection_set_state(r, CON_STATE_WRITE); in connection_accepted()
951 connection_log_state (const request_st * const r, const char * const tag) in __attribute_nonnull__()
953 buffer * const tb = r->tmp_buf; in __attribute_nonnull__()
955 http_request_state_append(tb, r->state); in __attribute_nonnull__()
956 log_error(r->conf.errh, __FILE__, __LINE__, in __attribute_nonnull__()
957 "fd:%d id:%d state:%s%s", r->con->fd, r->h2id, tb->ptr, tag); in __attribute_nonnull__()
965 connection_state_machine_loop (request_st * const r, connection * const con) in connection_state_machine_loop() argument
969 if (r->conf.log_state_handling) in connection_state_machine_loop()
970 connection_log_state(r, ""); in connection_state_machine_loop()
972 switch ((ostate = r->state)) { in connection_state_machine_loop()
975 r->start_hp.tv_sec = log_epoch_secs; in connection_state_machine_loop()
977 if (r->conf.high_precision_timestamps) in connection_state_machine_loop()
978 log_clock_gettime_realtime(&r->start_hp); in connection_state_machine_loop()
981 r->loops_per_request = 0; in connection_state_machine_loop()
983 connection_set_state(r, CON_STATE_READ); in connection_state_machine_loop()
988 if (r->http_version == HTTP_VERSION_2) { in connection_state_machine_loop()
989 connection_transition_h2(r, con); in connection_state_machine_loop()
998 connection_set_state(r, in connection_state_machine_loop()
999 (0 == r->reqbody_length) in connection_state_machine_loop()
1005 switch (http_response_handler(r)) { in connection_state_machine_loop()
1014 connection_set_state_error(r, CON_STATE_ERROR); in connection_state_machine_loop()
1019 if (r->http_version > HTTP_VERSION_1_1) in connection_state_machine_loop()
1020 h2_send_headers(r, con); in connection_state_machine_loop()
1022 http_response_write_header(r); in connection_state_machine_loop()
1023 connection_set_state(r, CON_STATE_WRITE); in connection_state_machine_loop()
1026 if (connection_handle_write_state(r, con) == CON_STATE_WRITE) in connection_state_machine_loop()
1031 if (r->http_version > HTTP_VERSION_1_1 && r != &con->request) in connection_state_machine_loop()
1033 connection_handle_response_end_state(r, con); in connection_state_machine_loop()
1047 } while (ostate != (request_state_t)r->state); in connection_state_machine_loop()
1053 connection_revents_err (request_st * const r, connection * const con) in connection_revents_err() argument
1061 if (r->state == CON_STATE_CLOSE) in connection_revents_err()
1064 connection_set_state_error(r, CON_STATE_ERROR); in connection_revents_err()
1068 r->conf.stream_request_body &= in connection_revents_err()
1070 r->conf.stream_request_body |= FDEVENT_STREAM_REQUEST_POLLRDHUP; in connection_revents_err()
1072 if (chunkqueue_is_empty(con->read_queue)) r->keep_alive = 0; in connection_revents_err()
1073 if (r->reqbody_length < -1)/*(transparent proxy mode; no more rd data)*/ in connection_revents_err()
1074 r->reqbody_length = r->reqbody_queue.bytes_in; in connection_revents_err()
1089 r->conf.stream_request_body |= FDEVENT_STREAM_REQUEST_TCP_FIN; in connection_revents_err()
1096 connection_set_state_error(r, CON_STATE_ERROR); in connection_revents_err()
1100 connection_set_state_error(r, CON_STATE_ERROR); in connection_revents_err()
1102 log_error(r->conf.errh, __FILE__, __LINE__, in connection_revents_err()
1108 connection_set_fdevent_interest (request_st * const r, connection * const con) in connection_set_fdevent_interest() argument
1112 if (con->revents_err && r->state != CON_STATE_ERROR) { in connection_set_fdevent_interest()
1113 connection_revents_err(r, con); /* resets con->revents_err = 0 */ in connection_set_fdevent_interest()
1121 switch(r->state) { in connection_set_fdevent_interest()
1124 if (!(r->conf.stream_request_body & FDEVENT_STREAM_REQUEST_POLLRDHUP)) in connection_set_fdevent_interest()
1133 if (r->conf.stream_request_body & FDEVENT_STREAM_REQUEST_POLLIN) in connection_set_fdevent_interest()
1135 if (!(r->conf.stream_request_body & FDEVENT_STREAM_REQUEST_POLLRDHUP)) in connection_set_fdevent_interest()
1227 request_st * const r = h2c->r[i]; in connection_state_machine_h2() local
1231 connection_state_machine_loop(r, con); in connection_state_machine_h2()
1234 if (r->conf.log_state_handling) in connection_state_machine_h2()
1235 connection_log_state(r, " at loop exit"); in connection_state_machine_h2()
1238 if (r->state < CON_STATE_WRITE) in connection_state_machine_h2()
1241 else if (r->state == CON_STATE_WRITE) { in connection_state_machine_h2()
1242 if (__builtin_expect((!chunkqueue_is_empty(&r->write_queue)), 1) in connection_state_machine_h2()
1244 && (r->resp_body_finished in connection_state_machine_h2()
1245 || (r->conf.stream_response_body in connection_state_machine_h2()
1252 uint32_t dlen = (r->h2_prio & 1) ? 32768-18 : 8192; in connection_state_machine_h2()
1254 dlen = h2_send_cqdata(r, con, &r->write_queue, dlen); in connection_state_machine_h2()
1257 if (!chunkqueue_is_empty(&r->write_queue)) in connection_state_machine_h2()
1261 if (!chunkqueue_is_empty(&r->write_queue) in connection_state_machine_h2()
1262 || !r->resp_body_finished) in connection_state_machine_h2()
1265 connection_set_state(r, CON_STATE_RESPONSE_END); in connection_state_machine_h2()
1266 if (__builtin_expect( (r->conf.log_state_handling), 0)) in connection_state_machine_h2()
1267 connection_log_state(r, ""); in connection_state_machine_h2()
1272 if (h2c->rused == sizeof(h2c->r)/sizeof(*h2c->r) in connection_state_machine_h2()
1275 h2_send_end_stream(r, con); in connection_state_machine_h2()
1276 const int alive = r->keep_alive; in connection_state_machine_h2()
1277 h2_retire_stream(r, con);/*r invalidated;removed from h2c->r[]*/ in connection_state_machine_h2()
1297 request_st * const r = h2c->r[i]; in connection_state_machine_h2() local
1299 h2_retire_stream(r, con);/*r invalidated;removed from h2c->r[]*/ in connection_state_machine_h2()
1340 request_st * const r = &con->request; in connection_state_machine_h1() local
1341 connection_state_machine_loop(r, con); in connection_state_machine_h1()
1343 if (r->conf.log_state_handling) in connection_state_machine_h1()
1344 connection_log_state(r, " at loop exit"); in connection_state_machine_h1()
1346 connection_set_fdevent_interest(r, con); in connection_state_machine_h1()
1365 request_st * const r = &con->request; in connection_check_timeout() local
1366 if (r->state == CON_STATE_CLOSE) { in connection_check_timeout()
1371 else if (con->h2 && r->state == CON_STATE_WRITE) { in connection_check_timeout()
1375 request_st * const rr = h2c->r[i]; in connection_check_timeout()
1392 connection_set_state_error(r, CON_STATE_ERROR); in connection_check_timeout()
1403 > r->conf.max_write_idle) { in connection_check_timeout()
1406 if (r->conf.log_timeouts) { in connection_check_timeout()
1407 log_error(r->conf.errh, __FILE__, __LINE__, in connection_check_timeout()
1412 r->dst_addr_buf->ptr, in connection_check_timeout()
1413 BUFFER_INTLEN_PTR(&r->target), in connection_check_timeout()
1414 (long long)r->write_queue.bytes_out, in connection_check_timeout()
1415 (int)r->conf.max_write_idle); in connection_check_timeout()
1417 connection_set_state_error(r, CON_STATE_ERROR); in connection_check_timeout()
1426 if (r->conf.log_request_handling) { in connection_check_timeout()
1427 log_error(r->conf.errh, __FILE__, __LINE__, in connection_check_timeout()
1431 connection_set_state(r, CON_STATE_RESPONSE_END); in connection_check_timeout()
1440 if (con->request_count == 1 || r->state != CON_STATE_READ) { in connection_check_timeout()
1442 if (cur_ts - con->read_idle_ts > r->conf.max_read_idle) { in connection_check_timeout()
1444 if (r->conf.log_request_handling) { in connection_check_timeout()
1445 log_error(r->conf.errh, __FILE__, __LINE__, in connection_check_timeout()
1449 connection_set_state_error(r, CON_STATE_ERROR); in connection_check_timeout()
1455 if (r->conf.log_request_handling) { in connection_check_timeout()
1456 log_error(r->conf.errh, __FILE__, __LINE__, in connection_check_timeout()
1461 connection_set_state_error(r, CON_STATE_ERROR); in connection_check_timeout()
1479 if (r->http_version <= HTTP_VERSION_1_1 in connection_check_timeout()
1480 && r->state == CON_STATE_WRITE && con->write_request_ts != 0) { in connection_check_timeout()
1483 log_error(r->conf.errh, __FILE__, __LINE__, in connection_check_timeout()
1489 if (cur_ts - con->write_request_ts > r->conf.max_write_idle) { in connection_check_timeout()
1491 if (r->conf.log_timeouts) { in connection_check_timeout()
1492 log_error(r->conf.errh, __FILE__, __LINE__, in connection_check_timeout()
1496 r->dst_addr_buf->ptr, in connection_check_timeout()
1497 BUFFER_INTLEN_PTR(&r->target), in connection_check_timeout()
1499 (int)r->conf.max_write_idle); in connection_check_timeout()
1501 connection_set_state_error(r, CON_STATE_ERROR); in connection_check_timeout()
1513 (r->conf.bytes_per_second == 0 in connection_check_timeout()
1515 < (off_t)r->conf.bytes_per_second * t_diff)) { in connection_check_timeout()
1544 request_st * const r = &con->request; in connection_graceful_shutdown_maint() local
1545 if (r->state == CON_STATE_CLOSE) { in connection_graceful_shutdown_maint()
1553 else if (con->h2 && r->state == CON_STATE_WRITE) { in connection_graceful_shutdown_maint()
1556 connection_set_state(r, CON_STATE_RESPONSE_END); in connection_graceful_shutdown_maint()
1560 else if (r->state == CON_STATE_READ && con->request_count > 1 in connection_graceful_shutdown_maint()
1563 connection_set_state_error(r, CON_STATE_ERROR); in connection_graceful_shutdown_maint()
1568 connection_set_state_error(r, CON_STATE_ERROR); in connection_graceful_shutdown_maint()
1572 r->keep_alive = 0; /* disable keep-alive */ in connection_graceful_shutdown_maint()
1574 r->conf.bytes_per_second = 0; /* disable rate limit */ in connection_graceful_shutdown_maint()
1575 r->conf.global_bytes_per_second = 0; /* disable rate limit */ in connection_graceful_shutdown_maint()
1641 connection_handle_read_post_chunked (request_st * const r, chunkqueue * const cq, chunkqueue * cons… in connection_handle_read_post_chunked() argument
1644 const off_t max_request_size = (off_t)r->conf.max_request_size << 10; in connection_handle_read_post_chunked()
1645 off_t te_chunked = r->te_chunked; in connection_handle_read_post_chunked()
1660 log_error(r->conf.errh, __FILE__, __LINE__, in connection_handle_read_post_chunked()
1663 return http_response_reqbody_read_error(r, 400); in connection_handle_read_post_chunked()
1669 log_error(r->conf.errh, __FILE__, __LINE__, in connection_handle_read_post_chunked()
1672 return http_response_reqbody_read_error(r, 400); in connection_handle_read_post_chunked()
1676 log_error(r->conf.errh, __FILE__, __LINE__, in connection_handle_read_post_chunked()
1679 return http_response_reqbody_read_error(r, 400); in connection_handle_read_post_chunked()
1685 log_error(r->conf.errh, __FILE__, __LINE__, in connection_handle_read_post_chunked()
1688 return http_response_reqbody_read_error(r, 400); in connection_handle_read_post_chunked()
1712 < (off_t)r->conf.max_request_field_size) { in connection_handle_read_post_chunked()
1718 r->keep_alive = 0; in connection_handle_read_post_chunked()
1732 r->reqbody_length = dst_cq->bytes_in; in connection_handle_read_post_chunked()
1743 log_error(r->conf.errh, __FILE__, __LINE__, in connection_handle_read_post_chunked()
1747 return http_response_reqbody_read_error(r, 413); in connection_handle_read_post_chunked()
1758 log_error(r->conf.errh, __FILE__, __LINE__, in connection_handle_read_post_chunked()
1761 return http_response_reqbody_read_error(r, 400); in connection_handle_read_post_chunked()
1776 r->conf.errh)) { in connection_handle_read_post_chunked()
1778 return http_response_reqbody_read_error(r, 500); in connection_handle_read_post_chunked()
1788 log_error(r->conf.errh, __FILE__, __LINE__, in connection_handle_read_post_chunked()
1791 return http_response_reqbody_read_error(r, 400); in connection_handle_read_post_chunked()
1799 r->te_chunked = te_chunked; in connection_handle_read_post_chunked()
1805 connection_handle_read_body_unknown (request_st * const r, chunkqueue * const cq, chunkqueue * cons… in connection_handle_read_body_unknown() argument
1808 const off_t max_request_size = (off_t)r->conf.max_request_size << 10; in connection_handle_read_body_unknown()
1811 log_error(r->conf.errh, __FILE__, __LINE__, in connection_handle_read_body_unknown()
1814 return http_response_reqbody_read_error(r, 413); in connection_handle_read_body_unknown()
1822 connection_check_expect_100 (request_st * const r, connection * const con) in connection_check_expect_100() argument
1828 http_header_request_get(r, HTTP_HEADER_EXPECT, in connection_check_expect_100()
1835 http_header_request_unset(r, HTTP_HEADER_EXPECT, in connection_check_expect_100()
1838 || 0 != r->reqbody_queue.bytes_in in connection_check_expect_100()
1839 || !chunkqueue_is_empty(&r->read_queue) in connection_check_expect_100()
1840 || !chunkqueue_is_empty(&r->write_queue)) in connection_check_expect_100()
1845 if (r->http_version > HTTP_VERSION_1_1) in connection_check_expect_100()
1846 h2_send_100_continue(r, con); in connection_check_expect_100()
1847 else if (r->http_version == HTTP_VERSION_1_1) in connection_check_expect_100()
1848 return connection_write_100_continue(r, con); in connection_check_expect_100()
1855 connection_handle_read_post_state (request_st * const r) in connection_handle_read_post_state() argument
1857 connection * const con = r->con; in connection_handle_read_post_state()
1858 chunkqueue * const cq = &r->read_queue; in connection_handle_read_post_state()
1859 chunkqueue * const dst_cq = &r->reqbody_queue; in connection_handle_read_post_state()
1863 if (r->http_version > HTTP_VERSION_1_1) { in connection_handle_read_post_state()
1865 if (r->h2state >= H2_STATE_HALF_CLOSED_REMOTE) in connection_handle_read_post_state()
1871 !(r->conf.stream_request_body /*(if not streaming request body)*/ in connection_handle_read_post_state()
1874 : (r->conf.stream_request_body & FDEVENT_STREAM_REQUEST_BUFMIN) in connection_handle_read_post_state()
1879 connection_set_state_error(r, CON_STATE_ERROR); in connection_handle_read_post_state()
1892 if (light_btst(r->rqst_htags, HTTP_HEADER_EXPECT) in connection_handle_read_post_state()
1893 && !connection_check_expect_100(r, con)) in connection_handle_read_post_state()
1896 if (r->http_version > HTTP_VERSION_1_1) { in connection_handle_read_post_state()
1899 else if (r->reqbody_length < 0) { in connection_handle_read_post_state()
1901 handler_t rc = (-1 == r->reqbody_length) in connection_handle_read_post_state()
1902 ? connection_handle_read_post_chunked(r, cq, dst_cq) in connection_handle_read_post_state()
1903 : connection_handle_read_body_unknown(r, cq, dst_cq); in connection_handle_read_post_state()
1908 off_t len = (off_t)r->reqbody_length - dst_cq->bytes_in; in connection_handle_read_post_state()
1909 if (r->reqbody_length <= 64*1024) { in connection_handle_read_post_state()
1919 chunkqueue_steal_with_tempfiles(dst_cq,cq,len,r->conf.errh)) { in connection_handle_read_post_state()
1921 return http_response_reqbody_read_error(r, 500); in connection_handle_read_post_state()
1926 if (dst_cq->bytes_in == (off_t)r->reqbody_length) { in connection_handle_read_post_state()
1928 r->conf.stream_request_body &= ~FDEVENT_STREAM_REQUEST_POLLIN; in connection_handle_read_post_state()
1929 if (r->state == CON_STATE_READ_POST) { in connection_handle_read_post_state()
1930 connection_set_state(r, CON_STATE_HANDLE_REQUEST); in connection_handle_read_post_state()
1936 return http_response_reqbody_read_error(r, 400); /* Bad Request */ in connection_handle_read_post_state()
1941 r->conf.stream_request_body |= FDEVENT_STREAM_REQUEST_POLLIN; in connection_handle_read_post_state()
1942 return (r->conf.stream_request_body & FDEVENT_STREAM_REQUEST) in connection_handle_read_post_state()