nginx-0.1.16-RELEASE import
*) Bugfix: if the response were transferred by chunks, then on the HEAD
request the final chunk was issued.
*) Bugfix: the "Connection: keep-alive" header were issued, even if the
keepalive_timeout directive forbade the keep-alive use.
*) Bugfix: the errors in the ngx_http_fastcgi_module caused the
segmentation faults.
*) Bugfix: the compressed response encrypted by SSL may not transferred
complete.
*) Bugfix: the TCP-specific TCP_NODELAY, TCP_NOPSUH, and TCP_CORK
options, are not used for the unix domain sockets.
*) Feature: the rewrite directive supports the arguments rewriting.
*) Bugfix: the response code 400 was returned for the POST request with
the "Content-Length: 0" header; the bug had appeared in 0.1.14.
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index 8110312..209c547 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -35,7 +35,7 @@
static void ngx_http_client_error(ngx_http_request_t *r,
int client_error, int error);
-static u_char *ngx_http_log_error(void *data, u_char *buf, size_t len);
+static u_char *ngx_http_log_error(ngx_log_t *log, u_char *buf, size_t len);
/* NGX_HTTP_PARSE_... errors */
@@ -111,12 +111,14 @@
return;
}
- ctx->connection = c->number;
ctx->client = &c->addr_text;
- ctx->action = "reading client request line";
ctx->request = NULL;
- c->log->data = ctx;
+
+ c->log->connection = c->number;
c->log->handler = ngx_http_log_error;
+ c->log->data = ctx;
+ c->log->action = "reading client request line";
+
c->log_error = NGX_ERROR_INFO;
rev = c->read;
@@ -634,7 +636,7 @@
return;
}
- ctx->action = "reading client request headers";
+ c->log->action = "reading client request headers";
rev->event_handler = ngx_http_process_request_headers;
ngx_http_process_request_headers(rev);
@@ -1099,7 +1101,7 @@
}
}
- if (r->method == NGX_HTTP_POST && r->headers_in.content_length_n <= 0) {
+ if (r->method == NGX_HTTP_POST && r->headers_in.content_length_n == -1) {
return NGX_HTTP_PARSE_POST_WO_CL_HEADER;
}
@@ -1608,7 +1610,6 @@
ngx_event_t *rev, *wev;
ngx_connection_t *c;
ngx_http_connection_t *hc;
- ngx_http_log_ctx_t *ctx;
ngx_http_core_srv_conf_t *cscf;
ngx_http_core_loc_conf_t *clcf;
@@ -1617,8 +1618,7 @@
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "set http keepalive handler");
- ctx = c->log->data;
- ctx->action = "closing request";
+ c->log->action = "closing request";
hc = r->http_connection;
b = r->header_in;
@@ -1682,7 +1682,7 @@
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "pipelined request");
hc->pipeline = 1;
- ctx->action = "reading client pipelined request line";
+ c->log->action = "reading client pipelined request line";
ngx_http_init_request(rev);
return;
}
@@ -1760,7 +1760,7 @@
}
}
- ctx->action = "keepalive";
+ c->log->action = "keepalive";
if (c->tcp_nopush == NGX_TCP_NOPUSH_SET) {
if (ngx_tcp_push(c->fd) == NGX_ERROR) {
@@ -1776,8 +1776,10 @@
tcp_nodelay = 1;
}
- if (tcp_nodelay && clcf->tcp_nodelay && !c->tcp_nodelay) {
-
+ if (tcp_nodelay
+ && clcf->tcp_nodelay
+ && c->tcp_nodelay == NGX_TCP_NODELAY_UNSET)
+ {
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "tcp_nodelay");
if (setsockopt(c->fd, IPPROTO_TCP, TCP_NODELAY,
@@ -1789,7 +1791,7 @@
return;
}
- c->tcp_nodelay = 1;
+ c->tcp_nodelay = NGX_TCP_NODELAY_SET;
}
#if 0
@@ -1809,7 +1811,6 @@
ssize_t n;
ngx_buf_t *b;
ngx_connection_t *c;
- ngx_http_log_ctx_t *ctx;
ngx_http_connection_t *hc;
c = rev->data;
@@ -1821,16 +1822,14 @@
return;
}
- ctx = (ngx_http_log_ctx_t *) rev->log->data;
-
#if (NGX_HAVE_KQUEUE)
if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) {
if (rev->pending_eof) {
- rev->log->handler = NULL;
+ c->log->handler = NULL;
ngx_log_error(NGX_LOG_INFO, c->log, rev->kq_errno,
"kevent() reported that client %V closed "
- "keepalive connection", ctx->client);
+ "keepalive connection", &c->addr_text);
#if (NGX_HTTP_SSL)
if (c->ssl) {
c->ssl->no_send_shut = 1;
@@ -1889,18 +1888,19 @@
return;
}
- rev->log->handler = NULL;
+ c->log->handler = NULL;
if (n == 0) {
ngx_log_error(NGX_LOG_INFO, c->log, ngx_socket_errno,
- "client %V closed keepalive connection", ctx->client);
+ "client %V closed keepalive connection", &c->addr_text);
ngx_http_close_connection(c);
return;
}
b->last += n;
- rev->log->handler = ngx_http_log_error;
- ctx->action = "reading client request line";
+
+ c->log->handler = ngx_http_log_error;
+ c->log->action = "reading client request line";
ngx_http_init_request(rev);
}
@@ -2302,16 +2302,17 @@
}
-static u_char *ngx_http_log_error(void *data, u_char *buf, size_t len)
+static u_char *ngx_http_log_error(ngx_log_t *log, u_char *buf, size_t len)
{
- ngx_http_log_ctx_t *ctx = data;
-
- u_char *p;
+ u_char *p;
+ ngx_http_log_ctx_t *ctx;
p = buf;
- if (ctx->action) {
- p = ngx_snprintf(p, len, " while %s", ctx->action);
+ ctx = log->data;
+
+ if (log->action) {
+ p = ngx_snprintf(p, len, " while %s", log->action);
len -= p - buf;
}