From da173abde0afa26b02c778d6475462ed487594c5 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Wed, 30 Aug 2006 10:39:17 +0000 Subject: nginx-0.4.0-RELEASE import *) Change in internal API: the HTTP modules initialization was moved from the init module phase to the HTTP postconfiguration phase. *) Change: now the request body is not read beforehand for the ngx_http_perl_module: it's required to start the reading using the $r->has_request_body method. *) Feature: the ngx_http_perl_module supports the DECLINED return code. *) Feature: the ngx_http_dav_module supports the incoming "Date" header line for the PUT method. *) Feature: the "ssi" directive is available inside the "if" block. *) Bugfix: a segmentation fault occurred if there was an "index" directive with variables and the first index name was without variables; the bug had appeared in 0.1.29. --- src/http/ngx_http_request.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 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 eb8b557b4..73eeeb07f 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -140,6 +140,9 @@ ngx_http_header_t ngx_http_headers_in[] = { { ngx_string("Destination"), offsetof(ngx_http_headers_in_t, destination), ngx_http_process_header_line }, + + { ngx_string("Date"), offsetof(ngx_http_headers_in_t, date), + ngx_http_process_header_line }, #endif { ngx_string("Cookie"), 0, ngx_http_process_cookie }, @@ -933,9 +936,11 @@ ngx_http_read_request_header(ngx_http_request_t *r) { ssize_t n; ngx_event_t *rev; + ngx_connection_t *c; ngx_http_core_srv_conf_t *cscf; - rev = r->connection->read; + c = r->connection; + rev = c->read; n = r->header_in->last - r->header_in->pos; @@ -944,8 +949,8 @@ ngx_http_read_request_header(ngx_http_request_t *r) } if (rev->ready) { - n = r->connection->recv(r->connection, r->header_in->last, - r->header_in->end - r->header_in->last); + n = c->recv(c, r->header_in->last, + r->header_in->end - r->header_in->last); } else { n = NGX_AGAIN; } @@ -966,11 +971,14 @@ ngx_http_read_request_header(ngx_http_request_t *r) } if (n == 0) { - ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, + ngx_log_error(NGX_LOG_INFO, c->log, 0, "client closed prematurely connection"); } if (n == 0 || n == NGX_ERROR) { + c->error = rev->error; + c->log->action = "sending response to client"; + ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); return NGX_ERROR; } @@ -1155,8 +1163,9 @@ ngx_http_process_unique_header_line(ngx_http_request_t *r, ngx_table_elt_t *h, } ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, - "client sent duplicate header line: \"%V: %V\"", - &h->key, &h->value); + "client sent duplicate header line: \"%V: %V\", " + "previous value: \"%V: %V\"", + &h->key, &h->value, &(*ph)->key, &(*ph)->value); ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); @@ -1460,6 +1469,13 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc) "http finalize request: %d, \"%V?%V\"", rc, &r->uri, &r->args); + if (rc == NGX_DECLINED) { + r->content_handler = NULL; + r->write_event_handler = ngx_http_core_run_phases; + ngx_http_core_run_phases(r); + return; + } + if (r != r->main && rc != NGX_ERROR && !r->connection->error -- cgit