summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2004-12-06 14:42:13 +0000
committerJonathan Kolb <jon@b0g.us>2004-12-06 14:42:13 +0000
commit54c804a94781ad07e2ef17be3848de6670a9850d (patch)
tree36adeee161c7d8f63efb98d885daf0e4f88d04d2
parent36bd191f47f0c42d3bf0703688ba6277aa62c67a (diff)
downloadnginx-0.1.12.tar.gz
Changes with nginx 0.1.12 06 Dec 2004v0.1.12
*) Feature: the %request_length log parameter. *) Bugfix: when using the /dev/poll, select and poll on the platforms, where these methods may do the false reports, there may be the long delay when the request was passed via the keep-alive connection. It may be at least on Solaris when using the /dev/poll. *) Bugfix: the send_lowat directive is ignored on Linux because Linux does not support the SO_SNDLOWAT option.
-rw-r--r--CHANGES13
-rw-r--r--CHANGES.ru13
-rw-r--r--src/core/nginx.h2
-rw-r--r--src/http/modules/ngx_http_index_handler.c4
-rw-r--r--src/http/ngx_http_log_handler.c11
-rw-r--r--src/http/ngx_http_request.c17
-rw-r--r--src/http/ngx_http_request.h2
-rw-r--r--src/http/ngx_http_request_body.c3
-rw-r--r--src/os/unix/ngx_linux_config.h6
-rw-r--r--src/os/unix/ngx_solaris_config.h2
10 files changed, 69 insertions, 4 deletions
diff --git a/CHANGES b/CHANGES
index ec78d7561..50e1209cd 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,17 @@
+Changes with nginx 0.1.12 06 Dec 2004
+
+ *) Feature: the %request_length log parameter.
+
+ *) Bugfix: when using the /dev/poll, select and poll on the platforms,
+ where these methods may do the false reports, there may be the long
+ delay when the request was passed via the keep-alive connection. It
+ may be at least on Solaris when using the /dev/poll.
+
+ *) Bugfix: the send_lowat directive is ignored on Linux because Linux
+ does not support the SO_SNDLOWAT option.
+
+
Changes with nginx 0.1.11 02 Dec 2004
*) Feature: the worker_priority directive.
diff --git a/CHANGES.ru b/CHANGES.ru
index d66eb8665..639d514c8 100644
--- a/CHANGES.ru
+++ b/CHANGES.ru
@@ -1,4 +1,17 @@
+Изменения в nginx 0.1.12 06.12.2004
+
+ *) Добавление: параметр лога %request_length.
+
+ *) Исправление: при использовании /dev/poll, select и poll на платформах,
+ где возможны ложные срабатывания указанных методов, могли быть
+ длительные задержки при обработке запроса по keep-alive соединению.
+ Наблюдалось по крайней мере на Solaris с использованием /dev/poll.
+
+ *) Исправление: директива send_lowat игнорируется на Linux, так как Linux
+ не поддерживает опцию SO_SNDLOWAT.
+
+
Изменения в nginx 0.1.11 02.12.2004
*) Добавление: директива worker_priority.
diff --git a/src/core/nginx.h b/src/core/nginx.h
index 3ac28f155..a36895e35 100644
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,7 +8,7 @@
#define _NGINX_H_INCLUDED_
-#define NGINX_VER "nginx/0.1.11"
+#define NGINX_VER "nginx/0.1.12"
#define NGINX_VAR "NGINX"
#define NGX_NEWPID_EXT ".newbin"
diff --git a/src/http/modules/ngx_http_index_handler.c b/src/http/modules/ngx_http_index_handler.c
index 74ccf0ae1..892b825ae 100644
--- a/src/http/modules/ngx_http_index_handler.c
+++ b/src/http/modules/ngx_http_index_handler.c
@@ -477,12 +477,12 @@ static char *ngx_http_index_merge_loc_conf(ngx_conf_t *cf,
}
}
-#endif
-
if (conf->max_index_len < prev->max_index_len) {
conf->max_index_len = prev->max_index_len;
}
+#endif
+
if (conf->index_cache == NULL) {
conf->index_cache = prev->index_cache;
}
diff --git a/src/http/ngx_http_log_handler.c b/src/http/ngx_http_log_handler.c
index fd373444e..71cbb2953 100644
--- a/src/http/ngx_http_log_handler.c
+++ b/src/http/ngx_http_log_handler.c
@@ -28,6 +28,8 @@ static u_char *ngx_http_log_length(ngx_http_request_t *r, u_char *buf,
uintptr_t data);
static u_char *ngx_http_log_apache_length(ngx_http_request_t *r, u_char *buf,
uintptr_t data);
+static u_char *ngx_http_log_request_length(ngx_http_request_t *r, u_char *buf,
+ uintptr_t data);
static u_char *ngx_http_log_header_in(ngx_http_request_t *r, u_char *buf,
uintptr_t data);
static u_char *ngx_http_log_connection_header_out(ngx_http_request_t *r,
@@ -118,6 +120,8 @@ ngx_http_log_op_name_t ngx_http_log_fmt_ops[] = {
{ ngx_string("status"), 3, ngx_http_log_status },
{ ngx_string("length"), NGX_OFF_T_LEN, ngx_http_log_length },
{ ngx_string("apache_length"), NGX_OFF_T_LEN, ngx_http_log_apache_length },
+ { ngx_string("request_length"), NGX_OFF_T_LEN,
+ ngx_http_log_request_length },
{ ngx_string("i"), NGX_HTTP_LOG_ARG, ngx_http_log_header_in },
{ ngx_string("o"), NGX_HTTP_LOG_ARG, ngx_http_log_header_out },
{ ngx_null_string, 0, NULL }
@@ -283,6 +287,13 @@ static u_char *ngx_http_log_apache_length(ngx_http_request_t *r, u_char *buf,
}
+static u_char *ngx_http_log_request_length(ngx_http_request_t *r, u_char *buf,
+ uintptr_t data)
+{
+ return ngx_sprintf(buf, "%O", r->request_length);
+}
+
+
static u_char *ngx_http_log_header_in(ngx_http_request_t *r, u_char *buf,
uintptr_t data)
{
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index fe3d516cf..b2c35169e 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -795,6 +795,8 @@ static void ngx_http_process_request_headers(ngx_event_t *rev)
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http header done");
+ r->request_length += r->header_in->pos - r->header_in->start;
+
r->http_state = NGX_HTTP_PROCESS_REQUEST_STATE;
rc = ngx_http_process_request_header(r);
@@ -922,6 +924,8 @@ static ngx_int_t ngx_http_alloc_large_header_buffer(ngx_http_request_t *r,
/* the client fills up the buffer with "\r\n" */
+ r->request_length += r->header_in->end - r->header_in->start;
+
r->header_in->pos = r->header_in->start;
r->header_in->last = r->header_in->start;
@@ -981,6 +985,8 @@ static ngx_int_t ngx_http_alloc_large_header_buffer(ngx_http_request_t *r,
* to relocate the parser header pointers
*/
+ r->request_length += r->header_in->end - r->header_in->start;
+
r->header_in = b;
return NGX_OK;
@@ -989,6 +995,8 @@ static ngx_int_t ngx_http_alloc_large_header_buffer(ngx_http_request_t *r,
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http large header copy: %d", r->header_in->pos - old);
+ r->request_length += old - r->header_in->start;
+
new = b->start;
ngx_memcpy(new, old, r->header_in->pos - old);
@@ -1810,6 +1818,10 @@ static void ngx_http_keepalive_handler(ngx_event_t *rev)
c->log_error = NGX_ERROR_INFO;
if (n == NGX_AGAIN) {
+ if (ngx_handle_level_read_event(rev) == NGX_ERROR) {
+ ngx_http_close_connection(c);
+ }
+
return;
}
@@ -1932,6 +1944,11 @@ static void ngx_http_lingering_close_handler(ngx_event_t *rev)
} while (rev->ready);
+ if (ngx_handle_level_read_event(rev) == NGX_ERROR) {
+ ngx_http_close_connection(c);
+ return;
+ }
+
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
timer *= 1000;
diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h
index 141daa1b8..bdc9cb2e5 100644
--- a/src/http/ngx_http_request.h
+++ b/src/http/ngx_http_request.h
@@ -298,6 +298,8 @@ struct ngx_http_request_s {
/* used to learn the Apache compatible response length without a header */
size_t header_size;
+ size_t request_length;
+
u_char *discarded_buffer;
void **err_ctx;
ngx_uint_t err_status;
diff --git a/src/http/ngx_http_request_body.c b/src/http/ngx_http_request_body.c
index c9ec6fa07..eb6aebfc6 100644
--- a/src/http/ngx_http_request_body.c
+++ b/src/http/ngx_http_request_body.c
@@ -42,6 +42,7 @@ ngx_int_t ngx_http_read_client_request_body(ngx_http_request_t *r)
/* the whole request body was pre-read */
r->header_in->pos += r->headers_in.content_length_n;
+ r->request_length += r->headers_in.content_length_n;
r->request_body->handler(r->request_body->data);
@@ -49,6 +50,7 @@ ngx_int_t ngx_http_read_client_request_body(ngx_http_request_t *r)
}
r->header_in->pos = r->header_in->last;
+ r->request_length += size;
}
@@ -173,6 +175,7 @@ static ngx_int_t ngx_http_do_read_client_request_body(ngx_http_request_t *r)
r->request_body->buf->last += n;
r->request_body->rest -= n;
+ r->request_length += n;
if (r->request_body->rest == 0) {
break;
diff --git a/src/os/unix/ngx_linux_config.h b/src/os/unix/ngx_linux_config.h
index 84eaf5c6a..bb08f41e3 100644
--- a/src/os/unix/ngx_linux_config.h
+++ b/src/os/unix/ngx_linux_config.h
@@ -80,6 +80,12 @@ extern ssize_t sendfile(int s, int fd, int32_t *offset, size_t size);
#endif
+#ifndef NGX_HAVE_SO_SNDLOWAT
+/* setsockopt(SO_SNDLOWAT) returns ENOPROTOOPT */
+#define NGX_HAVE_SO_SNDLOWAT 0
+#endif
+
+
#ifndef NGX_HAVE_INHERITED_NONBLOCK
#define NGX_HAVE_INHERITED_NONBLOCK 0
#endif
diff --git a/src/os/unix/ngx_solaris_config.h b/src/os/unix/ngx_solaris_config.h
index 452850c0f..e387006da 100644
--- a/src/os/unix/ngx_solaris_config.h
+++ b/src/os/unix/ngx_solaris_config.h
@@ -76,7 +76,7 @@
#ifndef NGX_HAVE_SO_SNDLOWAT
-/* setsockopt(SO_SNDLOWAT) returns error "Option not supported by protocol" */
+/* setsockopt(SO_SNDLOWAT) returns ENOPROTOOPT */
#define NGX_HAVE_SO_SNDLOWAT 0
#endif