From 916794d5bc009ad014e9cc1446d049fdb50de23e Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Mon, 11 Oct 2004 15:06:17 +0000 Subject: Changes with nginx 0.1.1 11 Oct 2004 *) Feature: the gzip_types directive. *) Feature: the tcp_nodelay directive. *) Feature: the send_lowat directive is working not only on OSes that support kqueue NOTE_LOWAT, but also on OSes that support SO_SNDLOWAT. *) Feature: the setproctitle() emulation for Linux and Solaris. *) Bugfix: the "Location" header rewrite bug fixed while the proxing. *) Bugfix: the ngx_http_chunked_module module bug fixed that caused an endless loop. *) Bugfix: the /dev/poll module bugs fixed. *) Bugfix: the responses were corrupted when the temporary files were used while the proxing. *) Bugfix: the unescaped requests were passed to the backend. *) Bugfix: while the build configuration on Linux 2.4 the --with-poll_module parameter was required. --- src/http/ngx_http_request.c | 48 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 11 deletions(-) (limited to 'src/http/ngx_http_request.c') diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index e889449ae..6069847f5 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -550,7 +550,7 @@ static void ngx_http_process_request_line(ngx_event_t *rev) return; } - if (r->complex_uri) { + if (r->complex_uri || r->quoted_uri) { rc = ngx_http_parse_complex_uri(r); if (rc == NGX_HTTP_INTERNAL_SERVER_ERROR) { @@ -1318,8 +1318,7 @@ static void ngx_http_set_write_handler(ngx_http_request_t *r) ngx_add_timer(wev, clcf->send_timeout); } - wev->available = clcf->send_lowat; - if (ngx_handle_write_event(wev, NGX_LOWAT_EVENT) == NGX_ERROR) { + if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) { ngx_http_close_request(r, 0); ngx_http_close_connection(r->connection); } @@ -1354,9 +1353,7 @@ void ngx_http_writer(ngx_event_t *wev) ngx_http_core_module); ngx_add_timer(wev, clcf->send_timeout); - wev->available = clcf->send_lowat; - - if (ngx_handle_write_event(wev, NGX_LOWAT_EVENT) == NGX_ERROR) { + if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) { ngx_http_close_request(r, 0); ngx_http_close_connection(r->connection); } @@ -1371,9 +1368,8 @@ void ngx_http_writer(ngx_event_t *wev) clcf = ngx_http_get_module_loc_conf(r->main ? r->main : r, ngx_http_core_module); - wev->available = clcf->send_lowat; - if (ngx_handle_write_event(wev, NGX_LOWAT_EVENT) == NGX_ERROR) { + if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) { ngx_http_close_request(r, 0); ngx_http_close_connection(r->connection); } @@ -1394,9 +1390,7 @@ void ngx_http_writer(ngx_event_t *wev) ngx_add_timer(wev, clcf->send_timeout); } - wev->available = clcf->send_lowat; - - if (ngx_handle_write_event(wev, NGX_LOWAT_EVENT) == NGX_ERROR) { + if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) { ngx_http_close_request(r, 0); ngx_http_close_connection(r->connection); } @@ -1541,6 +1535,7 @@ static ngx_int_t ngx_http_read_discarded_body(ngx_http_request_t *r) static void ngx_http_set_keepalive(ngx_http_request_t *r) { + int tcp_nodelay; ngx_int_t i; ngx_buf_t *b, *f; ngx_event_t *rev, *wev; @@ -1684,7 +1679,26 @@ static void ngx_http_set_keepalive(ngx_http_request_t *r) ngx_http_close_connection(c); return; } + c->tcp_nopush = NGX_TCP_NOPUSH_UNSET; + + } else { + if (clcf->tcp_nodelay && !c->tcp_nodelay) { + tcp_nodelay = 1; + + ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "tcp_nodelay"); + + if (setsockopt(c->fd, IPPROTO_TCP, TCP_NODELAY, + (const void *) &tcp_nodelay, sizeof(int)) == -1) + { + ngx_connection_error(c, ngx_socket_errno, + "setsockopt(TCP_NODELAY) failed"); + ngx_http_close_connection(c); + return; + } + + c->tcp_nodelay = 1; + } } #if 0 @@ -2055,6 +2069,18 @@ void ngx_http_close_connection(ngx_connection_t *c) ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, "close http connection: %d", c->fd); +#if (NGX_OPENSSL) + + if (c->ssl) { + if (ngx_ssl_shutdown(c) == NGX_AGAIN) { + c->read->event_handler = ngx_ssl_close_handler; + c->write->event_handler = ngx_ssl_close_handler; + return; + } + } + +#endif + #if (NGX_STAT_STUB) (*ngx_stat_active)--; #endif -- cgit v1.2.1