diff options
Diffstat (limited to 'src/http')
-rw-r--r-- | src/http/modules/ngx_http_static_module.c | 6 | ||||
-rw-r--r-- | src/http/ngx_http_request.c | 12 | ||||
-rw-r--r-- | src/http/ngx_http_request.h | 5 | ||||
-rw-r--r-- | src/http/ngx_http_special_response.c | 4 |
4 files changed, 17 insertions, 10 deletions
diff --git a/src/http/modules/ngx_http_static_module.c b/src/http/modules/ngx_http_static_module.c index e9d2b395d..ed360faec 100644 --- a/src/http/modules/ngx_http_static_module.c +++ b/src/http/modules/ngx_http_static_module.c @@ -244,12 +244,12 @@ ngx_http_static_handler(ngx_http_request_t *r) return NGX_HTTP_INTERNAL_SERVER_ERROR; } - r->allow_ranges = 1; - - if (r->header_only || (r->main != r && ngx_file_size(&fi) == 0)) { + if (r->main != r && ngx_file_size(&fi) == 0) { return ngx_http_send_header(r); } + r->allow_ranges = 1; + /* we need to allocate all before the header would be sent */ b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t)); diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index 569f62e1d..c6d6d6fc2 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -1460,6 +1460,11 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc) if (rc >= NGX_HTTP_SPECIAL_RESPONSE || rc == NGX_HTTP_NO_CONTENT) { + if (rc == NGX_HTTP_CLOSE) { + ngx_http_close_request(r, rc); + return; + } + if (r->main == r) { if (r->connection->read->timer_set) { ngx_del_timer(r->connection->read); @@ -1556,6 +1561,7 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc) ngx_del_timer(r->connection->write); } +#if 0 if (r->connection->read->pending_eof) { #if (NGX_HAVE_KQUEUE) ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, @@ -1565,6 +1571,7 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc) ngx_http_close_request(r, 0); return; } +#endif if (!ngx_terminate && !ngx_exiting @@ -2046,10 +2053,7 @@ ngx_http_keepalive_handler(ngx_event_t *rev) #if (NGX_HAVE_KQUEUE) if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { - if (rev->pending_eof - /* FreeBSD 5.x-6.x may erroneously report ETIMEDOUT */ - && rev->kq_errno != NGX_ETIMEDOUT) - { + if (rev->pending_eof) { c->log->handler = NULL; ngx_log_error(NGX_LOG_INFO, c->log, rev->kq_errno, "kevent() reported that client %V closed " diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h index 7b0e7f0da..9e6fd15e0 100644 --- a/src/http/ngx_http_request.h +++ b/src/http/ngx_http_request.h @@ -66,7 +66,10 @@ /* Our own HTTP codes */ -#define NGX_HTTP_NGX_CODES NGX_HTTP_TO_HTTPS +/* The special code to close connection without any response */ +#define NGX_HTTP_CLOSE 444 + +#define NGX_HTTP_OWN_CODES NGX_HTTP_TO_HTTPS /* * We use the special code for the plain HTTP requests that are sent to diff --git a/src/http/ngx_http_special_response.c b/src/http/ngx_http_special_response.c index b8d698f71..f4ad1a771 100644 --- a/src/http/ngx_http_special_response.c +++ b/src/http/ngx_http_special_response.c @@ -328,14 +328,14 @@ ngx_http_special_response_handler(ngx_http_request_t *r, ngx_int_t error) /* 3XX */ err = error - NGX_HTTP_MOVED_PERMANENTLY + NGX_HTTP_LEVEL_200; - } else if (error < NGX_HTTP_NGX_CODES) { + } else if (error < NGX_HTTP_OWN_CODES) { /* 4XX */ err = error - NGX_HTTP_BAD_REQUEST + NGX_HTTP_LEVEL_200 + NGX_HTTP_LEVEL_300; } else { /* 49X, 5XX */ - err = error - NGX_HTTP_NGX_CODES + NGX_HTTP_LEVEL_200 + err = error - NGX_HTTP_OWN_CODES + NGX_HTTP_LEVEL_200 + NGX_HTTP_LEVEL_300 + NGX_HTTP_LEVEL_400; switch (error) { |