diff options
author | Igor Sysoev <igor@sysoev.ru> | 2004-11-25 16:17:31 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2004-11-25 16:17:31 +0000 |
commit | f69060481edeaca075669b50e34ca8ec821c2401 (patch) | |
tree | 6fa6907cc2fdfe0ac6bcdf7f63e76a7f8b41f33f /src/core | |
parent | 865a7de474a13c5f1202f97fac31565f33a5e1a1 (diff) | |
download | nginx-release-0.1.9.tar.gz nginx-release-0.1.9.zip |
nginx-0.1.9-RELEASE importrelease-0.1.9
*) Bugfix: the proxied request was sent without arguments if the
request contains "//", "/./", "/../" or "%XX".
*) Bugfix: the large compressed responses may be transferred not
completely.
*) Bugfix: the files bigger than 2G was not transferred on Linux that
does not support sendfile64().
*) Bugfix: while the build configuration on Linux the
--with-poll_module parameter was required; the bug had appeared in
0.1.8.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/nginx.c | 2 | ||||
-rw-r--r-- | src/core/nginx.h | 2 | ||||
-rw-r--r-- | src/core/ngx_buf.c | 2 | ||||
-rw-r--r-- | src/core/ngx_config.h | 14 | ||||
-rw-r--r-- | src/core/ngx_connection.h | 6 | ||||
-rw-r--r-- | src/core/ngx_output_chain.c | 111 | ||||
-rw-r--r-- | src/core/ngx_times.c | 4 |
7 files changed, 118 insertions, 23 deletions
diff --git a/src/core/nginx.c b/src/core/nginx.c index 53ac666cd..887fc7997 100644 --- a/src/core/nginx.c +++ b/src/core/nginx.c @@ -112,7 +112,7 @@ ngx_uint_t ngx_max_module; -int main(int argc, char *const *argv, char *const *envp) +int main(int argc, char *const *argv) { ngx_int_t i; ngx_log_t *log; diff --git a/src/core/nginx.h b/src/core/nginx.h index 5f2339b6f..d737d6b63 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.8" +#define NGINX_VER "nginx/0.1.9" #define NGINX_VAR "NGINX" #define NGX_NEWPID_EXT ".newbin" diff --git a/src/core/ngx_buf.c b/src/core/ngx_buf.c index 7d379890f..dedf4444e 100644 --- a/src/core/ngx_buf.c +++ b/src/core/ngx_buf.c @@ -140,7 +140,7 @@ void ngx_chain_update_chains(ngx_chain_t **free, ngx_chain_t **busy, break; } -#if (HAVE_WRITE_ZEROCOPY) +#if (NGX_HAVE_WRITE_ZEROCOPY) if ((*busy)->buf->zerocopy_busy) { break; } diff --git a/src/core/ngx_config.h b/src/core/ngx_config.h index 43fd985a2..916b1b514 100644 --- a/src/core/ngx_config.h +++ b/src/core/ngx_config.h @@ -11,6 +11,13 @@ #include <ngx_auto_headers.h> +#if ((__GNU__ == 2) && (__GNUC_MINOR__ < 8)) +#define NGX_MAX_UINT32_VALUE 0xffffffffLL +#else +#define NGX_MAX_UINT32_VALUE 0xffffffff +#endif + + #if defined __DragonFly__ && !defined __FreeBSD__ #define __FreeBSD__ 4 #define __FreeBSD_version 480101 @@ -127,12 +134,5 @@ typedef long ngx_flag_t; #define NGX_MAXHOSTNAMELEN MAXHOSTNAMELEN */ -#if ((__GNU__ == 2) && (__GNUC_MINOR__ < 8)) -#define NGX_MAX_UINT32_VALUE 0xffffffffLL -#else -#define NGX_MAX_UINT32_VALUE 0xffffffff -#endif - - #endif /* _NGX_CONFIG_H_INCLUDED_ */ diff --git a/src/core/ngx_connection.h b/src/core/ngx_connection.h index e2257ac6c..40f19a8d8 100644 --- a/src/core/ngx_connection.h +++ b/src/core/ngx_connection.h @@ -48,7 +48,7 @@ typedef struct { unsigned nonblocking_accept:1; unsigned nonblocking:1; unsigned shared:1; /* shared between threads or processes */ -#if (HAVE_DEFERRED_ACCEPT) +#if (NGX_HAVE_DEFERRED_ACCEPT) unsigned deferred_accept:1; #endif @@ -101,7 +101,7 @@ struct ngx_connection_s { ngx_ssl_t *ssl; #endif -#if (HAVE_IOCP) +#if (NGX_HAVE_IOCP) struct sockaddr *local_sockaddr; socklen_t local_socklen; #endif @@ -122,7 +122,7 @@ struct ngx_connection_s { unsigned tcp_nodelay:1; signed tcp_nopush:2; -#if (HAVE_IOCP) +#if (NGX_HAVE_IOCP) unsigned accept_context_updated:1; #endif diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c index d2fbf12fb..1c367ccad 100644 --- a/src/core/ngx_output_chain.c +++ b/src/core/ngx_output_chain.c @@ -9,11 +9,18 @@ #include <ngx_event.h> -#define NGX_NONE 1 +#if 0 +#define NGX_SENDFILE_LIMIT 4096 +#endif + + +#define NGX_NONE 1 static ngx_inline ngx_int_t ngx_output_chain_need_to_copy(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf); +static ngx_int_t ngx_output_chain_add_copy(ngx_pool_t *pool, + ngx_chain_t **chain, ngx_chain_t *in); static ngx_int_t ngx_output_chain_copy_buf(ngx_buf_t *dst, ngx_buf_t *src, ngx_uint_t sendfile); @@ -26,17 +33,20 @@ ngx_int_t ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in) if (ctx->in == NULL && ctx->busy == NULL) { - /* - * the short path for the case when the ctx->in and ctx->busy chains - * are empty, the incoming chain is empty too or has the single buf - * that does not require the copy - */ + /* + * the short path for the case when the ctx->in and ctx->busy chains + * are empty, the incoming chain is empty too or has the single buf + * that does not require the copy + */ if (in == NULL) { return ctx->output_filter(ctx->filter_ctx, in); } if (in->next == NULL +#if (NGX_SENDFILE_LIMIT) + && !(in->buf->in_file && in->buf->file_last > NGX_SENDFILE_LIMIT) +#endif && (!ngx_output_chain_need_to_copy(ctx, in->buf))) { return ctx->output_filter(ctx->filter_ctx, in); @@ -46,7 +56,7 @@ ngx_int_t ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in) /* add the incoming buf to the chain ctx->in */ if (in) { - if (ngx_chain_add_copy(ctx->pool, &ctx->in, in) == NGX_ERROR) { + if (ngx_output_chain_add_copy(ctx->pool, &ctx->in, in) == NGX_ERROR) { return NGX_ERROR; } } @@ -191,11 +201,23 @@ ngx_int_t ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in) static ngx_inline ngx_int_t ngx_output_chain_need_to_copy(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf) { + ngx_uint_t sendfile; + if (ngx_buf_special(buf)) { return 0; } - if (!ctx->sendfile) { + sendfile = ctx->sendfile; + +#if (NGX_SENDFILE_LIMIT) + + if (buf->in_file && buf->file_pos >= NGX_SENDFILE_LIMIT) { + sendfile = 0; + } + +#endif + + if (!sendfile) { if (!ngx_buf_in_memory(buf)) { return 1; @@ -216,6 +238,71 @@ static ngx_inline ngx_int_t } +static ngx_int_t ngx_output_chain_add_copy(ngx_pool_t *pool, + ngx_chain_t **chain, ngx_chain_t *in) +{ + ngx_chain_t *cl, **ll; +#if (NGX_SENDFILE_LIMIT) + ngx_buf_t *b, *buf; +#endif + + ll = chain; + + for (cl = *chain; cl; cl = cl->next) { + ll = &cl->next; + } + + while (in) { + + if (!(cl = ngx_alloc_chain_link(pool))) { + return NGX_ERROR; + } + +#if (NGX_SENDFILE_LIMIT) + + buf = in->buf; + + if (buf->in_file + && buf->file_pos < NGX_SENDFILE_LIMIT + && buf->file_last > NGX_SENDFILE_LIMIT) + { + if (!(b = ngx_calloc_buf(pool))) { + return NGX_ERROR; + } + + ngx_memcpy(b, buf, sizeof(ngx_buf_t)); + + if (ngx_buf_in_memory(buf)) { + buf->pos += (ssize_t) (NGX_SENDFILE_LIMIT - buf->file_pos); + b->last = buf->pos; + } + + buf->file_pos = NGX_SENDFILE_LIMIT; + b->file_last = NGX_SENDFILE_LIMIT; + + cl->buf = b; + + } else { + cl->buf = buf; + in = in->next; + } + +#else + cl->buf = in->buf; + in = in->next; + +#endif + + *ll = cl; + ll = &cl->next; + } + + *ll = NULL; + + return NGX_OK; +} + + static ngx_int_t ngx_output_chain_copy_buf(ngx_buf_t *dst, ngx_buf_t *src, ngx_uint_t sendfile) { @@ -228,6 +315,14 @@ static ngx_int_t ngx_output_chain_copy_buf(ngx_buf_t *dst, ngx_buf_t *src, size = dst->end - dst->pos; } +#if (NGX_SENDFILE_LIMIT) + + if (src->in_file && src->file_pos >= NGX_SENDFILE_LIMIT) { + sendfile = 0; + } + +#endif + if (ngx_buf_in_memory(src)) { ngx_memcpy(dst->pos, src->pos, size); src->pos += size; diff --git a/src/core/ngx_times.c b/src/core/ngx_times.c index f06d64476..5ca235ccf 100644 --- a/src/core/ngx_times.c +++ b/src/core/ngx_times.c @@ -162,12 +162,12 @@ void ngx_time_update(time_t s) ngx_cached_http_time.data = p; -#if (HAVE_GETTIMEZONE) +#if (NGX_HAVE_GETTIMEZONE) ngx_gmtoff = ngx_gettimezone(); ngx_gmtime(s + ngx_gmtoff * 60, &tm); -#elif (HAVE_GMTOFF) +#elif (NGX_HAVE_GMTOFF) ngx_localtime(&tm); ngx_gmtoff = tm.ngx_tm_gmtoff / 60; |