nginx-0.3.12-RELEASE import
*) Security: if nginx was built with the ngx_http_realip_module and the
"satisfy_any on" directive was used, then access and authorization
directives did not work. The ngx_http_realip_module was not built
and is not built by default.
*) Change: the "$time_gmt" variable name was changed to "$time_local".
*) Change: the "proxy_header_buffer_size" and
"fastcgi_header_buffer_size" directives was renamed to the
"proxy_buffer_size" and "fastcgi_buffer_size" directives.
*) Feature: the ngx_http_memcached_module.
*) Feature: the "proxy_buffering" directive.
*) Bugfix: the changes in accept mutex handling when the "rtsig" method
was used; the bug had appeared in 0.3.0.
*) Bugfix: if the client sent the "Transfer-Encoding: chunked" header
line, then nginx returns the 411 error.
*) Bugfix: if the "auth_basic" directive was inherited from the http
level, then the realm in the "WWW-Authenticate" header line was
without the "Basic realm" text.
*) Bugfix: if the "combined" format was explicitly specified in the
"access_log" directive, then the empty lines was written to the log;
the bug had appeared in 0.3.8.
*) Bugfix: nginx did not run on the sparc platform under any OS except
Solaris.
*) Bugfix: now it is not necessary to place space between the quoted
string and closing bracket in the "if" directive.
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index a73c788..f695056 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -95,6 +95,10 @@
{ ngx_string("Range"), offsetof(ngx_http_headers_in_t, range),
ngx_http_process_header_line },
+ { ngx_string("Transfer-Encoding"),
+ offsetof(ngx_http_headers_in_t, transfer_encoding),
+ ngx_http_process_header_line },
+
#if (NGX_HTTP_GZIP)
{ ngx_string("Accept-Encoding"),
offsetof(ngx_http_headers_in_t, accept_encoding),
@@ -377,7 +381,8 @@
if (ngx_list_init(&r->headers_out.headers, r->pool, 20,
- sizeof(ngx_table_elt_t)) == NGX_ERROR)
+ sizeof(ngx_table_elt_t))
+ == NGX_ERROR)
{
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
return;
@@ -660,7 +665,8 @@
if (ngx_list_init(&r->headers_in.headers, r->pool, 20,
- sizeof(ngx_table_elt_t)) == NGX_ERROR)
+ sizeof(ngx_table_elt_t))
+ == NGX_ERROR)
{
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
return;
@@ -668,7 +674,8 @@
if (ngx_array_init(&r->headers_in.cookies, r->pool, 2,
- sizeof(ngx_table_elt_t *)) == NGX_ERROR)
+ sizeof(ngx_table_elt_t *))
+ == NGX_ERROR)
{
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
return;
@@ -1213,7 +1220,7 @@
if (r->headers_in.content_length_n == NGX_ERROR) {
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
"client sent invalid \"Content-Length\" header");
- ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
+ ngx_http_finalize_request(r, NGX_HTTP_LENGTH_REQUIRED);
return NGX_ERROR;
}
}
@@ -1221,7 +1228,16 @@
if (r->method == NGX_HTTP_POST && r->headers_in.content_length_n == -1) {
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
"client sent POST method without \"Content-Length\" header");
- ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
+ ngx_http_finalize_request(r, NGX_HTTP_LENGTH_REQUIRED);
+ return NGX_ERROR;
+ }
+
+ if (r->headers_in.transfer_encoding
+ && ngx_strstr(r->headers_in.transfer_encoding->value.data, "chunked"))
+ {
+ ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
+ "client sent \"Transfer-Encoding: chunked\" header");
+ ngx_http_finalize_request(r, NGX_HTTP_LENGTH_REQUIRED);
return NGX_ERROR;
}
@@ -2095,7 +2111,10 @@
#if (NGX_HAVE_KQUEUE)
if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) {
- if (rev->pending_eof) {
+ if (rev->pending_eof
+ /* FreeBSD 5.x-6.x may erroneously report ETIMEDOUT */
+ && rev->kq_errno != NGX_ETIMEDOUT)
+ {
c->log->handler = NULL;
ngx_log_error(NGX_LOG_INFO, c->log, rev->kq_errno,
"kevent() reported that client %V closed "
@@ -2312,7 +2331,7 @@
ngx_int_t
-ngx_http_send_last(ngx_http_request_t *r)
+ngx_http_send_special(ngx_http_request_t *r, ngx_uint_t flags)
{
ngx_buf_t *b;
ngx_chain_t out;
@@ -2322,7 +2341,14 @@
return NGX_ERROR;
}
- b->last_buf = 1;
+ if (flags & NGX_HTTP_LAST) {
+ b->last_buf = 1;
+ }
+
+ if (flags & NGX_HTTP_FLUSH) {
+ b->flush = 1;
+ }
+
out.buf = b;
out.next = NULL;
@@ -2354,8 +2380,10 @@
ngx_http_request_done(ngx_http_request_t *r, ngx_int_t error)
{
ngx_log_t *log;
+ ngx_uint_t i, n;
struct linger linger;
ngx_http_log_ctx_t *ctx;
+ ngx_http_handler_pt *log_handler;
ngx_http_core_loc_conf_t *clcf;
ngx_http_core_main_conf_t *cmcf;
@@ -2386,8 +2414,10 @@
cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
- if (cmcf->log_handler) {
- cmcf->log_handler(r);
+ log_handler = cmcf->phases[NGX_HTTP_LOG_PHASE].handlers.elts;
+ n = cmcf->phases[NGX_HTTP_LOG_PHASE].handlers.nelts;
+ for (i = 0; i < n; i++) {
+ log_handler[i](r);
}
if (r->connection->timedout) {