comparison src/http/ngx_http_request.c @ 5102:f597c9be5c92

Use "client_header_timeout" for all requests in a connection. Previously, only the first request in a connection used timeout value from the "client_header_timeout" directive while reading header. All subsequent requests used "keepalive_timeout" for that. It happened because timeout of the read event was set to the value of "keepalive_timeout" in ngx_http_set_keepalive(), but was not removed when the next request arrived.
author Valentin Bartenev <vbart@nginx.com>
date Thu, 07 Mar 2013 17:41:40 +0000
parents d346adac0462
children 05a56ebb084a
comparison
equal deleted inserted replaced
5101:d346adac0462 5102:f597c9be5c92
2734 2734
2735 ngx_http_free_request(r, 0); 2735 ngx_http_free_request(r, 0);
2736 2736
2737 c->data = hc; 2737 c->data = hc;
2738 2738
2739 ngx_add_timer(rev, clcf->keepalive_timeout);
2740
2741 if (ngx_handle_read_event(rev, 0) != NGX_OK) { 2739 if (ngx_handle_read_event(rev, 0) != NGX_OK) {
2742 ngx_http_close_connection(c); 2740 ngx_http_close_connection(c);
2743 return; 2741 return;
2744 } 2742 }
2745 2743
2750 2748
2751 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "pipelined request"); 2749 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "pipelined request");
2752 2750
2753 hc->pipeline = 1; 2751 hc->pipeline = 1;
2754 c->log->action = "reading client pipelined request line"; 2752 c->log->action = "reading client pipelined request line";
2753
2754 if (rev->timer_set) {
2755 ngx_del_timer(rev);
2756 }
2755 2757
2756 rev->handler = ngx_http_init_request; 2758 rev->handler = ngx_http_init_request;
2757 ngx_post_event(rev, &ngx_posted_events); 2759 ngx_post_event(rev, &ngx_posted_events);
2758 return; 2760 return;
2759 } 2761 }
2869 r->http_state = NGX_HTTP_KEEPALIVE_STATE; 2871 r->http_state = NGX_HTTP_KEEPALIVE_STATE;
2870 #endif 2872 #endif
2871 2873
2872 c->idle = 1; 2874 c->idle = 1;
2873 ngx_reusable_connection(c, 1); 2875 ngx_reusable_connection(c, 1);
2876
2877 ngx_add_timer(rev, clcf->keepalive_timeout);
2874 2878
2875 if (rev->ready) { 2879 if (rev->ready) {
2876 ngx_post_event(rev, &ngx_posted_events); 2880 ngx_post_event(rev, &ngx_posted_events);
2877 } 2881 }
2878 } 2882 }
2991 c->log->action = "reading client request line"; 2995 c->log->action = "reading client request line";
2992 2996
2993 c->idle = 0; 2997 c->idle = 0;
2994 ngx_reusable_connection(c, 0); 2998 ngx_reusable_connection(c, 0);
2995 2999
3000 ngx_del_timer(rev);
3001
2996 ngx_http_init_request(rev); 3002 ngx_http_init_request(rev);
2997 } 3003 }
2998 3004
2999 3005
3000 static void 3006 static void