Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 May 2013 14:31:01 +0000 (UTC)
From:      "Sergey A. Osokin" <osa@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r317122 - in head/www: nginx nginx-devel nginx/files
Message-ID:  <201305021431.r42EV1xt083861@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: osa
Date: Thu May  2 14:31:00 2013
New Revision: 317122
URL: http://svnweb.freebsd.org/changeset/ports/317122

Log:
  Update to latest stable version 1.4.0.
  Merge changes from www/nginx-devel to www/nginx.
  
  <ChangeLog>
  
  *) Bugfix: nginx could not be built with the ngx_http_perl_module if the
     --with-openssl option was used; the bug had appeared in 1.3.16.
  
  *) Bugfix: in a request body handling in the ngx_http_perl_module; the
     bug had appeared in 1.3.9.
  
  </ChangeLog>

Added:
  head/www/nginx/files/extra-patch-ngx_http_upload_module.c   (contents, props changed)
Modified:
  head/www/nginx-devel/Makefile
  head/www/nginx-devel/distinfo
  head/www/nginx/Makefile
  head/www/nginx/distinfo
  head/www/nginx/files/extra-patch-syslog_support

Modified: head/www/nginx-devel/Makefile
==============================================================================
--- head/www/nginx-devel/Makefile	Thu May  2 14:19:29 2013	(r317121)
+++ head/www/nginx-devel/Makefile	Thu May  2 14:31:00 2013	(r317122)
@@ -2,7 +2,7 @@
 # $FreeBSD$
 
 PORTNAME=	nginx
-PORTVERSION=	1.3.16
+PORTVERSION=	1.4.0
 CATEGORIES=	www
 MASTER_SITES=	http://nginx.org/download/
 MASTER_SITES+=	${MASTER_SITE_LOCAL}

Modified: head/www/nginx-devel/distinfo
==============================================================================
--- head/www/nginx-devel/distinfo	Thu May  2 14:19:29 2013	(r317121)
+++ head/www/nginx-devel/distinfo	Thu May  2 14:31:00 2013	(r317122)
@@ -1,5 +1,5 @@
-SHA256 (nginx-1.3.16.tar.gz) = 991ed83b497ba850bd98bc020b926147aa81e96549f4ffbcfd47ba9b4241ec4e
-SIZE (nginx-1.3.16.tar.gz) = 773279
+SHA256 (nginx-1.4.0.tar.gz) = 84aeb7a131fccff036dc80283dd98c989d2844eb84359cfe7c4863475de923a9
+SIZE (nginx-1.4.0.tar.gz) = 773451
 SHA256 (giom-nginx_accept_language_module-02262ce.tar.gz) = 3191f4caa70d9a8942c4f10b6abaaa96af451991d4b5e1e3d7b991376b00bf0c
 SIZE (giom-nginx_accept_language_module-02262ce.tar.gz) = 3398
 SHA256 (nginx-accesskey-2.0.3.tar.gz) = d9e94321e78a02de16c57f3e048fd31059fd8116ed03d6de7180f435c52502b1

Modified: head/www/nginx/Makefile
==============================================================================
--- head/www/nginx/Makefile	Thu May  2 14:19:29 2013	(r317121)
+++ head/www/nginx/Makefile	Thu May  2 14:31:00 2013	(r317122)
@@ -2,7 +2,7 @@
 # $FreeBSD$
 
 PORTNAME=	nginx
-PORTVERSION=	1.2.8
+PORTVERSION=	1.4.0
 PORTEPOCH=	1
 CATEGORIES=	www
 MASTER_SITES=	http://nginx.org/download/
@@ -29,6 +29,7 @@ OPTIONS_DEFINE=	\
 	HTTP_FLV \
 	HTTP_GEOIP \
 	HTTP_GZIP_STATIC \
+	HTTP_GUNZIP_FILTER \
 	HTTP_IMAGE_FILTER \
 	HTTP_PERL \
 	HTTP_RANDOM_INDEX \
@@ -44,6 +45,7 @@ OPTIONS_DEFINE=	\
 	MAIL_POP3 \
 	MAIL_SMTP \
 	MAIL_SSL \
+	SPDY \
 	WWW \
 	CACHE_PURGE \
 	CTPP2 \
@@ -58,7 +60,6 @@ OPTIONS_DEFINE=	\
 	HTTP_DAV_EXT \
 	HTTP_EVAL \
 	HTTP_FANCYINDEX \
-	HTTP_GUNZIP_FILTER \
 	HTTP_MOGILEFS \
 	HTTP_NOTICE \
 	HTTP_PUSH \
@@ -73,7 +74,6 @@ OPTIONS_DEFINE=	\
 	HTTP_UPSTREAM_STICKY \
 	HTTP_ZIP \
 	ARRAYVAR \
-	CHUNKIN \
 	DRIZZLE \
 	ENCRYPTSESSION \
 	FORMINPUT \
@@ -115,6 +115,7 @@ HTTP_DAV_DESC=			Enable http_webdav modu
 HTTP_FLV_DESC=			Enable http_flv module
 HTTP_GEOIP_DESC=		Enable http_geoip module
 HTTP_GZIP_STATIC_DESC=		Enable http_gzip_static module
+HTTP_GUNZIP_FILTER_DESC=	Enable http_gunzip_filter module
 HTTP_IMAGE_FILTER_DESC=		Enable http_image_filter module
 HTTP_MP4_DESC=			Enable http_mp4 module
 HTTP_PERL_DESC=			Enable http_perl module
@@ -131,6 +132,7 @@ MAIL_IMAP_DESC=			Enable IMAP4 proxy mod
 MAIL_POP3_DESC=			Enable POP3 proxy module
 MAIL_SMTP_DESC=			Enable SMTP proxy module
 MAIL_SSL_DESC=			Enable mail_ssl module
+SPDY_DESC=			Enable SPDY protocol support (SSL req.)
 WWW_DESC=			Enable html sample files
 CACHE_PURGE_DESC=		3rd party cache_purge module
 CTPP2_DESC=			3rd party CT++ module
@@ -145,7 +147,6 @@ HTTP_AUTH_REQ_DESC=		3rd party http_auth
 HTTP_DAV_EXT_DESC=		3rd party webdav_ext module
 HTTP_EVAL_DESC=			3rd party eval module
 HTTP_FANCYINDEX_DESC=		3rd party http_fancyindex module
-HTTP_GUNZIP_FILTER_DESC=	3rd party http_gunzip_filter module
 HTTP_MOGILEFS_DESC=		3rd party mogilefs module
 HTTP_MP4_H264_DESC=		3rd party mp4/h264 module
 HTTP_NOTICE_DESC=		3rd party notice module
@@ -161,7 +162,6 @@ HTTP_UPSTREAM_HASH_DESC=	3rd party upstr
 HTTP_UPSTREAM_STICKY_DESC=	3rd party upstream sticky module
 HTTP_ZIP_DESC=			3rd party http_zip module
 ARRAYVAR_DESC=			3rd party array_var module
-CHUNKIN_DESC=			3rd party chunkin module
 DRIZZLE_DESC=			3rd party drizzlie module
 ENCRYPTSESSION_DESC=		3rd party encrypted_session module
 FORMINPUT_DESC=			3rd party form_input module
@@ -385,13 +385,6 @@ DISTFILES+=	ngx-fancyindex-${NGINX_FANCY
 CONFIGURE_ARGS+=--add-module=${WRKDIR}/ngx-fancyindex-${NGINX_FANCYINDEX_VERSION}
 .endif
 
-.if ${PORT_OPTIONS:MHTTP_GUNZIP_FILTER}
-NGINX_GUNZIP_FILTER_VERSION=	0.4
-MASTER_SITES+=	http://mdounin.ru/files/:gunzipfilter
-DISTFILES+=	ngx_http_gunzip_filter_module-${NGINX_GUNZIP_FILTER_VERSION}.tar.gz:gunzipfilter
-CONFIGURE_ARGS+=--add-module=${WRKDIR}/ngx_http_gunzip_filter_module-${NGINX_GUNZIP_FILTER_VERSION}
-.endif
-
 .if ${PORT_OPTIONS:MHTTP_FLV}
 CONFIGURE_ARGS+=--with-http_flv_module
 .endif
@@ -405,6 +398,10 @@ LIB_DEPENDS+=	GeoIP:${PORTSDIR}/net/GeoI
 CONFIGURE_ARGS+=--with-http_gzip_static_module
 .endif
 
+.if ${PORT_OPTIONS:MHTTP_GUNZIP_FILTER}
+CONFIGURE_ARGS+=--with-http_gunzip_module
+.endif
+
 .if ${PORT_OPTIONS:MHTTP_IMAGE_FILTER}
 LIB_DEPENDS+=	gd:${PORTSDIR}/graphics/gd
 CONFIGURE_ARGS+=--with-http_image_filter_module
@@ -484,7 +481,6 @@ CONFIGURE_ARGS+=--add-module=${WRKDIR}/n
 .endif
 
 .if ${PORT_OPTIONS:MHTTP_SUBS_FILTER}
-USE_HTTP_REWRITE=	yes
 NGINX_HTTP_SUBS_FILTER_VERSION=	0.6.2
 GIT_HTTP_SUBS_FILTER_VERSION=	0-g27a01b3
 FETCH_ARGS=	-pRr
@@ -510,6 +506,7 @@ NGINX_UPLOAD_VERSION=	2.2.0
 MASTER_SITES+=	http://www.grid.net.ru/nginx/download/:upload
 DISTFILES+=	nginx_upload_module-${NGINX_UPLOAD_VERSION}.tar.gz:upload
 CONFIGURE_ARGS+=--add-module=${WRKDIR}/nginx_upload_module-${NGINX_UPLOAD_VERSION}
+EXTRA_PATCHES+=	${PATCHDIR}/extra-patch-ngx_http_upload_module.c
 .endif
 
 .if ${PORT_OPTIONS:MHTTP_UPLOAD_PROGRESS}
@@ -557,17 +554,8 @@ DISTFILES+=	mod_zip-${NGINX_ZIP_VERSION}
 CONFIGURE_ARGS+=--add-module=${WRKDIR}/mod_zip-${NGINX_ZIP_VERSION}
 .endif
 
-.if ${PORT_OPTIONS:MCHUNKIN}
-NGINX_CHUNKIN_VERSION=	0.23
-GIT_CHUNKIN_VERSION=	0-g81c04f6
-FETCH_ARGS=	-pRr
-MASTER_SITES+=	https://github.com/agentzh/chunkin-nginx-module/tarball/v${NGINX_CHUNKIN_VERSION}/:chunkin
-DISTFILES+=	agentzh-chunkin-nginx-module-v${NGINX_CHUNKIN_VERSION}-${GIT_CHUNKIN_VERSION}.tar.gz:chunkin
-CONFIGURE_ARGS+=--add-module=${WRKDIR}/agentzh-chunkin-nginx-module-${GIT_CHUNKIN_VERSION:S/^0-g//}
-.endif
-
 .if ${PORT_OPTIONS:MDRIZZLE}
-LIB_DEPENDS+=	drizzle:${PORTSDIR}/databases/drizzle
+LIB_DEPENDS+=	drizzle:${PORTSDIR}/databases/libdrizzle
 NGINX_DRIZZLE_VERSION=	0.1.4
 GIT_DRIZZLE_VERSION=	0-g59e12ad
 FETCH_ARGS=	-pRr
@@ -793,6 +781,12 @@ DISTFILES+=	agentzh-xss-nginx-module-v${
 CONFIGURE_ARGS+=--add-module=${WRKDIR}/agentzh-xss-nginx-module-${GIT_XSS_VERSION:S/^0-g//}
 .endif
 
+.if ${PORT_OPTIONS:MSPDY}
+USE_OPENSSL_PORT=	yes
+USE_HTTP_SSL=	yes
+CONFIGURE_ARGS+=--with-http_spdy_module
+.endif
+
 .if ${PORT_OPTIONS:MWWW}
 PLIST_SUB+=	WWWDATA=""
 .else
@@ -930,6 +924,16 @@ post-patch:
 		's!%%PREFIX%%!${LOCALBASE}!g' \
 		${WRKDIR}/nginx-sflow-module-${NGINX_SFLOW_VERSION}/ngx_http_sflow_config.h
 .endif
+.if ${PORT_OPTIONS:MSPDY}
+.if ${PORT_OPTIONS:MDRIZZLE}
+	@${REINPLACE_CMD} '584d' \
+		${WRKDIR}/chaoslawful-drizzle-nginx-module-${GIT_DRIZZLE_VERSION:S/^0-g//}/src/ngx_http_drizzle_util.c
+.endif
+.if ${PORT_OPTIONS:MLUA}
+	@${REINPLACE_CMD} '437d' \
+		${WRKDIR}/chaoslawful-lua-nginx-module-${GIT_LUA_VERSION:S/^0-g//}/src/ngx_http_lua_socket_tcp.c
+.endif
+.endif
 .if ${PORT_OPTIONS:MSUPERVISORD}
 	( cd ${WRKDIR}/nginx_upstream_fair-${NGINX_UPSTREAM_FAIR_VERSION} && \
 		${PATCH} -p0 < \

Modified: head/www/nginx/distinfo
==============================================================================
--- head/www/nginx/distinfo	Thu May  2 14:19:29 2013	(r317121)
+++ head/www/nginx/distinfo	Thu May  2 14:31:00 2013	(r317122)
@@ -1,5 +1,5 @@
-SHA256 (nginx-1.2.8.tar.gz) = d2947c98c5bed311b1e6c04e35a730af92e40e2e6bfe9201fa7f404987457137
-SIZE (nginx-1.2.8.tar.gz) = 730589
+SHA256 (nginx-1.4.0.tar.gz) = 84aeb7a131fccff036dc80283dd98c989d2844eb84359cfe7c4863475de923a9
+SIZE (nginx-1.4.0.tar.gz) = 773451
 SHA256 (giom-nginx_accept_language_module-02262ce.tar.gz) = 3191f4caa70d9a8942c4f10b6abaaa96af451991d4b5e1e3d7b991376b00bf0c
 SIZE (giom-nginx_accept_language_module-02262ce.tar.gz) = 3398
 SHA256 (nginx-accesskey-2.0.3.tar.gz) = d9e94321e78a02de16c57f3e048fd31059fd8116ed03d6de7180f435c52502b1
@@ -26,8 +26,6 @@ SHA256 (vkholodkov-nginx-eval-module-1.0
 SIZE (vkholodkov-nginx-eval-module-1.0.3-0-g125fa2e.tar.gz) = 5727
 SHA256 (ngx-fancyindex-0.3.1.tar.gz) = 877e383c6bc06be92abb88f5ac251a165b63feb5f4828d52a554efc19a3f7c7d
 SIZE (ngx-fancyindex-0.3.1.tar.gz) = 13071
-SHA256 (ngx_http_gunzip_filter_module-0.4.tar.gz) = d2bcef58612d1f66f92c7160fc05695b540ffdee45936b1e86a0d4981e09114a
-SIZE (ngx_http_gunzip_filter_module-0.4.tar.gz) = 7432
 SHA256 (nginx_mogilefs_module-1.0.4.tar.gz) = 7ac230d30907f013dff8d435a118619ea6168aa3714dba62c6962d350c6295ae
 SIZE (nginx_mogilefs_module-1.0.4.tar.gz) = 11208
 SHA256 (nginx_mod_h264_streaming-2.2.7.tar.gz) = 6d974ba630cef59de1f60996c66b401264a345d25988a76037c2856cec756c19
@@ -56,8 +54,6 @@ SHA256 (nginx-sticky-module-1.0.tar.gz) 
 SIZE (nginx-sticky-module-1.0.tar.gz) = 114184
 SHA256 (mod_zip-1.1.6.tar.gz) = d30546b4be8308c721df0240ebc38c474c6b577381a110321eded6dbed5104b1
 SIZE (mod_zip-1.1.6.tar.gz) = 21991
-SHA256 (agentzh-chunkin-nginx-module-v0.23-0-g81c04f6.tar.gz) = c703994a46cff5e79892fc8370f375fa4fe7f8f39132779605b0ceea0d1031fa
-SIZE (agentzh-chunkin-nginx-module-v0.23-0-g81c04f6.tar.gz) = 39052
 SHA256 (chaoslawful-drizzle-nginx-module-v0.1.4-0-g59e12ad.tar.gz) = c9b476acce35bdf904b2276cf6a365f68d66994824d5df874615629a46809d1a
 SIZE (chaoslawful-drizzle-nginx-module-v0.1.4-0-g59e12ad.tar.gz) = 61064
 SHA256 (simpl-ngx_devel_kit-v0.2.18-0-g48bc5dd.tar.gz) = bfd737ee5608c1ec2e59409c47cb29e390aeb882b8c0bf00d7322e74585cebae

Added: head/www/nginx/files/extra-patch-ngx_http_upload_module.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/nginx/files/extra-patch-ngx_http_upload_module.c	Thu May  2 14:31:00 2013	(r317122)
@@ -0,0 +1,604 @@
+--- ../nginx_upload_module-2.2.0/ngx_http_upload_module.c.orig	2010-09-27 20:54:15.000000000 +0200
++++ ../nginx_upload_module-2.2.0/ngx_http_upload_module.c	2013-02-21 22:32:08.000000000 +0100
+@@ -233,6 +233,17 @@
+     unsigned int        raw_input:1;
+ } ngx_http_upload_ctx_t;
+ 
++static void ngx_http_read_client_request_body_handler(ngx_http_request_t *r);
++static ngx_int_t ngx_http_do_read_client_request_body(ngx_http_request_t *r);
++
++static ngx_int_t ngx_http_write_request_body(ngx_http_request_t *r);
++static ngx_int_t ngx_http_request_body_filter(ngx_http_request_t *r, ngx_chain_t *in);
++
++static ngx_int_t ngx_http_request_body_length_filter(ngx_http_request_t *r, ngx_chain_t *in);
++static ngx_int_t ngx_http_request_body_chunked_filter(ngx_http_request_t *r, ngx_chain_t *in);
++
++static ngx_int_t ngx_http_request_body_save_filter(ngx_http_request_t *r, ngx_chain_t *in);
++
+ static ngx_int_t ngx_http_upload_handler(ngx_http_request_t *r);
+ static ngx_int_t ngx_http_upload_body_handler(ngx_http_request_t *r);
+ 
+@@ -2523,6 +2534,534 @@
+     return NGX_CONF_OK;
+ } /* }}} */
+ 
++static ngx_int_t
++ngx_http_write_request_body(ngx_http_request_t *r)
++{
++    ssize_t                    n;
++    ngx_chain_t               *cl;
++    ngx_temp_file_t           *tf;
++    ngx_http_request_body_t   *rb;
++    ngx_http_core_loc_conf_t  *clcf;
++
++    rb = r->request_body;
++
++    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
++                   "http write client request body, bufs %p", rb->bufs);
++
++    if (rb->temp_file == NULL) {
++        tf = ngx_pcalloc(r->pool, sizeof(ngx_temp_file_t));
++        if (tf == NULL) {
++            return NGX_ERROR;
++        }
++
++        clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
++
++        tf->file.fd = NGX_INVALID_FILE;
++        tf->file.log = r->connection->log;
++        tf->path = clcf->client_body_temp_path;
++        tf->pool = r->pool;
++        tf->warn = "a client request body is buffered to a temporary file";
++        tf->log_level = r->request_body_file_log_level;
++        tf->persistent = r->request_body_in_persistent_file;
++        tf->clean = r->request_body_in_clean_file;
++
++        if (r->request_body_file_group_access) {
++            tf->access = 0660;
++        }
++
++        rb->temp_file = tf;
++
++        if (rb->bufs == NULL) {
++            /* empty body with r->request_body_in_file_only */
++
++            if (ngx_create_temp_file(&tf->file, tf->path, tf->pool,
++                                     tf->persistent, tf->clean, tf->access)
++                != NGX_OK)
++            {
++                return NGX_ERROR;
++            }
++
++            return NGX_OK;
++        }
++    }
++
++    if (rb->bufs == NULL) {
++        return NGX_OK;
++    }
++
++    n = ngx_write_chain_to_temp_file(rb->temp_file, rb->bufs);
++
++    /* TODO: n == 0 or not complete and level event */
++
++    if (n == NGX_ERROR) {
++        return NGX_ERROR;
++    }
++
++    rb->temp_file->offset += n;
++
++    /* mark all buffers as written */
++
++    for (cl = rb->bufs; cl; cl = cl->next) {
++        cl->buf->pos = cl->buf->last;
++    }
++
++    rb->bufs = NULL;
++
++    return NGX_OK;
++}
++
++static ngx_int_t
++ngx_http_request_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
++{
++    if (r->headers_in.chunked) {
++        return ngx_http_request_body_chunked_filter(r, in);
++
++    } else {
++        return ngx_http_request_body_length_filter(r, in);
++    }
++}
++
++static ngx_int_t
++ngx_http_request_body_save_filter(ngx_http_request_t *r, ngx_chain_t *in)
++{
++#if (NGX_DEBUG)
++    ngx_chain_t               *cl;
++#endif
++    ngx_http_request_body_t   *rb;
++
++    rb = r->request_body;
++
++#if (NGX_DEBUG)
++
++    for (cl = rb->bufs; cl; cl = cl->next) {
++        ngx_log_debug7(NGX_LOG_DEBUG_EVENT, r->connection->log, 0,
++                       "http body old buf t:%d f:%d %p, pos %p, size: %z "
++                       "file: %O, size: %z",
++                       cl->buf->temporary, cl->buf->in_file,
++                       cl->buf->start, cl->buf->pos,
++                       cl->buf->last - cl->buf->pos,
++                       cl->buf->file_pos,
++                       cl->buf->file_last - cl->buf->file_pos);
++    }
++
++    for (cl = in; cl; cl = cl->next) {
++        ngx_log_debug7(NGX_LOG_DEBUG_EVENT, r->connection->log, 0,
++                       "http body new buf t:%d f:%d %p, pos %p, size: %z "
++                       "file: %O, size: %z",
++                       cl->buf->temporary, cl->buf->in_file,
++                       cl->buf->start, cl->buf->pos,
++                       cl->buf->last - cl->buf->pos,
++                       cl->buf->file_pos,
++                       cl->buf->file_last - cl->buf->file_pos);
++    }
++
++#endif
++
++    /* TODO: coalesce neighbouring buffers */
++
++    if (ngx_chain_add_copy(r->pool, &rb->bufs, in) != NGX_OK) {
++        return NGX_HTTP_INTERNAL_SERVER_ERROR;
++    }
++
++    return NGX_OK;
++}
++
++
++static ngx_int_t
++ngx_http_request_body_length_filter(ngx_http_request_t *r, ngx_chain_t *in)
++{
++    size_t                     size;
++    ngx_int_t                  rc;
++    ngx_buf_t                 *b;
++    ngx_chain_t               *cl, *tl, *out, **ll;
++    ngx_http_request_body_t   *rb;
++
++    rb = r->request_body;
++
++    if (rb->rest == -1) {
++        ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
++                       "http request body content length filter");
++
++        rb->rest = r->headers_in.content_length_n;
++    }
++
++    out = NULL;
++    ll = &out;
++
++    for (cl = in; cl; cl = cl->next) {
++
++        tl = ngx_chain_get_free_buf(r->pool, &rb->free);
++        if (tl == NULL) {
++            return NGX_HTTP_INTERNAL_SERVER_ERROR;
++        }
++
++        b = tl->buf;
++
++        ngx_memzero(b, sizeof(ngx_buf_t));
++
++        b->temporary = 1;
++        b->tag = (ngx_buf_tag_t) &ngx_http_read_client_request_body;
++        b->start = cl->buf->start;
++        b->pos = cl->buf->pos;
++        b->last = cl->buf->last;
++        b->end = cl->buf->end;
++
++        size = cl->buf->last - cl->buf->pos;
++
++        if ((off_t) size < rb->rest) {
++            cl->buf->pos = cl->buf->last;
++            rb->rest -= size;
++
++        } else {
++            cl->buf->pos += rb->rest;
++            rb->rest = 0;
++            b->last = cl->buf->pos;
++            b->last_buf = 1;
++        }
++
++        *ll = tl;
++        ll = &tl->next;
++    }
++
++    rc = ngx_http_request_body_save_filter(r, out);
++
++    ngx_chain_update_chains(r->pool, &rb->free, &rb->busy, &out,
++                            (ngx_buf_tag_t) &ngx_http_read_client_request_body);
++
++    return rc;
++}
++
++static ngx_int_t
++ngx_http_request_body_chunked_filter(ngx_http_request_t *r, ngx_chain_t *in)
++{
++    size_t                     size;
++    ngx_int_t                  rc;
++    ngx_buf_t                 *b;
++    ngx_chain_t               *cl, *out, *tl, **ll;
++    ngx_http_request_body_t   *rb;
++    ngx_http_core_loc_conf_t  *clcf;
++
++    rb = r->request_body;
++
++    if (rb->rest == -1) {
++
++        ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
++                       "http request body chunked filter");
++
++        rb->chunked = ngx_pcalloc(r->pool, sizeof(ngx_http_chunked_t));
++        if (rb->chunked == NULL) {
++            return NGX_HTTP_INTERNAL_SERVER_ERROR;
++        }
++
++        r->headers_in.content_length_n = 0;
++        rb->rest = 3;
++    }
++
++    out = NULL;
++    ll = &out;
++
++    for (cl = in; cl; cl = cl->next) {
++
++        for ( ;; ) {
++
++            ngx_log_debug7(NGX_LOG_DEBUG_EVENT, r->connection->log, 0,
++                           "http body chunked buf "
++                           "t:%d f:%d %p, pos %p, size: %z file: %O, size: %z",
++                           cl->buf->temporary, cl->buf->in_file,
++                           cl->buf->start, cl->buf->pos,
++                           cl->buf->last - cl->buf->pos,
++                           cl->buf->file_pos,
++                           cl->buf->file_last - cl->buf->file_pos);
++
++            rc = ngx_http_parse_chunked(r, cl->buf, rb->chunked);
++
++            if (rc == NGX_OK) {
++
++                /* a chunk has been parsed successfully */
++
++                clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
++
++                if (clcf->client_max_body_size
++                    && clcf->client_max_body_size
++                       < r->headers_in.content_length_n + rb->chunked->size)
++                {
++                    ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
++                                  "client intended to send too large chunked "
++                                  "body: %O bytes",
++                                  r->headers_in.content_length_n
++                                  + rb->chunked->size);
++
++                    r->lingering_close = 1;
++
++                    return NGX_HTTP_REQUEST_ENTITY_TOO_LARGE;
++                }
++
++                tl = ngx_chain_get_free_buf(r->pool, &rb->free);
++                if (tl == NULL) {
++                    return NGX_HTTP_INTERNAL_SERVER_ERROR;
++                }
++
++                b = tl->buf;
++
++                ngx_memzero(b, sizeof(ngx_buf_t));
++
++                b->temporary = 1;
++                b->tag = (ngx_buf_tag_t) &ngx_http_read_client_request_body;
++                b->start = cl->buf->start;
++                b->pos = cl->buf->pos;
++                b->last = cl->buf->last;
++                b->end = cl->buf->end;
++
++                *ll = tl;
++                ll = &tl->next;
++
++                size = cl->buf->last - cl->buf->pos;
++
++                if ((off_t) size > rb->chunked->size) {
++                   cl->buf->pos += rb->chunked->size;
++                    r->headers_in.content_length_n += rb->chunked->size;
++                    rb->chunked->size = 0;
++
++                } else {
++                    rb->chunked->size -= size;
++                    r->headers_in.content_length_n += size;
++                    cl->buf->pos = cl->buf->last;
++                }
++
++                b->last = cl->buf->pos;
++
++                continue;
++            }
++
++            if (rc == NGX_DONE) {
++
++                /* a whole response has been parsed successfully */
++
++                rb->rest = 0;
++
++                tl = ngx_chain_get_free_buf(r->pool, &rb->free);
++                if (tl == NULL) {
++                    return NGX_HTTP_INTERNAL_SERVER_ERROR;
++                }
++
++                b = tl->buf;
++
++                ngx_memzero(b, sizeof(ngx_buf_t));
++
++                b->last_buf = 1;
++
++                *ll = tl;
++                ll = &tl->next;
++
++                break;
++            }
++
++            if (rc == NGX_AGAIN) {
++
++                /* set rb->rest, amount of data we want to see next time */
++
++                rb->rest = rb->chunked->length;
++
++                break;
++            }
++
++            /* invalid */
++
++            ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
++                          "client sent invalid chunked body");
++
++            return NGX_HTTP_BAD_REQUEST;
++        }
++    }
++
++    rc = ngx_http_request_body_save_filter(r, out);
++
++    ngx_chain_update_chains(r->pool, &rb->free, &rb->busy, &out,
++                            (ngx_buf_tag_t) &ngx_http_read_client_request_body);
++
++    return rc;
++}
++
++static ngx_int_t
++ngx_http_do_read_client_request_body(ngx_http_request_t *r)
++{
++    off_t                      rest;
++    size_t                     size;
++    ssize_t                    n;
++    ngx_int_t                  rc;
++    ngx_buf_t                 *b;
++    ngx_chain_t               *cl, out;
++    ngx_connection_t          *c;
++    ngx_http_request_body_t   *rb;
++    ngx_http_core_loc_conf_t  *clcf;
++
++    c = r->connection;
++    rb = r->request_body;
++
++    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
++                   "http read client request body");
++
++    for ( ;; ) {
++        for ( ;; ) {
++            if (rb->buf->last == rb->buf->end) {
++
++                /* pass buffer to request body filter chain */
++
++                out.buf = rb->buf;
++                out.next = NULL;
++
++                rc = ngx_http_request_body_filter(r, &out);
++
++                if (rc != NGX_OK) {
++                    return rc;
++                }
++
++                /* write to file */
++
++                if (ngx_http_write_request_body(r) != NGX_OK) {
++                    return NGX_HTTP_INTERNAL_SERVER_ERROR;
++                }
++
++                /* update chains */
++
++                rc = ngx_http_request_body_filter(r, NULL);
++
++                if (rc != NGX_OK) {
++                    return rc;
++                }
++
++                if (rb->busy != NULL) {
++                    return NGX_HTTP_INTERNAL_SERVER_ERROR;
++                }
++
++                rb->buf->pos = rb->buf->start;
++                rb->buf->last = rb->buf->start;
++            }
++            size = rb->buf->end - rb->buf->last;
++            rest = rb->rest - (rb->buf->last - rb->buf->pos);
++
++            if ((off_t) size > rest) {
++                size = (size_t) rest;
++            }
++
++            n = c->recv(c, rb->buf->last, size);
++
++            ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
++                           "http client request body recv %z", n);
++
++            if (n == NGX_AGAIN) {
++                break;
++            }
++
++            if (n == 0) {
++                ngx_log_error(NGX_LOG_INFO, c->log, 0,
++                              "client prematurely closed connection");
++            }
++
++            if (n == 0 || n == NGX_ERROR) {
++                c->error = 1;
++                return NGX_HTTP_BAD_REQUEST;
++            }
++
++            rb->buf->last += n;
++            r->request_length += n;
++
++            if (n == rest) {
++                /* pass buffer to request body filter chain */
++
++                out.buf = rb->buf;
++                out.next = NULL;
++
++                rc = ngx_http_request_body_filter(r, &out);
++
++                if (rc != NGX_OK) {
++                    return rc;
++                }
++            }
++
++            if (rb->rest == 0) {
++                break;
++            }
++
++            if (rb->buf->last < rb->buf->end) {
++                break;
++            }
++        }
++
++        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
++                       "http client request body rest %O", rb->rest);
++                      if (rb->rest == 0) {
++            break;
++        }
++
++        if (!c->read->ready) {
++            clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
++            ngx_add_timer(c->read, clcf->client_body_timeout);
++
++            if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
++                return NGX_HTTP_INTERNAL_SERVER_ERROR;
++            }
++
++            return NGX_AGAIN;
++        }
++    }
++
++    if (c->read->timer_set) {
++        ngx_del_timer(c->read);
++    }
++
++    if (rb->temp_file || r->request_body_in_file_only) {
++
++        /* save the last part */
++
++        if (ngx_http_write_request_body(r) != NGX_OK) {
++            return NGX_HTTP_INTERNAL_SERVER_ERROR;
++        }
++
++        cl = ngx_chain_get_free_buf(r->pool, &rb->free);
++        if (cl == NULL) {
++            return NGX_HTTP_INTERNAL_SERVER_ERROR;
++        }
++
++        b = cl->buf;
++
++        ngx_memzero(b, sizeof(ngx_buf_t));
++
++        b->in_file = 1;
++        b->file_last = rb->temp_file->file.offset;
++        b->file = &rb->temp_file->file;
++
++        rb->bufs = cl;
++    }
++
++    r->read_event_handler = ngx_http_block_reading;
++
++    rb->post_handler(r);
++
++    return NGX_OK;
++}
++
++
++static void
++ngx_http_read_client_request_body_handler(ngx_http_request_t *r)
++{
++    ngx_int_t  rc;
++
++    if (r->connection->read->timedout) {
++        r->connection->timedout = 1;
++        ngx_http_finalize_request(r, NGX_HTTP_REQUEST_TIME_OUT);
++        return;
++    }
++
++    rc = ngx_http_do_read_client_request_body(r);
++
++    if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
++        ngx_http_finalize_request(r, rc);
++    }
++}
++
++
++
+ ngx_int_t /* {{{ ngx_http_read_upload_client_request_body */
+ ngx_http_read_upload_client_request_body(ngx_http_request_t *r) {
+     ssize_t                    size, preread;
+@@ -2625,9 +3164,9 @@
+ 
+             /* the whole request body may be placed in r->header_in */
+ 
+-            rb->to_write = rb->bufs;
+-
+-            r->read_event_handler = ngx_http_read_upload_client_request_body_handler;
++            rb->buf = r->header_in;
++            r->read_event_handler = ngx_http_read_client_request_body_handler;
++            r->write_event_handler = ngx_http_request_empty_handler;
+ 
+             return ngx_http_do_read_upload_client_request_body(r);
+         }
+@@ -2684,7 +3223,7 @@
+ 
+     *next = cl;
+ 
+-    rb->to_write = rb->bufs;
++    /* rb->to_write = rb->bufs; */
+ 
+     r->read_event_handler = ngx_http_read_upload_client_request_body_handler;
+ 
+@@ -2766,7 +3305,7 @@
+         for ( ;; ) {
+             if (rb->buf->last == rb->buf->end) {
+ 
+-                rc = ngx_http_process_request_body(r, rb->to_write);
++                rc = ngx_http_process_request_body(r, rb->bufs);
+ 
+                 switch(rc) {
+                     case NGX_OK:
+@@ -2782,7 +3321,7 @@
+                         return NGX_HTTP_INTERNAL_SERVER_ERROR;
+                 }
+ 
+-                rb->to_write = rb->bufs->next ? rb->bufs->next : rb->bufs;
++                /* rb->to_write = rb->bufs->next ? rb->bufs->next : rb->bufs; */
+                 rb->buf->last = rb->buf->start;
+             }
+ 
+@@ -2874,7 +3413,7 @@
+         ngx_del_timer(c->read);
+     }
+ 
+-    rc = ngx_http_process_request_body(r, rb->to_write);
++    rc = ngx_http_process_request_body(r, rb->bufs);
+ 
+     switch(rc) {
+         case NGX_OK:

Modified: head/www/nginx/files/extra-patch-syslog_support
==============================================================================
--- head/www/nginx/files/extra-patch-syslog_support	Thu May  2 14:19:29 2013	(r317121)
+++ head/www/nginx/files/extra-patch-syslog_support	Thu May  2 14:31:00 2013	(r317122)
@@ -578,20 +578,20 @@ index aa6a3fc..deceb38 100644
      if (cf->args->nelts >= 3) {
          name = value[2];
 diff --git src/http/ngx_http_core_module.c src/http/ngx_http_core_module.c
-index 61439a1..8e1a296 100644
+index c491499..4f039eb 100644
 --- src/http/ngx_http_core_module.c
 +++ src/http/ngx_http_core_module.c
-@@ -1451,6 +1451,9 @@ ngx_http_update_location_config(ngx_http_request_t *r)
+@@ -1462,6 +1462,9 @@ ngx_http_update_location_config(ngx_http_request_t *r)
  
      if (r == r->main) {
-         r->connection->log->file = clcf->error_log->file;
+         ngx_http_set_connection_log(r->connection, clcf->error_log);
 +#if (NGX_ENABLE_SYSLOG)
 +        r->connection->log->priority = clcf->error_log->priority;
 +#endif
+     }
  
-         if (!(r->connection->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {
-             r->connection->log->log_level = clcf->error_log->log_level;
-@@ -4764,6 +4767,15 @@ ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
+     if ((ngx_io.flags & NGX_IO_SENDFILE) && clcf->sendfile) {
+@@ -4867,6 +4870,15 @@ ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
  
      ngx_str_t  *value, name;
  
@@ -607,7 +607,7 @@ index 61439a1..8e1a296 100644
      if (clcf->error_log) {
          return "is duplicate";
      }
-@@ -4773,6 +4785,36 @@ ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
+@@ -4876,6 +4888,36 @@ ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
      if (ngx_strcmp(value[1].data, "stderr") == 0) {
          ngx_str_null(&name);
  
@@ -644,7 +644,7 @@ index 61439a1..8e1a296 100644
      } else {
          name = value[1];
      }
-@@ -4782,6 +4824,17 @@ ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
+@@ -4885,6 +4927,17 @@ ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
          return NGX_CONF_ERROR;
      }
  
@@ -663,30 +663,39 @@ index 61439a1..8e1a296 100644
          clcf->error_log->log_level = NGX_LOG_ERR;
          return NGX_CONF_OK;
 diff --git src/http/ngx_http_request.c src/http/ngx_http_request.c
-index ee00fd3..e15e157 100644
+index 54e1c26..2b05157 100644
 --- src/http/ngx_http_request.c
 +++ src/http/ngx_http_request.c
-@@ -433,6 +433,9 @@ ngx_http_init_request(ngx_event_t *rev)
- 
+@@ -424,6 +424,9 @@ ngx_http_init_request(ngx_event_t *rev)
      clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
-     c->log->file = clcf->error_log->file;
+ 
+     ngx_http_set_connection_log(r->connection, clcf->error_log);
++#if (NGX_ENABLE_SYSLOG)
++    c->log->priority = clcf->error_log->priority;
++#endif
+ 
+     if (c->buffer == NULL) {
+         c->buffer = ngx_create_temp_buf(c->pool,
+@@ -694,6 +697,9 @@ ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg)
+     clcf = ngx_http_get_module_loc_conf(hc->conf_ctx, ngx_http_core_module);
+ 
+     ngx_http_set_connection_log(c, clcf->error_log);
 +#if (NGX_ENABLE_SYSLOG)
 +    c->log->priority = clcf->error_log->priority;
 +#endif
-     if (!(c->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {
-         c->log->log_level = clcf->error_log->log_level;
-     }
-@@ -1834,6 +1837,9 @@ found:
  
+     sscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_ssl_module);
+ 
+@@ -1891,6 +1897,9 @@ ngx_http_set_virtual_server(ngx_http_request_t *r, ngx_str_t *host)
      clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
-     r->connection->log->file = clcf->error_log->file;
+ 
+     ngx_http_set_connection_log(r->connection, clcf->error_log);
 +#if (NGX_ENABLE_SYSLOG)
 +    r->connection->log->priority = clcf->error_log->priority;
 +#endif
  
-     if (!(r->connection->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {
-         r->connection->log->log_level = clcf->error_log->log_level;
-
+     return NGX_OK;
+ }
 --- auto/summary.orig	2010-07-08 19:57:36.000000000 +0400
 +++ auto/summary	2010-12-08 12:25:16.000000000 +0300
 @@ -73,6 +73,11 @@
@@ -717,9 +726,9 @@ index ee00fd3..e15e157 100644
  
  cat << END                                                     > $NGX_MAKEFILE
  
---- auto/options.orig	2011-12-15 21:25:00.000000000 +0400
-+++ auto/options	2011-12-15 21:28:01.000000000 +0400
-@@ -119,6 +119,8 @@
+--- auto/options.orig	2011-11-01 09:01:14.000000000 +0400
++++ auto/options	2011-11-01 09:02:42.000000000 +0400
+@@ -120,6 +120,8 @@
  MD5_OPT=
  MD5_ASM=NO
  
@@ -728,23 +737,24 @@ index ee00fd3..e15e157 100644
  USE_SHA1=NO
  SHA1=NONE
  SHA1_OPT=
-@@ -272,6 +274,9 @@
+@@ -274,6 +276,9 @@
          --with-md5-opt=*)                MD5_OPT="$value"           ;;
          --with-md5-asm)                  MD5_ASM=YES                ;;
  
-+        --with-syslog)                   USE_SYSLOG="YES"           ;;
++        --with-syslog)                   USE_SYSLOG=YES             ;;
 +        --with-syslog-facility=*)        SYSLOG_FACILITY="$value"   ;;
 +
          --with-sha1=*)                   SHA1="$value"              ;;
          --with-sha1-opt=*)               SHA1_OPT="$value"          ;;
          --with-sha1-asm)                 SHA1_ASM=YES               ;;
-@@ -416,6 +421,9 @@
-   --with-md5-opt=OPTIONS             set additional build options for md5
+@@ -418,6 +423,9 @@
+   --with-md5-opt=OPTIONS             set additional options for md5 building
    --with-md5-asm                     use md5 assembler sources
  
 +  --with-syslog                      use syslog instead of files to log messages
 +  --with-syslog-facility=FACILITY    set syslog facility
 +
    --with-sha1=DIR                    set path to sha1 library sources
-   --with-sha1-opt=OPTIONS            set additional build options for sha1
+   --with-sha1-opt=OPTIONS            set additional options for sha1 building
    --with-sha1-asm                    use sha1 assembler sources
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305021431.r42EV1xt083861>