nginx-0.1.12-RELEASE import

*) 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.
This commit is contained in:
Igor Sysoev 2004-12-06 14:45:08 +00:00
parent c372e09ab3
commit 6a12fc91b0
9 changed files with 83 additions and 4 deletions

View File

@ -6,6 +6,46 @@
title="nginx"> title="nginx">
<changes ver="0.1.12" date="06.12.2004">
<change type="feature">
<para lang="ru">
ÐÁÒÁÍÅÔÒ ÌÏÇÁ %request_length.
</para>
<para lang="en">
the %request_length log parameter.
</para>
</change>
<change type="bugfix">
<para lang="ru">
ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ /dev/poll, select É poll ÎÁ ÐÌÁÔÆÏÒÍÁÈ, ÇÄÅ ×ÏÚÍÏÖÎÙ
ÌÏÖÎÙÅ ÓÒÁÂÁÔÙ×ÁÎÉÑ ÕËÁÚÁÎÎÙÈ ÍÅÔÏÄÏ×, ÍÏÇÌÉ ÂÙÔØ ÄÌÉÔÅÌØÎÙÅ ÚÁÄÅÒÖËÉ
ÐÒÉ ÏÂÒÁÂÏÔËÅ ÚÁÐÒÏÓÁ ÐÏ keep-alive ÓÏÅÄÉÎÅÎÉÀ.
îÁÂÌÀÄÁÌÏÓØ ÐÏ ËÒÁÊÎÅÊ ÍÅÒÅ ÎÁ Solaris Ó ÉÓÐÏÌØÚÏ×ÁÎÉÅÍ /dev/poll.
</para>
<para lang="en">
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.
</para>
</change>
<change type="bugfix">
<para lang="ru">
ÄÉÒÅËÔÉ×Á send_lowat ÉÇÎÏÒÉÒÕÅÔÓÑ ÎÁ Linux, ÔÁË ËÁË Linux ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔ
ÏÐÃÉÀ SO_SNDLOWAT.
</para>
<para lang="en">
the send_lowat directive is ignored on Linux because Linux does not support
the SO_SNDLOWAT option.
</para>
</change>
</changes>
<changes ver="0.1.11" date="02.12.2004"> <changes ver="0.1.11" date="02.12.2004">
<change type="feature"> <change type="feature">

View File

@ -8,7 +8,7 @@
#define _NGINX_H_INCLUDED_ #define _NGINX_H_INCLUDED_
#define NGINX_VER "nginx/0.1.11" #define NGINX_VER "nginx/0.1.12"
#define NGINX_VAR "NGINX" #define NGINX_VAR "NGINX"
#define NGX_NEWPID_EXT ".newbin" #define NGX_NEWPID_EXT ".newbin"

View File

@ -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) { if (conf->max_index_len < prev->max_index_len) {
conf->max_index_len = prev->max_index_len; conf->max_index_len = prev->max_index_len;
} }
#endif
if (conf->index_cache == NULL) { if (conf->index_cache == NULL) {
conf->index_cache = prev->index_cache; conf->index_cache = prev->index_cache;
} }

View File

@ -28,6 +28,8 @@ static u_char *ngx_http_log_length(ngx_http_request_t *r, u_char *buf,
uintptr_t data); uintptr_t data);
static u_char *ngx_http_log_apache_length(ngx_http_request_t *r, u_char *buf, static u_char *ngx_http_log_apache_length(ngx_http_request_t *r, u_char *buf,
uintptr_t data); 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, static u_char *ngx_http_log_header_in(ngx_http_request_t *r, u_char *buf,
uintptr_t data); uintptr_t data);
static u_char *ngx_http_log_connection_header_out(ngx_http_request_t *r, 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("status"), 3, ngx_http_log_status },
{ ngx_string("length"), NGX_OFF_T_LEN, ngx_http_log_length }, { 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("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("i"), NGX_HTTP_LOG_ARG, ngx_http_log_header_in },
{ ngx_string("o"), NGX_HTTP_LOG_ARG, ngx_http_log_header_out }, { ngx_string("o"), NGX_HTTP_LOG_ARG, ngx_http_log_header_out },
{ ngx_null_string, 0, NULL } { 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, static u_char *ngx_http_log_header_in(ngx_http_request_t *r, u_char *buf,
uintptr_t data) uintptr_t data)
{ {

View File

@ -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, ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http header done"); "http header done");
r->request_length += r->header_in->pos - r->header_in->start;
r->http_state = NGX_HTTP_PROCESS_REQUEST_STATE; r->http_state = NGX_HTTP_PROCESS_REQUEST_STATE;
rc = ngx_http_process_request_header(r); 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" */ /* 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->pos = r->header_in->start;
r->header_in->last = 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 * to relocate the parser header pointers
*/ */
r->request_length += r->header_in->end - r->header_in->start;
r->header_in = b; r->header_in = b;
return NGX_OK; 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, ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http large header copy: %d", r->header_in->pos - old); "http large header copy: %d", r->header_in->pos - old);
r->request_length += old - r->header_in->start;
new = b->start; new = b->start;
ngx_memcpy(new, old, r->header_in->pos - old); 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; c->log_error = NGX_ERROR_INFO;
if (n == NGX_AGAIN) { if (n == NGX_AGAIN) {
if (ngx_handle_level_read_event(rev) == NGX_ERROR) {
ngx_http_close_connection(c);
}
return; return;
} }
@ -1932,6 +1944,11 @@ static void ngx_http_lingering_close_handler(ngx_event_t *rev)
} while (rev->ready); } 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); clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
timer *= 1000; timer *= 1000;

View File

@ -298,6 +298,8 @@ struct ngx_http_request_s {
/* used to learn the Apache compatible response length without a header */ /* used to learn the Apache compatible response length without a header */
size_t header_size; size_t header_size;
size_t request_length;
u_char *discarded_buffer; u_char *discarded_buffer;
void **err_ctx; void **err_ctx;
ngx_uint_t err_status; ngx_uint_t err_status;

View File

@ -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 */ /* the whole request body was pre-read */
r->header_in->pos += r->headers_in.content_length_n; 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); 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->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->buf->last += n;
r->request_body->rest -= n; r->request_body->rest -= n;
r->request_length += n;
if (r->request_body->rest == 0) { if (r->request_body->rest == 0) {
break; break;

View File

@ -80,6 +80,12 @@ extern ssize_t sendfile(int s, int fd, int32_t *offset, size_t size);
#endif #endif
#ifndef NGX_HAVE_SO_SNDLOWAT
/* setsockopt(SO_SNDLOWAT) returns ENOPROTOOPT */
#define NGX_HAVE_SO_SNDLOWAT 0
#endif
#ifndef NGX_HAVE_INHERITED_NONBLOCK #ifndef NGX_HAVE_INHERITED_NONBLOCK
#define NGX_HAVE_INHERITED_NONBLOCK 0 #define NGX_HAVE_INHERITED_NONBLOCK 0
#endif #endif

View File

@ -76,7 +76,7 @@
#ifndef NGX_HAVE_SO_SNDLOWAT #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 #define NGX_HAVE_SO_SNDLOWAT 0
#endif #endif