upgraded ngx_lua to 0.3.1rc3, ngx_echo to 0.37rc4, and ngx_headers_more to 0.16rc2; released ngx_openresty 1.0.6.3.

pull/4/head v1.0.6.3
agentzh (章亦春) 13 years ago
parent 98d6ac88ae
commit b371fdf602

@ -0,0 +1,69 @@
# HG changeset patch
# User Maxim Dounin <mdounin@mdounin.ru>
# Date 1315324342 -14400
# Node ID 4cf0af103bc382a78f894302d1706929a79df4bb
# Parent d603ce98fada855f0100b422b7b5672fd22fabea
Gzip filter: handle empty flush buffers.
Empty flush buffers are legitimate and may happen e.g. due to $r->flush()
calls in embedded perl. If there are no data buffered in zlib deflate()
will return Z_BUF_ERROR (i.e. no progress possible) without adding anything
to output. Don't treat Z_BUF_ERROR as fatal and correctly send empty flush
buffer if we have no data in output at all.
See this thread for details:
http://mailman.nginx.org/pipermail/nginx/2010-November/023693.html
diff --git a/src/http/modules/ngx_http_gzip_filter_module.c b/src/http/modules/ngx_http_gzip_filter_module.c
--- a/src/http/modules/ngx_http_gzip_filter_module.c
+++ b/src/http/modules/ngx_http_gzip_filter_module.c
@@ -758,6 +758,7 @@ static ngx_int_t
ngx_http_gzip_filter_deflate(ngx_http_request_t *r, ngx_http_gzip_ctx_t *ctx)
{
int rc;
+ ngx_buf_t *b;
ngx_chain_t *cl;
ngx_http_gzip_conf_t *conf;
@@ -769,7 +770,7 @@ ngx_http_gzip_filter_deflate(ngx_http_re
rc = deflate(&ctx->zstream, ctx->flush);
- if (rc != Z_OK && rc != Z_STREAM_END) {
+ if (rc != Z_OK && rc != Z_STREAM_END && rc != Z_BUF_ERROR) {
ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
"deflate() failed: %d, %d", ctx->flush, rc);
return NGX_ERROR;
@@ -818,8 +819,6 @@ ngx_http_gzip_filter_deflate(ngx_http_re
if (ctx->flush == Z_SYNC_FLUSH) {
- ctx->zstream.avail_out = 0;
- ctx->out_buf->flush = 1;
ctx->flush = Z_NO_FLUSH;
cl = ngx_alloc_chain_link(r->pool);
@@ -827,7 +826,22 @@ ngx_http_gzip_filter_deflate(ngx_http_re
return NGX_ERROR;
}
- cl->buf = ctx->out_buf;
+ b = ctx->out_buf;
+
+ if (ngx_buf_size(b) == 0) {
+
+ b = ngx_calloc_buf(ctx->request->pool);
+ if (b == NULL) {
+ return NGX_ERROR;
+ }
+
+ } else {
+ ctx->zstream.avail_out = 0;
+ }
+
+ b->flush = 1;
+
+ cl->buf = b;
cl->next = NULL;
*ctx->last_out = cl;
ctx->last_out = &cl->next;

@ -1,18 +1,18 @@
diff -ur nginx-1.0.6/src/core/nginx.h nginx-1.0.6-no-pool/src/core/nginx.h
--- nginx-1.0.6/src/core/nginx.h 2011-05-26 15:31:40.000000000 +0800
+++ nginx-1.0.6-no-pool/src/core/nginx.h 2011-06-30 17:00:43.540946999 +0800
diff -ur nginx-1.0.6/src/core/nginx.h nginx-1.0.6-patched/src/core/nginx.h
--- nginx-1.0.6/src/core/nginx.h 2011-08-29 17:30:22.000000000 +0800
+++ nginx-1.0.6-patched/src/core/nginx.h 2011-09-13 12:11:03.135622101 +0800
@@ -10,7 +10,7 @@
#define nginx_version 1000004
#define nginx_version 1000006
#define NGINX_VERSION "1.0.6"
-#define NGINX_VER "ngx_openresty/" NGINX_VERSION ".unknown"
+#define NGINX_VER "ngx_openresty/" NGINX_VERSION ".unknown (no pool)"
#define NGINX_VAR "NGINX"
#define NGX_OLDPID_EXT ".oldbin"
diff -ur nginx-1.0.6/src/core/ngx_array.c nginx-1.0.6-no-pool/src/core/ngx_array.c
diff -ur nginx-1.0.6/src/core/ngx_array.c nginx-1.0.6-patched/src/core/ngx_array.c
--- nginx-1.0.6/src/core/ngx_array.c 2008-06-17 23:00:30.000000000 +0800
+++ nginx-1.0.6-no-pool/src/core/ngx_array.c 2011-06-30 17:00:43.540946999 +0800
+++ nginx-1.0.6-patched/src/core/ngx_array.c 2011-09-14 12:02:56.263128538 +0800
@@ -39,13 +39,7 @@
p = a->pool;
@ -68,7 +68,19 @@ diff -ur nginx-1.0.6/src/core/ngx_array.c nginx-1.0.6-no-pool/src/core/ngx_array
}
elt = (u_char *) a->elts + a->size * a->nelts;
@@ -112,31 +94,16 @@
@@ -100,43 +82,25 @@
ngx_array_push_n(ngx_array_t *a, ngx_uint_t n)
{
void *elt, *new;
- size_t size;
ngx_uint_t nalloc;
ngx_pool_t *p;
- size = n * a->size;
-
if (a->nelts + n > a->nalloc) {
/* the array is full */
p = a->pool;
@ -109,9 +121,9 @@ diff -ur nginx-1.0.6/src/core/ngx_array.c nginx-1.0.6-no-pool/src/core/ngx_array
}
elt = (u_char *) a->elts + a->size * a->nelts;
diff -ur nginx-1.0.6/src/core/ngx_palloc.c nginx-1.0.6-no-pool/src/core/ngx_palloc.c
diff -ur nginx-1.0.6/src/core/ngx_palloc.c nginx-1.0.6-patched/src/core/ngx_palloc.c
--- nginx-1.0.6/src/core/ngx_palloc.c 2009-12-17 20:25:46.000000000 +0800
+++ nginx-1.0.6-no-pool/src/core/ngx_palloc.c 2011-06-30 17:06:36.060946999 +0800
+++ nginx-1.0.6-patched/src/core/ngx_palloc.c 2011-09-14 12:03:41.663126519 +0800
@@ -8,24 +8,31 @@
#include <ngx_core.h>
@ -342,10 +354,8 @@ diff -ur nginx-1.0.6/src/core/ngx_palloc.c nginx-1.0.6-no-pool/src/core/ngx_pall
- m = ngx_memalign(NGX_POOL_ALIGNMENT, psize, pool->log);
- if (m == NULL) {
- return NULL;
+ if (size <= 1024) {
+ return ngx_malloc(pool, size);
}
- }
-
- new = (ngx_pool_t *) m;
-
- new->d.end = m + psize;
@ -362,8 +372,10 @@ diff -ur nginx-1.0.6/src/core/ngx_palloc.c nginx-1.0.6-no-pool/src/core/ngx_pall
- if (p->d.failed++ > 4) {
- current = p->d.next;
- }
- }
-
+ if (size <= 1024) {
+ return ngx_malloc(pool, size);
}
- p->d.next = new;
-
- pool->current = current ? current : new;
@ -373,10 +385,20 @@ diff -ur nginx-1.0.6/src/core/ngx_palloc.c nginx-1.0.6-no-pool/src/core/ngx_pall
}
@@ -226,18 +200,7 @@
@@ -216,7 +190,6 @@
ngx_palloc_large(ngx_pool_t *pool, size_t size)
{
void *p;
- ngx_uint_t n;
ngx_pool_large_t *large;
n = 0;
p = ngx_alloc(size, pool->log);
@@ -224,20 +197,7 @@
return NULL;
}
- n = 0;
-
- for (large = pool->large; large; large = large->next) {
- if (large->alloc == NULL) {
- large->alloc = p;
@ -393,7 +415,7 @@ diff -ur nginx-1.0.6/src/core/ngx_palloc.c nginx-1.0.6-no-pool/src/core/ngx_pall
if (large == NULL) {
ngx_free(p);
return NULL;
@@ -262,7 +225,7 @@
@@ -262,7 +222,7 @@
return NULL;
}
@ -402,7 +424,7 @@ diff -ur nginx-1.0.6/src/core/ngx_palloc.c nginx-1.0.6-no-pool/src/core/ngx_pall
if (large == NULL) {
ngx_free(p);
return NULL;
@@ -279,17 +242,41 @@
@@ -279,17 +239,41 @@
ngx_int_t
ngx_pfree(ngx_pool_t *pool, void *p)
{
@ -446,10 +468,9 @@ diff -ur nginx-1.0.6/src/core/ngx_palloc.c nginx-1.0.6-no-pool/src/core/ngx_pall
}
return NGX_DECLINED;
Only in nginx-1.0.6-no-pool/src/core: ngx_palloc.c~
diff -ur nginx-1.0.6/src/core/ngx_palloc.h nginx-1.0.6-no-pool/src/core/ngx_palloc.h
diff -ur nginx-1.0.6/src/core/ngx_palloc.h nginx-1.0.6-patched/src/core/ngx_palloc.h
--- nginx-1.0.6/src/core/ngx_palloc.h 2009-12-17 20:25:46.000000000 +0800
+++ nginx-1.0.6-no-pool/src/core/ngx_palloc.h 2011-06-30 17:00:43.540946999 +0800
+++ nginx-1.0.6-patched/src/core/ngx_palloc.h 2011-09-13 12:11:03.155622101 +0800
@@ -38,6 +38,7 @@

@ -44,6 +44,8 @@ patch -p1 < $root/patches/nginx-$main_ver-request_body_in_single_buf.patch || ex
patch -p1 -l < $root/patches/nginx-$main_ver-subrequest_loop.patch || exit 1
patch -p1 -l < $root/patches/nginx-$main_ver-gzip_empty_flush_buf.patch || exit 1
rm -f *.patch || exit 1
cd .. || exit 1
@ -53,7 +55,7 @@ sed -i $"s/NGINX_VERSION \".unknown/NGINX_VERSION \".$minor_ver/" \
./nginx-no_pool.patch || exit 1
rm -rf no-pool-nginx-$ver
ver=0.37rc2
ver=0.37rc4
$root/util/get-tarball "http://github.com/agentzh/echo-nginx-module/tarball/v$ver" -O echo-nginx-module-$ver.tar.gz || exit 1
tar -xzf echo-nginx-module-$ver.tar.gz || exit 1
mv agentzh-echo-nginx-module-* echo-nginx-module-$ver || exit 1
@ -83,7 +85,7 @@ $root/util/get-tarball "http://github.com/agentzh/rds-csv-nginx-module/tarball/v
tar -xzf rds-csv-nginx-module-$ver.tar.gz || exit 1
mv agentzh-rds-csv-nginx-module-* rds-csv-nginx-module-$ver || exit 1
ver=0.16rc1
ver=0.16rc2
$root/util/get-tarball "http://github.com/agentzh/headers-more-nginx-module/tarball/v$ver" -O headers-more-nginx-module-$ver.tar.gz || exit 1
tar -xzf headers-more-nginx-module-$ver.tar.gz || exit 1
mv agentzh-headers-more-nginx-module-* headers-more-nginx-module-$ver || exit 1
@ -97,7 +99,7 @@ mv chaoslawful-drizzle-nginx-module-* drizzle-nginx-module-$ver || exit 1
#################################
ver=0.3.1rc1
ver=0.3.1rc3
$root/util/get-tarball "http://github.com/chaoslawful/lua-nginx-module/tarball/v$ver" -O lua-nginx-module-$ver.tar.gz || exit 1
tar -xzf lua-nginx-module-$ver.tar.gz || exit 1
mv chaoslawful-lua-nginx-module-* ngx_lua-$ver || exit 1

@ -1,7 +1,7 @@
#!/bin/bash
main_ver=1.0.6
minor_ver=1
minor_ver=3
version=$main_ver.$minor_ver
echo $version

Loading…
Cancel
Save