diff options
author | Igor Sysoev <igor@sysoev.ru> | 2005-10-21 19:12:18 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2005-10-21 19:12:18 +0000 |
commit | 055951dc96d1ba9457cdce04bad60fe50b6ea7be (patch) | |
tree | 1ed865f8a532be30837787ff3ee0305f4d86596a /src/http/ngx_http_request.c | |
parent | b6b31c91be09794b3689bb705b29cc8cb2f7258a (diff) | |
download | nginx-release-0.3.5.tar.gz nginx-release-0.3.5.zip |
nginx-0.3.5-RELEASE importrelease-0.3.5
*) Bugfix: the segmentation fault may occurred if the IMAP/POP3 login
was changed by authorization server; the bug had appeared in 0.2.2.
*) Bugfix: the accept mutex did not work and all connections were
handled by one process; the bug had appeared in 0.3.3.
*) Bugfix: the timeout did not work if the "rtsig" method and the
"timer_resolution" directive were used.
Diffstat (limited to 'src/http/ngx_http_request.c')
-rw-r--r-- | src/http/ngx_http_request.c | 77 |
1 files changed, 34 insertions, 43 deletions
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index 9071ae5a4..58f13c449 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -159,23 +159,18 @@ ngx_http_init_connection(ngx_connection_t *c) /* STUB: epoll edge */ c->write->handler = ngx_http_empty_handler; +#if (NGX_STAT_STUB) + ngx_atomic_fetch_add(ngx_stat_reading, 1); +#endif + if (rev->ready) { /* the deferred accept(), rtsig, aio, iocp */ if (ngx_accept_mutex) { - ngx_post_event(rev, &ngx_posted_events); - -#if (NGX_STAT_STUB) - ngx_atomic_fetch_add(ngx_stat_reading, 1); -#endif return; } -#if (NGX_STAT_STUB) - ngx_atomic_fetch_add(ngx_stat_reading, 1); -#endif - ngx_http_init_request(rev); return; } @@ -183,14 +178,12 @@ ngx_http_init_connection(ngx_connection_t *c) ngx_add_timer(rev, c->listening->post_accept_timeout); if (ngx_handle_read_event(rev, 0) == NGX_ERROR) { +#if (NGX_STAT_STUB) + ngx_atomic_fetch_add(ngx_stat_reading, -1); +#endif ngx_http_close_connection(c); return; } - -#if (NGX_STAT_STUB) - ngx_atomic_fetch_add(ngx_stat_reading, 1); -#endif - } @@ -213,35 +206,24 @@ void ngx_http_init_request(ngx_event_t *rev) ngx_http_ssl_srv_conf_t *sscf; #endif +#if (NGX_STAT_STUB) + ngx_atomic_fetch_add(ngx_stat_reading, -1); +#endif + c = rev->data; if (rev->timedout) { ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out"); -#if (NGX_STAT_STUB) - ngx_atomic_fetch_add(ngx_stat_reading, -1); -#endif - ngx_http_close_connection(c); return; } hc = c->data; - if (hc) { - -#if (NGX_STAT_STUB) - ngx_atomic_fetch_add(ngx_stat_reading, 1); -#endif - - } else { + if (hc == NULL) { hc = ngx_pcalloc(c->pool, sizeof(ngx_http_connection_t)); if (hc == NULL) { - -#if (NGX_STAT_STUB) - ngx_atomic_fetch_add(ngx_stat_reading, -1); -#endif - ngx_http_close_connection(c); return; } @@ -261,11 +243,6 @@ void ngx_http_init_request(ngx_event_t *rev) } else { r = ngx_pcalloc(c->pool, sizeof(ngx_http_request_t)); if (r == NULL) { - -#if (NGX_STAT_STUB) - ngx_atomic_fetch_add(ngx_stat_reading, -1); -#endif - ngx_http_close_connection(c); return; } @@ -273,10 +250,6 @@ void ngx_http_init_request(ngx_event_t *rev) hc->request = r; } -#if (NGX_STAT_STUB) - ngx_atomic_fetch_add(ngx_stat_reading, -1); -#endif - c->data = r; r->http_connection = hc; @@ -1652,8 +1625,15 @@ ngx_http_writer(ngx_http_request_t *r) ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out"); c->timedout = 1; - ngx_http_close_request(r, NGX_HTTP_REQUEST_TIME_OUT); + +#if 0 + ngx_http_close_request(r->main, NGX_HTTP_REQUEST_TIME_OUT); ngx_http_close_connection(c); +#endif + + c->closed = 1; + ngx_http_finalize_request(r, 0); + return; } @@ -1665,7 +1645,7 @@ ngx_http_writer(ngx_http_request_t *r) ngx_add_timer(wev, clcf->send_timeout); if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) { - ngx_http_close_request(r, 0); + ngx_http_close_request(r->main, 0); ngx_http_close_connection(r->connection); } @@ -1680,7 +1660,7 @@ ngx_http_writer(ngx_http_request_t *r) clcf = ngx_http_get_module_loc_conf(r->main, ngx_http_core_module); if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) { - ngx_http_close_request(r, 0); + ngx_http_close_request(r->main, 0); ngx_http_close_connection(r->connection); } @@ -1711,7 +1691,7 @@ ngx_http_writer(ngx_http_request_t *r) } if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) { - ngx_http_close_request(r, 0); + ngx_http_close_request(r->main, 0); ngx_http_close_connection(r->connection); } @@ -1988,8 +1968,13 @@ ngx_http_set_keepalive(ngx_http_request_t *r) ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "pipelined request"); +#if (NGX_STAT_STUB) + ngx_atomic_fetch_add(ngx_stat_reading, 1); +#endif + hc->pipeline = 1; c->log->action = "reading client pipelined request line"; + ngx_http_init_request(rev); return; } @@ -2206,6 +2191,10 @@ ngx_http_keepalive_handler(ngx_event_t *rev) b->last += n; +#if (NGX_STAT_STUB) + ngx_atomic_fetch_add(ngx_stat_reading, 1); +#endif + c->log->handler = ngx_http_log_error; c->log->action = "reading client request line"; @@ -2388,6 +2377,7 @@ ngx_http_close_request(ngx_http_request_t *r, ngx_int_t error) } #if (NGX_STAT_STUB) + if (r->stat_reading) { ngx_atomic_fetch_add(ngx_stat_reading, -1); } @@ -2395,6 +2385,7 @@ ngx_http_close_request(ngx_http_request_t *r, ngx_int_t error) if (r->stat_writing) { ngx_atomic_fetch_add(ngx_stat_writing, -1); } + #endif if (error && r->headers_out.status == 0) { |