diff options
author | osa <osa@FreeBSD.org> | 2015-04-22 07:26:56 +0800 |
---|---|---|
committer | osa <osa@FreeBSD.org> | 2015-04-22 07:26:56 +0800 |
commit | d11eb408e9f96a67d3b00bc1bfff1fab19550db8 (patch) | |
tree | ae135e8cf6696c64aa6ee287c1b1fe2a6b9ce5c0 /www | |
parent | b725107fcc0aa08d1362c2e4e27429f8b90b6601 (diff) | |
download | freebsd-ports-gnome-d11eb408e9f96a67d3b00bc1bfff1fab19550db8.tar.gz freebsd-ports-gnome-d11eb408e9f96a67d3b00bc1bfff1fab19550db8.tar.zst freebsd-ports-gnome-d11eb408e9f96a67d3b00bc1bfff1fab19550db8.zip |
Upgrade to latest stable version 1.8.0.
According to vendor's recommendations safely remove NGX_THREADS macro
with some long unused code from some third-party modules.
Merge changes from www/nginx-devel to www/nginx.
Merge third-pary upstream_sticky module from www/nginx to www/nginx-devel.
Remove outdated syslog support.
Diffstat (limited to 'www')
-rw-r--r-- | www/nginx-devel/Makefile | 27 | ||||
-rw-r--r-- | www/nginx-devel/distinfo | 4 | ||||
-rw-r--r-- | www/nginx-devel/files/extra-patch-ngx_http_lua_socket_udp.c | 20 | ||||
-rw-r--r-- | www/nginx-devel/files/extra-patch-ngx_http_mogilefs_module.c | 12 | ||||
-rw-r--r-- | www/nginx-devel/files/extra-patch-ngx_http_sflow_module.c | 60 | ||||
-rw-r--r-- | www/nginx-devel/files/extra-patch-syslog_support | 760 | ||||
-rw-r--r-- | www/nginx/Makefile | 51 | ||||
-rw-r--r-- | www/nginx/distinfo | 10 | ||||
-rw-r--r-- | www/nginx/files/extra-patch-ngx_http_lua_socket_udp.c | 20 | ||||
-rw-r--r-- | www/nginx/files/extra-patch-ngx_http_mogilefs_module.c | 12 | ||||
-rw-r--r-- | www/nginx/files/extra-patch-ngx_http_sflow_module.c | 60 | ||||
-rw-r--r-- | www/nginx/files/extra-patch-ngx_http_upstream.h | 13 | ||||
-rw-r--r-- | www/nginx/files/extra-patch-syslog_support | 762 |
13 files changed, 222 insertions, 1589 deletions
diff --git a/www/nginx-devel/Makefile b/www/nginx-devel/Makefile index 9e930fb8cee9..0ca5e0046b9d 100644 --- a/www/nginx-devel/Makefile +++ b/www/nginx-devel/Makefile @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= nginx -PORTVERSION= 1.7.12 +PORTVERSION= 1.8.0 CATEGORIES= www MASTER_SITES= http://nginx.org/download/ MASTER_SITES+= ${MASTER_SITE_LOCAL} @@ -52,6 +52,7 @@ OPTIONS_DEFINE= \ MAIL_SMTP \ MAIL_SSL \ SPDY \ + THREADS \ WWW \ CACHE_PURGE \ CTPP2 \ @@ -140,6 +141,7 @@ 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.) +THREADS_DESC= Enable threads support WWW_DESC= Enable html sample files CACHE_PURGE_DESC= 3rd party cache_purge module CTPP2_DESC= 3rd party CT++ module @@ -419,6 +421,7 @@ NGINX_MOGILEFS_VERSION= 1.0.4 MASTER_SITES+= http://www.grid.net.ru/nginx/download/:mogilefs DISTFILES+= nginx_mogilefs_module-${NGINX_MOGILEFS_VERSION}.tar.gz:mogilefs CONFIGURE_ARGS+=--add-module=${WRKDIR}/nginx_mogilefs_module-${NGINX_MOGILEFS_VERSION} +EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-ngx_http_mogilefs_module.c .endif .if ${PORT_OPTIONS:MHTTP_MP4_H264} @@ -527,12 +530,11 @@ CONFIGURE_ARGS+=--add-module=${WRKDIR}/nginx_upstream_fair-${NGINX_UPSTREAM_FAIR .endif .if ${PORT_OPTIONS:MHTTP_UPSTREAM_STICKY} -IGNORE= HTTP_UPSTREAM_STICKY: update require USE_HTTP_SSL= yes -NGINX_UPSTREAM_STICKY_VERSION= 1.1 -MASTER_SITES+= http://nginx-sticky-module.googlecode.com/files/:upstreamsticky -DISTFILES+= nginx-sticky-module-${NGINX_UPSTREAM_STICKY_VERSION}.tar.gz:upstreamsticky -CONFIGURE_ARGS+=--add-module=${WRKDIR}/nginx-sticky-module-${NGINX_UPSTREAM_STICKY_VERSION} +NGINX_UPSTREAM_STICKY_VERSION= 1.2.4 +MASTER_SITES+= https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/get/:upstreamsticky +DISTFILES+= ${NGINX_UPSTREAM_STICKY_VERSION}.tar.gz:upstreamsticky +CONFIGURE_ARGS+=--add-module=${WRKDIR}/nginx-goodies-nginx-sticky-module-ng-c825ea7c5c91/ .endif .if ${PORT_OPTIONS:MHTTP_XSLT} @@ -602,6 +604,7 @@ GIT_LUA_VERSION= 0-g4388b1e MASTER_SITES+= https://github.com/openresty/lua-nginx-module/tarball/v${NGINX_LUA_VERSION}/:lua DISTFILES+= openresty-lua-nginx-module-v${NGINX_LUA_VERSION}-${GIT_LUA_VERSION}.tar.gz:lua CONFIGURE_ARGS+=--add-module=${WRKDIR}/openresty-lua-nginx-module-${GIT_LUA_VERSION:S/^0-g//} +EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-ngx_http_lua_socket_udp.c .endif .if ${PORT_OPTIONS:MMEMC} @@ -623,7 +626,7 @@ USE_GNOME= libxml2 MASTER_SITES+= http://www.modsecurity.org/tarball/${NGINX_MODSECURITY_VERSION}/:modsecurity DISTFILES+= modsecurity-${NGINX_MODSECURITY_VERSION}.tar.gz:modsecurity CONFIGURE_ARGS+=--add-module=${WRKDIR}/modsecurity-${NGINX_MODSECURITY_VERSION}/nginx/modsecurity -EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-nginx-modsecurity-configure +EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-nginx-modsecurity-configure .endif .if ${PORT_OPTIONS:MNAXSI} @@ -710,7 +713,8 @@ MASTER_SITES+= http://nginx-sflow-module.googlecode.com/files/:sflow DISTFILES+= nginx-sflow-module-${NGINX_SFLOW_VERSION}.tar.gz:sflow CONFIGURE_ARGS+=--add-module=${WRKDIR}/nginx-sflow-module-${NGINX_SFLOW_VERSION} EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-ngx_http_sflow_config.c \ - ${PATCHDIR}/extra-patch-ngx_http_sflow_config.h + ${PATCHDIR}/extra-patch-ngx_http_sflow_config.h \ + ${PATCHDIR}/extra-patch-ngx_http_sflow_module.c .endif .if ${PORT_OPTIONS:MSLOWFS_CACHE} @@ -738,9 +742,6 @@ CONFIGURE_ARGS+=--add-module=${WRKDIR}/ngx_supervisord-${NGINX_SUPERVISORD_VERSI .if ${PORT_OPTIONS:MSYSLOG_SUPPORT} IGNORE= SYSLOG: update require -NGINX_SYSLOG_SUPPORT_FACILITY?= LOG_DAEMON -CONFIGURE_ARGS+=--with-syslog --with-syslog-facility=${NGINX_SYSLOG_SUPPORT_FACILITY} -EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-syslog_support .endif .if ${PORT_OPTIONS:MTCP_PROXY} @@ -781,6 +782,10 @@ USE_HTTP_SSL= yes CONFIGURE_ARGS+=--with-http_spdy_module .endif +.if ${PORT_OPTIONS:MTHREADS} +CONFIGURE_ARGS+=--with-threads +.endif + .if ${PORT_OPTIONS:MWWW} PLIST_SUB+= WWWDATA="" .else diff --git a/www/nginx-devel/distinfo b/www/nginx-devel/distinfo index 020d37cbc794..eb4660324ae0 100644 --- a/www/nginx-devel/distinfo +++ b/www/nginx-devel/distinfo @@ -1,5 +1,5 @@ -SHA256 (nginx-1.7.12.tar.gz) = 22d1f0b6d064e125b01aeb2c6171682559d2488e1b102fc48ec564aa36e66897 -SIZE (nginx-1.7.12.tar.gz) = 831957 +SHA256 (nginx-1.8.0.tar.gz) = 23cca1239990c818d8f6da118320c4979aadf5386deda691b1b7c2c96b9df3d5 +SIZE (nginx-1.8.0.tar.gz) = 832104 SHA256 (giom-nginx_accept_language_module-2f69842.tar.gz) = fbcdf792160a1eff7b9549aeb5209d6e76716ff8e86b05e42c90b2d2f858e011 SIZE (giom-nginx_accept_language_module-2f69842.tar.gz) = 3399 SHA256 (nginx-accesskey-2.0.3.tar.gz) = d9e94321e78a02de16c57f3e048fd31059fd8116ed03d6de7180f435c52502b1 diff --git a/www/nginx-devel/files/extra-patch-ngx_http_lua_socket_udp.c b/www/nginx-devel/files/extra-patch-ngx_http_lua_socket_udp.c new file mode 100644 index 000000000000..903a9a4840e8 --- /dev/null +++ b/www/nginx-devel/files/extra-patch-ngx_http_lua_socket_udp.c @@ -0,0 +1,20 @@ +--- ../openresty-lua-nginx-module-4388b1e/src/ngx_http_lua_socket_udp.c.orig 2015-04-21 21:18:31.080702000 +0300 ++++ ../openresty-lua-nginx-module-4388b1e/src/ngx_http_lua_socket_udp.c 2015-04-21 21:18:47.449758000 +0300 +@@ -1400,17 +1400,6 @@ + + c->number = ngx_atomic_fetch_add(ngx_connection_counter, 1); + +-#if (NGX_THREADS) +- +- /* TODO: lock event when call completion handler */ +- +- rev->lock = &c->lock; +- wev->lock = &c->lock; +- rev->own_lock = &c->lock; +- wev->own_lock = &c->lock; +- +-#endif +- + #if (NGX_HTTP_LUA_HAVE_SO_PASSCRED) + if (uc->sockaddr->sa_family == AF_UNIX) { + struct sockaddr addr; diff --git a/www/nginx-devel/files/extra-patch-ngx_http_mogilefs_module.c b/www/nginx-devel/files/extra-patch-ngx_http_mogilefs_module.c new file mode 100644 index 000000000000..423483869d57 --- /dev/null +++ b/www/nginx-devel/files/extra-patch-ngx_http_mogilefs_module.c @@ -0,0 +1,12 @@ +--- ../nginx_mogilefs_module-1.0.4/ngx_http_mogilefs_module.c.orig 2015-04-21 21:16:22.251692000 +0300 ++++ ../nginx_mogilefs_module-1.0.4/ngx_http_mogilefs_module.c 2015-04-21 21:16:39.460724000 +0300 +@@ -316,9 +316,6 @@ + + u->peer.log = r->connection->log; + u->peer.log_error = NGX_ERROR_ERR; +-#if (NGX_THREADS) +- u->peer.lock = &r->connection->lock; +-#endif + + u->output.tag = (ngx_buf_tag_t) &ngx_http_mogilefs_module; + diff --git a/www/nginx-devel/files/extra-patch-ngx_http_sflow_module.c b/www/nginx-devel/files/extra-patch-ngx_http_sflow_module.c new file mode 100644 index 000000000000..39b9bb3c11df --- /dev/null +++ b/www/nginx-devel/files/extra-patch-ngx_http_sflow_module.c @@ -0,0 +1,60 @@ +--- ../nginx-sflow-module-0.9.7/ngx_http_sflow_module.c.orig 2015-04-21 21:21:17.020547000 +0300 ++++ ../nginx-sflow-module-0.9.7/ngx_http_sflow_module.c 2015-04-21 21:22:26.994714000 +0300 +@@ -8,10 +8,6 @@ + #include <ngx_http.h> + #include <nginx.h> + +-#if (NGX_THREADS) +-#include <ngx_thread.h> +-#endif +- + #include "ngx_http_sflow_api.h" + #include "ngx_http_sflow_config.h" + +@@ -42,18 +38,10 @@ + /* keep log ptr for callbacks */ + ngx_log_t *log; + +-#if (NGX_THREADS) +- ngx_mutex_t *mut; +-#define SFWB_LOCK(_s) ngx_mutex_lock((_s)->mut) +-#define SFWB_UNLOCK(_s) ngx_mutex_unlock((_s)->mut) +-#define SFWB_INC_CTR(_c) ngx_atomic_fetch_add(&(_c), 1) +-#define SFWB_COUNTDOWN(_c) (ngx_atomic_fetch_add(&(_c), -1) == 1) +-#else + #define SFWB_LOCK(_s) /* no-op */ + #define SFWB_UNLOCK(_s) /* no-op */ + #define SFWB_INC_CTR(_c) (_c)++ + #define SFWB_COUNTDOWN(_c) (--(_c) == 0) +-#endif + + /* delegate acquiring the sflow config */ + SFWBConfigManager *config_manager; +@@ -411,13 +399,8 @@ + static int32_t ngx_http_sflow_add_random_skip(SFWB *sm) + { + ngx_atomic_t next_skip = sfl_sampler_next_skip(sm->sampler); +-#if (NGX_THREADS) +- ngx_atomic_int_t test_skip = ngx_atomic_fetch_add(&sm->sflow_skip, next_skip); +- return (test_skip + next_skip); +-#else + sm->sflow_skip = next_skip; + return next_skip; +-#endif + } + + /*_________________---------------------------__________________ +@@ -528,13 +511,6 @@ + /* a pool to use for the agent so we can recycle the memory easily on a config change */ + sm->masterPool = ngx_create_pool(SFWB_POOL_SIZ, cf->log); + +-#if (NGX_THREADS) +- /* a mutex to lock the sFlow agent when taking a sample (only needed if there +- is more that one worker thread - right now it seems like threads are not even +- an option in the configure script) */ +- sm->mut = ngx_mutex_init(cf->log, 0); +-#endif +- + /* create and initialze the config_manager */ + sm->config_manager = ngx_pcalloc(cf->pool, sizeof(SFWBConfigManager)); + sfwb_config_init(sm->config_manager, cf->log); diff --git a/www/nginx-devel/files/extra-patch-syslog_support b/www/nginx-devel/files/extra-patch-syslog_support deleted file mode 100644 index 019313f3214d..000000000000 --- a/www/nginx-devel/files/extra-patch-syslog_support +++ /dev/null @@ -1,760 +0,0 @@ -diff --git src/core/ngx_cycle.c src/core/ngx_cycle.c -index dc4dc89..46c4b4f 100644 ---- src/core/ngx_cycle.c -+++ src/core/ngx_cycle.c -@@ -85,6 +85,12 @@ ngx_init_cycle(ngx_cycle_t *old_cycle) - cycle->pool = pool; - cycle->log = log; - cycle->new_log.log_level = NGX_LOG_ERR; -+#if (NGX_ENABLE_SYSLOG) -+ cycle->new_log.facility = SYSLOG_FACILITY; -+ cycle->new_log.facility = ERR_SYSLOG_PRIORITY; -+ cycle->new_log.syslog_on = 0; -+ cycle->new_log.syslog_set = 0; -+#endif - cycle->old_cycle = old_cycle; - - cycle->conf_prefix.len = old_cycle->conf_prefix.len; -diff --git src/core/ngx_log.c src/core/ngx_log.c -index d7830fb..982c2ed 100644 ---- src/core/ngx_log.c -+++ src/core/ngx_log.c -@@ -10,6 +10,15 @@ - - - static char *ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -+#if (NGX_ENABLE_SYSLOG) -+static char *ngx_set_syslog(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -+void log_exit(ngx_cycle_t *cycle); -+ -+typedef struct{ -+ ngx_str_t name; -+ ngx_int_t macro; -+} ngx_string_to_macro_t; -+#endif - - - static ngx_command_t ngx_errlog_commands[] = { -@@ -21,6 +30,15 @@ static ngx_command_t ngx_errlog_commands[] = { - 0, - NULL}, - -+#if (NGX_ENABLE_SYSLOG) -+ {ngx_string("syslog"), -+ NGX_MAIN_CONF|NGX_CONF_TAKE12, -+ ngx_set_syslog, -+ 0, -+ 0, -+ NULL}, -+#endif -+ - ngx_null_command - }; - -@@ -43,7 +61,11 @@ ngx_module_t ngx_errlog_module = { - NULL, /* init thread */ - NULL, /* exit thread */ - NULL, /* exit process */ -- NULL, /* exit master */ -+#if (NGX_ENABLE_SYSLOG) -+ log_exit, /* exit master */ -+#else -+ NULL, -+#endif - NGX_MODULE_V1_PADDING - }; - -@@ -52,6 +74,48 @@ static ngx_log_t ngx_log; - static ngx_open_file_t ngx_log_file; - ngx_uint_t ngx_use_stderr = 1; - -+#if (NGX_ENABLE_SYSLOG) -+static ngx_string_to_macro_t ngx_syslog_facilities[] = { -+ {ngx_string("auth"), LOG_AUTH}, -+#if !(NGX_SOLARIS) -+ {ngx_string("authpriv"), LOG_AUTHPRIV}, -+#endif -+ {ngx_string("cron"), LOG_CRON}, -+ {ngx_string("daemon"), LOG_DAEMON}, -+#if !(NGX_SOLARIS) -+ {ngx_string("ftp"), LOG_FTP}, -+#endif -+ {ngx_string("kern"), LOG_KERN}, -+ {ngx_string("local0"), LOG_LOCAL0}, -+ {ngx_string("local1"), LOG_LOCAL1}, -+ {ngx_string("local2"), LOG_LOCAL2}, -+ {ngx_string("local3"), LOG_LOCAL3}, -+ {ngx_string("local4"), LOG_LOCAL4}, -+ {ngx_string("local5"), LOG_LOCAL5}, -+ {ngx_string("local6"), LOG_LOCAL6}, -+ {ngx_string("local7"), LOG_LOCAL7}, -+ {ngx_string("lpr"), LOG_LPR}, -+ {ngx_string("mail"), LOG_MAIL}, -+ {ngx_string("news"), LOG_NEWS}, -+ {ngx_string("syslog"), LOG_SYSLOG}, -+ {ngx_string("user"), LOG_USER}, -+ {ngx_string("uucp"), LOG_UUCP}, -+ { ngx_null_string, 0} -+}; -+ -+static ngx_string_to_macro_t ngx_syslog_priorities[] = { -+ {ngx_string("emerg"), LOG_EMERG}, -+ {ngx_string("alert"), LOG_ALERT}, -+ {ngx_string("crit"), LOG_CRIT}, -+ {ngx_string("error"), LOG_ERR}, -+ {ngx_string("err"), LOG_ERR}, -+ {ngx_string("warn"), LOG_WARNING}, -+ {ngx_string("notice"),LOG_NOTICE}, -+ {ngx_string("info"), LOG_INFO}, -+ {ngx_string("debug"), LOG_DEBUG}, -+ { ngx_null_string, 0} -+}; -+#endif - - static ngx_str_t err_levels[] = { - ngx_null_string, -@@ -89,11 +153,16 @@ ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, - va_list args; - #endif - u_char *p, *last, *msg; -+#if (NGX_ENABLE_SYSLOG) -+ u_char *errstr_syslog; -+#endif - u_char errstr[NGX_MAX_ERROR_STR]; - -+#if !(NGX_ENABLE_SYSLOG) - if (log->file->fd == NGX_INVALID_FILE) { - return; - } -+#endif - - last = errstr + NGX_MAX_ERROR_STR; - -@@ -102,6 +171,10 @@ ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, - - p = errstr + ngx_cached_err_log_time.len; - -+#if (NGX_ENABLE_SYSLOG) -+ errstr_syslog = p; -+#endif -+ - p = ngx_slprintf(p, last, " [%V] ", &err_levels[level]); - - /* pid#tid */ -@@ -140,11 +213,27 @@ ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, - - ngx_linefeed(p); - -+#if (NGX_ENABLE_SYSLOG) -+ if (log->file != NULL && log->file->name.len != 0) { - (void) ngx_write_fd(log->file->fd, errstr, p - errstr); -+ } -+ -+ /* Don't send the debug level info to syslog */ -+ if (log->syslog_on && level < NGX_LOG_DEBUG) { -+ /* write to syslog */ -+ syslog(log->priority, "%.*s", (int)(p - errstr_syslog), errstr_syslog); -+ } -+#else -+ (void) ngx_write_fd(log->file->fd, errstr, p - errstr); -+#endif - - if (!ngx_use_stderr - || level > NGX_LOG_WARN -+#if (NGX_ENABLE_SYSLOG) -+ || (log->file != NULL && log->file->fd == ngx_stderr)) -+#else - || log->file->fd == ngx_stderr) -+#endif - { - return; - } -@@ -367,6 +456,50 @@ ngx_log_create(ngx_cycle_t *cycle, ngx_str_t *name) - } - - -+#if (NGX_ENABLE_SYSLOG) -+ngx_int_t -+ngx_log_get_priority(ngx_conf_t *cf, ngx_str_t *priority) -+{ -+ ngx_int_t p = 0; -+ ngx_uint_t n, match = 0; -+ -+ for (n = 0; ngx_syslog_priorities[n].name.len != 0; n++) { -+ if (ngx_strncmp(priority->data, ngx_syslog_priorities[n].name.data, -+ ngx_syslog_priorities[n].name.len) == 0) { -+ p = ngx_syslog_priorities[n].macro; -+ match = 1; -+ } -+ } -+ -+ if (!match) { -+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, -+ "invalid syslog priority \"%V\"", priority); -+ return -1; -+ } -+ -+ return p; -+} -+ -+ -+char * -+ngx_log_set_priority(ngx_conf_t *cf, ngx_str_t *priority, ngx_log_t *log) -+{ -+ log->priority = ERR_SYSLOG_PRIORITY; -+ -+ if (priority->len == 0) { -+ return NGX_CONF_OK; -+ } -+ -+ log->priority = ngx_log_get_priority(cf, priority); -+ if (log->priority == (-1)) { -+ return NGX_CONF_ERROR; -+ } -+ -+ return NGX_CONF_OK; -+} -+#endif -+ -+ - char * - ngx_log_set_levels(ngx_conf_t *cf, ngx_log_t *log) - { -@@ -429,6 +562,13 @@ static char * - ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) - { - ngx_str_t *value, name; -+#if (NGX_ENABLE_SYSLOG) -+ u_char *off = NULL; -+ ngx_str_t priority; -+ -+ ngx_str_null(&name); -+ ngx_str_null(&priority); -+#endif - - if (cf->cycle->new_log.file) { - return "is duplicate"; -@@ -436,7 +576,44 @@ ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) - - value = cf->args->elts; - -+#if (NGX_ENABLE_SYSLOG) -+ if (ngx_strncmp(value[1].data, "syslog", sizeof("syslog") - 1) == 0) { -+ if (!cf->cycle->new_log.syslog_set) { -+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, -+ "You must set the syslog directive and enable it first."); -+ return NGX_CONF_ERROR; -+ } -+ -+ cf->cycle->new_log.syslog_on = 1; -+ -+ if (value[1].data[sizeof("syslog") - 1] == ':') { -+ priority.len = value[1].len - sizeof("syslog"); -+ priority.data = value[1].data + sizeof("syslog"); -+ -+ off = (u_char *)ngx_strchr(priority.data, (int) '|'); -+ if (off != NULL) { -+ priority.len = off - priority.data; -+ -+ off++; -+ name.len = value[1].data + value[1].len - off; -+ name.data = off; -+ } -+ } -+ else { -+ if (value[1].len > sizeof("syslog")) { -+ name.len = value[1].len - sizeof("syslog"); -+ name.data = value[1].data + sizeof("syslog"); -+ } -+ } -+ -+ if (ngx_log_set_priority(cf, &priority, &cf->cycle->new_log) == NGX_CONF_ERROR) { -+ return NGX_CONF_ERROR; -+ } -+ } -+ else if (ngx_strcmp(value[1].data, "stderr") == 0) { -+#else - if (ngx_strcmp(value[1].data, "stderr") == 0) { -+#endif - ngx_str_null(&name); - - } else { -@@ -457,3 +634,63 @@ ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) - - return ngx_log_set_levels(cf, &cf->cycle->new_log); - } -+ -+ -+#if (NGX_ENABLE_SYSLOG) -+ -+#define SYSLOG_IDENT_NAME "nginx" -+ -+static char * -+ngx_set_syslog(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) -+{ -+ char *program; -+ ngx_str_t *value; -+ ngx_int_t facility, match = 0; -+ ngx_uint_t n; -+ -+ value = cf->args->elts; -+ -+ if (cf->cycle->new_log.syslog_set) { -+ return "is duplicate"; -+ } -+ -+ cf->cycle->new_log.syslog_set = 1; -+ -+ for (n = 0; ngx_syslog_facilities[n].name.len != 0; n++) { -+ if (ngx_strncmp(value[1].data, ngx_syslog_facilities[n].name.data, -+ ngx_syslog_facilities[n].name.len) == 0) { -+ facility = ngx_syslog_facilities[n].macro; -+ match = 1; -+ break; -+ } -+ } -+ -+ if (match) { -+ cf->cycle->new_log.facility = facility; -+ cf->cycle->new_log.priority = ERR_SYSLOG_PRIORITY; -+ } -+ else { -+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, -+ "invalid syslog facility \"%V\"", &value[1]); -+ return NGX_CONF_ERROR; -+ } -+ -+ program = SYSLOG_IDENT_NAME; -+ if (cf->args->nelts > 2) { -+ program = (char *) value[2].data; -+ } -+ -+ openlog(program, LOG_ODELAY, facility); -+ -+ return NGX_CONF_OK; -+} -+ -+ -+void log_exit(ngx_cycle_t *cycle) -+{ -+ if (cycle->new_log.syslog_set) { -+ closelog(); -+ } -+} -+#endif -+ -diff --git src/core/ngx_log.h src/core/ngx_log.h -index 3233647..5e7fdbf 100644 ---- src/core/ngx_log.h -+++ src/core/ngx_log.h -@@ -12,6 +12,13 @@ - #include <ngx_config.h> - #include <ngx_core.h> - -+#if (NGX_ENABLE_SYSLOG) -+#include <syslog.h> -+ -+#define SYSLOG_FACILITY LOG_LOCAL5 -+#define ERR_SYSLOG_PRIORITY LOG_ERR -+#endif -+ - - #define NGX_LOG_STDERR 0 - #define NGX_LOG_EMERG 1 -@@ -61,6 +68,13 @@ struct ngx_log_s { - */ - - char *action; -+ -+#if (NGX_ENABLE_SYSLOG) -+ ngx_int_t priority; -+ ngx_int_t facility; -+ unsigned syslog_on:1; /* unsigned :1 syslog_on */ -+ unsigned syslog_set:1; /*unsigned :1 syslog_set */ -+#endif - }; - - -@@ -221,6 +235,10 @@ void ngx_cdecl ngx_log_debug_core(ngx_log_t *log, ngx_err_t err, - - ngx_log_t *ngx_log_init(u_char *prefix); - ngx_log_t *ngx_log_create(ngx_cycle_t *cycle, ngx_str_t *name); -+#if (NGX_ENABLE_SYSLOG) -+ngx_int_t ngx_log_get_priority(ngx_conf_t *cf, ngx_str_t *priority); -+char * ngx_log_set_priority(ngx_conf_t *cf, ngx_str_t *priority, ngx_log_t *log); -+#endif - char *ngx_log_set_levels(ngx_conf_t *cf, ngx_log_t *log); - void ngx_cdecl ngx_log_abort(ngx_err_t err, const char *fmt, ...); - void ngx_cdecl ngx_log_stderr(ngx_err_t err, const char *fmt, ...); -diff --git src/http/modules/ngx_http_log_module.c src/http/modules/ngx_http_log_module.c -index aa6a3fc..deceb38 100644 ---- src/http/modules/ngx_http_log_module.c -+++ src/http/modules/ngx_http_log_module.c -@@ -13,6 +13,11 @@ - #include <zlib.h> - #endif - -+#if (NGX_ENABLE_SYSLOG) -+#include <syslog.h> -+ -+#define HTTP_SYSLOG_PRIORITY LOG_NOTICE -+#endif - - typedef struct ngx_http_log_op_s ngx_http_log_op_t; - -@@ -67,6 +72,11 @@ typedef struct { - time_t disk_full_time; - time_t error_log_time; - ngx_http_log_fmt_t *format; -+ -+#if (NGX_ENABLE_SYSLOG) -+ ngx_int_t priority; -+ unsigned syslog_on:1; /* unsigned :1 syslog_on */ -+#endif - } ngx_http_log_t; - - -@@ -348,6 +358,14 @@ ngx_http_log_write(ngx_http_request_t *r, ngx_http_log_t *log, u_char *buf, - time_t now; - ssize_t n; - ngx_err_t err; -+ -+#if (NGX_ENABLE_SYSLOG) -+ n = 0; -+ if (log->syslog_on) { -+ syslog(log->priority, "%.*s", (int)len, buf); -+ } -+#endif -+ - #if (NGX_ZLIB) - ngx_http_log_buf_t *buffer; - #endif -@@ -355,6 +373,9 @@ ngx_http_log_write(ngx_http_request_t *r, ngx_http_log_t *log, u_char *buf, - if (log->script == NULL) { - name = log->file->name.data; - -+#if (NGX_ENABLE_SYSLOG) -+ if (name != NULL) { -+#endif - #if (NGX_ZLIB) - buffer = log->file->data; - -@@ -367,7 +388,11 @@ ngx_http_log_write(ngx_http_request_t *r, ngx_http_log_t *log, u_char *buf, - #else - n = ngx_write_fd(log->file->fd, buf, len); - #endif -- -+#if (NGX_ENABLE_SYSLOG) -+ } else { -+ n = len; -+ } -+#endif - } else { - name = NULL; - n = ngx_http_log_script_write(r, log->script, &name, buf, len); -@@ -1068,6 +1093,10 @@ ngx_http_log_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) - log->script = NULL; - log->disk_full_time = 0; - log->error_log_time = 0; -+#if (NGX_ENABLE_SYSLOG) -+ log->priority = HTTP_SYSLOG_PRIORITY; -+ log->syslog_on = 0; -+#endif - - lmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_log_module); - fmt = lmcf->formats.elts; -@@ -1096,6 +1125,13 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) - ngx_http_log_main_conf_t *lmcf; - ngx_http_script_compile_t sc; - -+#if (NGX_ENABLE_SYSLOG) -+ u_char *off; -+ ngx_str_t priority; -+ ngx_uint_t syslog_on = 0; -+ name = priority = (ngx_str_t)ngx_null_string; -+#endif -+ - value = cf->args->elts; - - if (ngx_strcmp(value[1].data, "off") == 0) { -@@ -1108,6 +1144,38 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) - "invalid parameter \"%V\"", &value[2]); - return NGX_CONF_ERROR; - } -+#if (NGX_ENABLE_SYSLOG) -+ else if (ngx_strncmp(value[1].data, "syslog", sizeof("syslog") - 1) == 0) { -+ if (!cf->cycle->new_log.syslog_set) { -+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, -+ "You must set the syslog directive and enable it first."); -+ return NGX_CONF_ERROR; -+ } -+ -+ syslog_on = 1; -+ if (value[1].data[sizeof("syslog") - 1] == ':') { -+ priority.len = value[1].len - sizeof("syslog"); -+ priority.data = value[1].data + sizeof("syslog"); -+ -+ off = (u_char*) ngx_strchr(priority.data, '|'); -+ if (off != NULL) { -+ priority.len = off - priority.data; -+ -+ off++; -+ name.len = value[1].data + value[1].len - off; -+ name.data = off; -+ } -+ } -+ else { -+ if (value[1].len > sizeof("syslog")) { -+ name.len = value[1].len - sizeof("syslog"); -+ name.data = value[1].data + sizeof("syslog"); -+ } -+ } -+ } else { -+ name = value[1]; -+ } -+#endif - - if (llcf->logs == NULL) { - llcf->logs = ngx_array_create(cf->pool, 2, sizeof(ngx_http_log_t)); -@@ -1125,6 +1193,52 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) - - ngx_memzero(log, sizeof(ngx_http_log_t)); - -+#if (NGX_ENABLE_SYSLOG) -+ log->syslog_on = syslog_on; -+ -+ if (priority.len == 0) { -+ log->priority = HTTP_SYSLOG_PRIORITY; -+ } -+ else { -+ log->priority = ngx_log_get_priority(cf, &priority); -+ } -+ -+ if (name.len != 0) { -+ n = ngx_http_script_variables_count(&name); -+ -+ if (n == 0) { -+ log->file = ngx_conf_open_file(cf->cycle, &name); -+ if (log->file == NULL) { -+ return NGX_CONF_ERROR; -+ } -+ } else { -+ if (ngx_conf_full_name(cf->cycle, &name, 0) != NGX_OK) { -+ return NGX_CONF_ERROR; -+ } -+ log->script = ngx_pcalloc(cf->pool, sizeof(ngx_http_log_script_t)); -+ if (log->script == NULL) { -+ return NGX_CONF_ERROR; -+ } -+ ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); -+ sc.cf = cf; -+ sc.source = &name; -+ sc.lengths = &log->script->lengths; -+ sc.values = &log->script->values; -+ sc.variables = n; -+ sc.complete_lengths = 1; -+ sc.complete_values = 1; -+ if (ngx_http_script_compile(&sc) != NGX_OK) { -+ return NGX_CONF_ERROR; -+ } -+ } -+ } -+ else { -+ log->file = ngx_conf_open_file(cf->cycle, &name); -+ if (log->file == NULL) { -+ return NGX_CONF_ERROR; -+ } -+ } -+#else - n = ngx_http_script_variables_count(&value[1]); - - if (n == 0) { -@@ -1157,6 +1271,7 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) - return NGX_CONF_ERROR; - } - } -+#endif - - 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 c491499..4f039eb 100644 ---- src/http/ngx_http_core_module.c -+++ src/http/ngx_http_core_module.c -@@ -1462,6 +1462,9 @@ ngx_http_update_location_config(ngx_http_request_t *r) - - if (r == r->main) { - ngx_http_set_connection_log(r->connection, clcf->error_log); -+#if (NGX_ENABLE_SYSLOG) -+ r->connection->log->priority = clcf->error_log->priority; -+#endif - } - - 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; - -+#if (NGX_ENABLE_SYSLOG) -+ u_char *off = NULL; -+ ngx_int_t syslog_on = 0; -+ ngx_str_t priority; -+ -+ name = priority = (ngx_str_t) ngx_null_string; -+#endif -+ -+ - if (clcf->error_log) { - return "is duplicate"; - } -@@ -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); - -+#if (NGX_ENABLE_SYSLOG) -+ } else if (ngx_strncmp(value[1].data, "syslog", sizeof("syslog") - 1) == 0) { -+ if (!cf->cycle->new_log.syslog_set) { -+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, -+ "You must set the syslog directive and enable it first."); -+ return NGX_CONF_ERROR; -+ } -+ -+ syslog_on = 1; -+ -+ if (value[1].data[sizeof("syslog") - 1] == ':') { -+ priority.len = value[1].len - sizeof("syslog"); -+ priority.data = value[1].data + sizeof("syslog"); -+ -+ off = (u_char*) ngx_strchr(priority.data, '|'); -+ if (off != NULL) { -+ priority.len = off - priority.data; -+ -+ off++; -+ name.len = value[1].data + value[1].len - off; -+ name.data = off; -+ } -+ } -+ else { -+ if (value[1].len > sizeof("syslog")) { -+ name.len = value[1].len - sizeof("syslog"); -+ name.data = value[1].data + sizeof("syslog"); -+ } -+ } -+#endif - } else { - name = value[1]; - } -@@ -4885,6 +4927,17 @@ ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) - return NGX_CONF_ERROR; - } - -+#if (NGX_ENABLE_SYSLOG) -+ if (syslog_on) { -+ clcf->error_log->syslog_on = 1; -+ if (ngx_log_set_priority(cf, &priority, clcf->error_log) == NGX_CONF_ERROR) { -+ return NGX_CONF_ERROR; -+ } -+ } -+ -+ clcf->error_log->log_level = 0; -+#endif -+ - if (cf->args->nelts == 2) { - 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 54e1c26..2b05157 100644 ---- src/http/ngx_http_request.c -+++ src/http/ngx_http_request.c -@@ -424,6 +424,9 @@ ngx_http_init_request(ngx_event_t *rev) - clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); - - 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 - - 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); - - ngx_http_set_connection_log(r->connection, clcf->error_log); -+#if (NGX_ENABLE_SYSLOG) -+ r->connection->log->priority = clcf->error_log->priority; -+#endif - - 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 @@ - *) echo " + using libatomic_ops library: $NGX_LIBATOMIC" ;; - esac - -+case $USE_SYSLOG in -+ YES) echo " + using syslog with $SYSLOG_FACILITY facility" ;; -+ *) echo " + syslog is not used" ;; -+esac -+ - echo - - ---- auto/make.orig 2009-05-12 17:15:43.000000000 +0400 -+++ auto/make 2010-12-08 12:32:25.000000000 +0300 -@@ -15,6 +15,13 @@ - ngx_objs_dir=$NGX_OBJS$ngx_regex_dirsep - ngx_use_pch=`echo $NGX_USE_PCH | sed -e "s/\//$ngx_regex_dirsep/g"` - -+#SYSLOG -+if test -z "${SYSLOG_FACILITY}"; then -+ SYSLOG_FACILITY="LOG_DAEMON" -+fi -+if test "${USE_SYSLOG}" = "YES"; then -+ CFLAGS="$CFLAGS -DUSE_SYSLOG -DSYSLOG_FACILITY=${SYSLOG_FACILITY}" -+fi - - cat << END > $NGX_MAKEFILE - ---- 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 - -+USE_SYSLOG=NO -+ - USE_SHA1=NO - SHA1=NONE - SHA1_OPT= -@@ -274,6 +276,9 @@ - --with-md5-opt=*) MD5_OPT="$value" ;; - --with-md5-asm) MD5_ASM=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 ;; -@@ -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 options for sha1 building - --with-sha1-asm use sha1 assembler sources - diff --git a/www/nginx/Makefile b/www/nginx/Makefile index 15d22be21187..9b1a4add3146 100644 --- a/www/nginx/Makefile +++ b/www/nginx/Makefile @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= nginx -PORTVERSION= 1.6.3 +PORTVERSION= 1.8.0 PORTEPOCH= 2 CATEGORIES= www MASTER_SITES= http://nginx.org/download/ @@ -29,6 +29,7 @@ OPTIONS_DEFINE= \ GOOGLE_PERFTOOLS \ HTTP \ HTTP_ADDITION \ + HTTP_AUTH_REQ \ HTTP_CACHE \ HTTP_DAV \ HTTP_FLV \ @@ -51,6 +52,7 @@ OPTIONS_DEFINE= \ MAIL_SMTP \ MAIL_SSL \ SPDY \ + THREADS \ WWW \ CACHE_PURGE \ CTPP2 \ @@ -61,7 +63,6 @@ OPTIONS_DEFINE= \ HTTP_AUTH_DIGEST \ HTTP_AUTH_LDAP \ HTTP_AUTH_PAM \ - HTTP_AUTH_REQ \ HTTP_DAV_EXT \ HTTP_EVAL \ HTTP_FANCYINDEX \ @@ -76,7 +77,6 @@ OPTIONS_DEFINE= \ HTTP_UPLOAD \ HTTP_UPLOAD_PROGRESS \ HTTP_UPSTREAM_FAIR \ - HTTP_UPSTREAM_HASH \ HTTP_UPSTREAM_STICKY \ HTTP_ZIP \ ARRAYVAR \ @@ -117,6 +117,7 @@ FILE_AIO_DESC= Enable file aio GOOGLE_PERFTOOLS_DESC= Enable google perftools module HTTP_DESC= Enable HTTP module HTTP_ADDITION_DESC= Enable http_addition module +HTTP_AUTH_REQ_DESC= Enable http_auth_request module HTTP_CACHE_DESC= Enable http_cache module HTTP_DAV_DESC= Enable http_webdav module HTTP_FLV_DESC= Enable http_flv module @@ -140,6 +141,7 @@ 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.) +THREADS_DESC= Enable threads support WWW_DESC= Enable html sample files CACHE_PURGE_DESC= 3rd party cache_purge module CTPP2_DESC= 3rd party CT++ module @@ -150,7 +152,6 @@ HTTP_ACCESSKEY_DESC= 3rd party http_accesskey module HTTP_AUTH_DIGEST_DESC= 3rd party http_authdigest module HTTP_AUTH_LDAP_DESC= 3rd party http_auth_ldap module HTTP_AUTH_PAM_DESC= 3rd party http_auth_pam module -HTTP_AUTH_REQ_DESC= 3rd party http_auth_request module HTTP_DAV_EXT_DESC= 3rd party webdav_ext module HTTP_EVAL_DESC= 3rd party eval module HTTP_FANCYINDEX_DESC= 3rd party http_fancyindex module @@ -166,7 +167,6 @@ HTTP_SUBS_FILTER_DESC= 3rd party subs filter module HTTP_UPLOAD_DESC= 3rd party upload module HTTP_UPLOAD_PROGRESS_DESC= 3rd party uploadprogress module HTTP_UPSTREAM_FAIR_DESC= 3rd party upstream fair module -HTTP_UPSTREAM_HASH_DESC= 3rd party upstream hash module HTTP_UPSTREAM_STICKY_DESC= 3rd party upstream sticky module HTTP_ZIP_DESC= 3rd party http_zip module ARRAYVAR_DESC= 3rd party array_var module @@ -313,10 +313,7 @@ CONFIGURE_ARGS+=--add-module=${WRKDIR}/ngx_http_auth_pam_module-${NGINX_AUTH_PAM .endif .if ${PORT_OPTIONS:MHTTP_AUTH_REQ} -NGINX_AUTH_REQ_VERSION= 0.2 -MASTER_SITES+= http://mdounin.ru/files/:auth_request -DISTFILES+= ngx_http_auth_request_module-${NGINX_AUTH_REQ_VERSION}.tar.gz:auth_request -CONFIGURE_ARGS+=--add-module=${WRKDIR}/ngx_http_auth_request_module-${NGINX_AUTH_REQ_VERSION} +CONFIGURE_ARGS+=--with-http_auth_request_module .endif .if empty(PORT_OPTIONS:MHTTP_CACHE) @@ -424,6 +421,7 @@ NGINX_MOGILEFS_VERSION= 1.0.4 MASTER_SITES+= http://www.grid.net.ru/nginx/download/:mogilefs DISTFILES+= nginx_mogilefs_module-${NGINX_MOGILEFS_VERSION}.tar.gz:mogilefs CONFIGURE_ARGS+=--add-module=${WRKDIR}/nginx_mogilefs_module-${NGINX_MOGILEFS_VERSION} +EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-ngx_http_mogilefs_module.c .endif .if ${PORT_OPTIONS:MHTTP_MP4_H264} @@ -507,6 +505,7 @@ CONFIGURE_ARGS+=--with-http_sub_module .endif .if ${PORT_OPTIONS:MHTTP_UPLOAD} +IGNORE= UPLOAD: update require 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 @@ -530,14 +529,6 @@ DISTFILES+= nginx_upstream_fair-${NGINX_UPSTREAM_FAIR_VERSION}.tar.gz:upstreamfa CONFIGURE_ARGS+=--add-module=${WRKDIR}/nginx_upstream_fair-${NGINX_UPSTREAM_FAIR_VERSION} .endif -.if ${PORT_OPTIONS:MHTTP_UPSTREAM_HASH} -NGINX_UPSTREAM_HASH_VERSION= 0.3.1 -MASTER_SITES+= http://wiki.nginx.org/images/1/11/:upstreamhash -DISTFILES+= Nginx_upstream_hash-${NGINX_UPSTREAM_HASH_VERSION}.tar.gz:upstreamhash -CONFIGURE_ARGS+=--add-module=${WRKDIR}/nginx_upstream_hash-${NGINX_UPSTREAM_HASH_VERSION} -EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-ngx_http_upstream.h -.endif - .if ${PORT_OPTIONS:MHTTP_UPSTREAM_STICKY} USE_HTTP_SSL= yes NGINX_UPSTREAM_STICKY_VERSION= 1.2.4 @@ -613,6 +604,7 @@ GIT_LUA_VERSION= 0-g4388b1e MASTER_SITES+= https://github.com/openresty/lua-nginx-module/tarball/v${NGINX_LUA_VERSION}/:lua DISTFILES+= openresty-lua-nginx-module-v${NGINX_LUA_VERSION}-${GIT_LUA_VERSION}.tar.gz:lua CONFIGURE_ARGS+=--add-module=${WRKDIR}/openresty-lua-nginx-module-${GIT_LUA_VERSION:S/^0-g//} +EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-ngx_http_lua_socket_udp.c .endif .if ${PORT_OPTIONS:MMEMC} @@ -634,7 +626,7 @@ USE_GNOME= libxml2 MASTER_SITES+= http://www.modsecurity.org/tarball/${NGINX_MODSECURITY_VERSION}/:modsecurity DISTFILES+= modsecurity-${NGINX_MODSECURITY_VERSION}.tar.gz:modsecurity CONFIGURE_ARGS+=--add-module=${WRKDIR}/modsecurity-${NGINX_MODSECURITY_VERSION}/nginx/modsecurity -EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-nginx-modsecurity-configure +EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-nginx-modsecurity-configure .endif .if ${PORT_OPTIONS:MNAXSI} @@ -721,7 +713,8 @@ MASTER_SITES+= http://nginx-sflow-module.googlecode.com/files/:sflow DISTFILES+= nginx-sflow-module-${NGINX_SFLOW_VERSION}.tar.gz:sflow CONFIGURE_ARGS+=--add-module=${WRKDIR}/nginx-sflow-module-${NGINX_SFLOW_VERSION} EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-ngx_http_sflow_config.c \ - ${PATCHDIR}/extra-patch-ngx_http_sflow_config.h + ${PATCHDIR}/extra-patch-ngx_http_sflow_config.h \ + ${PATCHDIR}/extra-patch-ngx_http_sflow_module.c .endif .if ${PORT_OPTIONS:MSLOWFS_CACHE} @@ -740,6 +733,7 @@ CONFIGURE_ARGS+=--add-module=${WRKDIR}/openresty-srcache-nginx-module-${GIT_SRCA .endif .if ${PORT_OPTIONS:MSUPERVISORD} +IGNORE= SUPERVISORD: update require NGINX_SUPERVISORD_VERSION= 1.4 MASTER_SITES+= http://labs.frickle.com/files/:supervisord DISTFILES+= ngx_supervisord-${NGINX_SUPERVISORD_VERSION}.tar.gz:supervisord @@ -747,11 +741,7 @@ CONFIGURE_ARGS+=--add-module=${WRKDIR}/ngx_supervisord-${NGINX_SUPERVISORD_VERSI .endif .if ${PORT_OPTIONS:MSYSLOG_SUPPORT} -#GIT_SYSLOG_PATCH_VERSION=3ca5ba65541637f74467038aa032e2586321d0cb -GIT_SYSLOG_PATCH_VERSION=3ca5ba6 -MASTER_SITES+= https://github.com/yaoweibin/nginx_syslog_patch/tarball/${GIT_SYSLOG_PATCH_VERSION}/:syslog_patch -DISTFILES+= nginx_syslog_patch-${GIT_SYSLOG_PATCH_VERSION}.tar.gz:syslog_patch -CONFIGURE_ARGS+= --add-module=${WRKDIR}/yaoweibin-nginx_syslog_patch-${GIT_SYSLOG_PATCH_VERSION} +IGNORE= SYSLOG: update require .endif .if ${PORT_OPTIONS:MTCP_PROXY} @@ -792,6 +782,10 @@ USE_HTTP_SSL= yes CONFIGURE_ARGS+=--with-http_spdy_module .endif +.if ${PORT_OPTIONS:MTHREADS} +CONFIGURE_ARGS+=--with-threads +.endif + .if ${PORT_OPTIONS:MWWW} PLIST_SUB+= WWWDATA="" .else @@ -933,10 +927,6 @@ post-patch: ${WRKDIR}/nginx-sflow-module-${NGINX_SFLOW_VERSION}/ngx_http_sflow_config.h .endif .if ${PORT_OPTIONS:MSPDY} -.if ${PORT_OPTIONS:MDRIZZLE} - @${REINPLACE_CMD} '589d' \ - ${WRKDIR}/chaoslawful-drizzle-nginx-module-${GIT_DRIZZLE_VERSION:S/^0-g//}/src/ngx_http_drizzle_util.c -.endif .if ${PORT_OPTIONS:MLUA} @${REINPLACE_CMD} '464d' \ ${WRKDIR}/openresty-lua-nginx-module-${GIT_LUA_VERSION:S/^0-g//}/src/ngx_http_lua_socket_tcp.c @@ -955,11 +945,6 @@ post-patch: ${PATCH} -p1 < \ ${WRKDIR}/yaoweibin-nginx_tcp_proxy_module-${GIT_TCP_PROXY_VERSION:S/^0-g//}/tcp.patch ) .endif -.if ${PORT_OPTIONS:MSYSLOG_SUPPORT} - ( cd ${WRKSRC} && \ - ${PATCH} -p1 < \ - ${WRKDIR}/yaoweibin-nginx_syslog_patch-${GIT_SYSLOG_PATCH_VERSION}/syslog-1.5.6.patch ) -.endif .if ${PORT_OPTIONS:MICONV} @${REINPLACE_CMD} \ 's!%%PREFIX%%!${LOCALBASE}!g' \ diff --git a/www/nginx/distinfo b/www/nginx/distinfo index 96ef2b429696..eb4660324ae0 100644 --- a/www/nginx/distinfo +++ b/www/nginx/distinfo @@ -1,5 +1,5 @@ -SHA256 (nginx-1.6.3.tar.gz) = 0a98e95b366e4d6042f331e1fa4d70e18fd1e49d8993e589008e70e742b7e757 -SIZE (nginx-1.6.3.tar.gz) = 805253 +SHA256 (nginx-1.8.0.tar.gz) = 23cca1239990c818d8f6da118320c4979aadf5386deda691b1b7c2c96b9df3d5 +SIZE (nginx-1.8.0.tar.gz) = 832104 SHA256 (giom-nginx_accept_language_module-2f69842.tar.gz) = fbcdf792160a1eff7b9549aeb5209d6e76716ff8e86b05e42c90b2d2f858e011 SIZE (giom-nginx_accept_language_module-2f69842.tar.gz) = 3399 SHA256 (nginx-accesskey-2.0.3.tar.gz) = d9e94321e78a02de16c57f3e048fd31059fd8116ed03d6de7180f435c52502b1 @@ -10,8 +10,6 @@ SHA256 (http_auth_ldap-c4dc7c9153.tar.gz) = ac082a36afdbcfd883303bc2b1aaea5f2b4d SIZE (http_auth_ldap-c4dc7c9153.tar.gz) = 5323 SHA256 (ngx_http_auth_pam_module-1.2.tar.gz) = 5a85970ba61a99f55a26d2536a11d512b39bbd622f5737d25a9a8c10db81efa9 SIZE (ngx_http_auth_pam_module-1.2.tar.gz) = 5424 -SHA256 (ngx_http_auth_request_module-0.2.tar.gz) = eea5d0ec02bba93d0b204a034230cc61462b60497cbac6f581d7e008a9262ba4 -SIZE (ngx_http_auth_request_module-0.2.tar.gz) = 6736 SHA256 (ngx_cache_purge-2.3.tar.gz) = 279e0d8a46d3b1521fd43b3f78bc1c08b263899142a7cc5058c1c0361a92c89c SIZE (ngx_cache_purge-2.3.tar.gz) = 12248 SHA256 (ngx_ctpp2-0.5.tar.gz) = f8adfecc23e2c23af95df8549ef92fd52598b21506a9d9df2278b2605668d5a6 @@ -112,7 +110,3 @@ SHA256 (calio-form-input-nginx-module-v0.07-0-g78de845.tar.gz) = d5b2c42a3b9fd29 SIZE (calio-form-input-nginx-module-v0.07-0-g78de845.tar.gz) = 10580 SHA256 (calio-iconv-nginx-module-v0.10-0-gb37efb5.tar.gz) = e90a406a14d5f419bd500e19082da81390e8ba6040926857926f1a899a53379d SIZE (calio-iconv-nginx-module-v0.10-0-gb37efb5.tar.gz) = 12510 -SHA256 (1.2.4.tar.gz) = f79521a25322cb4f504547a0b0f76fd9d024c14440e5d790e26dda70ea4f701a -SIZE (1.2.4.tar.gz) = 120448 -SHA256 (nginx_syslog_patch-3ca5ba6.tar.gz) = 817a207f2cb18f3035f5535bd03942390010dbade03c4a5d3d0d97b55e1f3deb -SIZE (nginx_syslog_patch-3ca5ba6.tar.gz) = 94400 diff --git a/www/nginx/files/extra-patch-ngx_http_lua_socket_udp.c b/www/nginx/files/extra-patch-ngx_http_lua_socket_udp.c new file mode 100644 index 000000000000..903a9a4840e8 --- /dev/null +++ b/www/nginx/files/extra-patch-ngx_http_lua_socket_udp.c @@ -0,0 +1,20 @@ +--- ../openresty-lua-nginx-module-4388b1e/src/ngx_http_lua_socket_udp.c.orig 2015-04-21 21:18:31.080702000 +0300 ++++ ../openresty-lua-nginx-module-4388b1e/src/ngx_http_lua_socket_udp.c 2015-04-21 21:18:47.449758000 +0300 +@@ -1400,17 +1400,6 @@ + + c->number = ngx_atomic_fetch_add(ngx_connection_counter, 1); + +-#if (NGX_THREADS) +- +- /* TODO: lock event when call completion handler */ +- +- rev->lock = &c->lock; +- wev->lock = &c->lock; +- rev->own_lock = &c->lock; +- wev->own_lock = &c->lock; +- +-#endif +- + #if (NGX_HTTP_LUA_HAVE_SO_PASSCRED) + if (uc->sockaddr->sa_family == AF_UNIX) { + struct sockaddr addr; diff --git a/www/nginx/files/extra-patch-ngx_http_mogilefs_module.c b/www/nginx/files/extra-patch-ngx_http_mogilefs_module.c new file mode 100644 index 000000000000..423483869d57 --- /dev/null +++ b/www/nginx/files/extra-patch-ngx_http_mogilefs_module.c @@ -0,0 +1,12 @@ +--- ../nginx_mogilefs_module-1.0.4/ngx_http_mogilefs_module.c.orig 2015-04-21 21:16:22.251692000 +0300 ++++ ../nginx_mogilefs_module-1.0.4/ngx_http_mogilefs_module.c 2015-04-21 21:16:39.460724000 +0300 +@@ -316,9 +316,6 @@ + + u->peer.log = r->connection->log; + u->peer.log_error = NGX_ERROR_ERR; +-#if (NGX_THREADS) +- u->peer.lock = &r->connection->lock; +-#endif + + u->output.tag = (ngx_buf_tag_t) &ngx_http_mogilefs_module; + diff --git a/www/nginx/files/extra-patch-ngx_http_sflow_module.c b/www/nginx/files/extra-patch-ngx_http_sflow_module.c new file mode 100644 index 000000000000..39b9bb3c11df --- /dev/null +++ b/www/nginx/files/extra-patch-ngx_http_sflow_module.c @@ -0,0 +1,60 @@ +--- ../nginx-sflow-module-0.9.7/ngx_http_sflow_module.c.orig 2015-04-21 21:21:17.020547000 +0300 ++++ ../nginx-sflow-module-0.9.7/ngx_http_sflow_module.c 2015-04-21 21:22:26.994714000 +0300 +@@ -8,10 +8,6 @@ + #include <ngx_http.h> + #include <nginx.h> + +-#if (NGX_THREADS) +-#include <ngx_thread.h> +-#endif +- + #include "ngx_http_sflow_api.h" + #include "ngx_http_sflow_config.h" + +@@ -42,18 +38,10 @@ + /* keep log ptr for callbacks */ + ngx_log_t *log; + +-#if (NGX_THREADS) +- ngx_mutex_t *mut; +-#define SFWB_LOCK(_s) ngx_mutex_lock((_s)->mut) +-#define SFWB_UNLOCK(_s) ngx_mutex_unlock((_s)->mut) +-#define SFWB_INC_CTR(_c) ngx_atomic_fetch_add(&(_c), 1) +-#define SFWB_COUNTDOWN(_c) (ngx_atomic_fetch_add(&(_c), -1) == 1) +-#else + #define SFWB_LOCK(_s) /* no-op */ + #define SFWB_UNLOCK(_s) /* no-op */ + #define SFWB_INC_CTR(_c) (_c)++ + #define SFWB_COUNTDOWN(_c) (--(_c) == 0) +-#endif + + /* delegate acquiring the sflow config */ + SFWBConfigManager *config_manager; +@@ -411,13 +399,8 @@ + static int32_t ngx_http_sflow_add_random_skip(SFWB *sm) + { + ngx_atomic_t next_skip = sfl_sampler_next_skip(sm->sampler); +-#if (NGX_THREADS) +- ngx_atomic_int_t test_skip = ngx_atomic_fetch_add(&sm->sflow_skip, next_skip); +- return (test_skip + next_skip); +-#else + sm->sflow_skip = next_skip; + return next_skip; +-#endif + } + + /*_________________---------------------------__________________ +@@ -528,13 +511,6 @@ + /* a pool to use for the agent so we can recycle the memory easily on a config change */ + sm->masterPool = ngx_create_pool(SFWB_POOL_SIZ, cf->log); + +-#if (NGX_THREADS) +- /* a mutex to lock the sFlow agent when taking a sample (only needed if there +- is more that one worker thread - right now it seems like threads are not even +- an option in the configure script) */ +- sm->mut = ngx_mutex_init(cf->log, 0); +-#endif +- + /* create and initialze the config_manager */ + sm->config_manager = ngx_pcalloc(cf->pool, sizeof(SFWBConfigManager)); + sfwb_config_init(sm->config_manager, cf->log); diff --git a/www/nginx/files/extra-patch-ngx_http_upstream.h b/www/nginx/files/extra-patch-ngx_http_upstream.h deleted file mode 100644 index f4c1f7ada782..000000000000 --- a/www/nginx/files/extra-patch-ngx_http_upstream.h +++ /dev/null @@ -1,13 +0,0 @@ ---- src/http/ngx_http_upstream.h.orig 2010-01-14 04:20:57.000000000 +0300 -+++ src/http/ngx_http_upstream.h 2010-01-14 04:22:00.000000000 +0300 -@@ -105,6 +105,10 @@ - - ngx_array_t *servers; /* ngx_http_upstream_server_t */ - -+ ngx_array_t *values; -+ ngx_array_t *lengths; -+ ngx_uint_t retries; -+ - ngx_uint_t flags; - ngx_str_t host; - u_char *file_name; diff --git a/www/nginx/files/extra-patch-syslog_support b/www/nginx/files/extra-patch-syslog_support deleted file mode 100644 index 2a2ff607ff68..000000000000 --- a/www/nginx/files/extra-patch-syslog_support +++ /dev/null @@ -1,762 +0,0 @@ -diff --git src/core/ngx_cycle.c src/core/ngx_cycle.c -index dc4dc89..46c4b4f 100644 ---- src/core/ngx_cycle.c -+++ src/core/ngx_cycle.c -@@ -85,6 +85,12 @@ ngx_init_cycle(ngx_cycle_t *old_cycle) - cycle->pool = pool; - cycle->log = log; - cycle->new_log.log_level = NGX_LOG_ERR; -+#if (NGX_ENABLE_SYSLOG) -+ cycle->new_log.facility = SYSLOG_FACILITY; -+ cycle->new_log.facility = ERR_SYSLOG_PRIORITY; -+ cycle->new_log.syslog_on = 0; -+ cycle->new_log.syslog_set = 0; -+#endif - cycle->old_cycle = old_cycle; - - cycle->conf_prefix.len = old_cycle->conf_prefix.len; -diff --git src/core/ngx_log.c src/core/ngx_log.c -index d7830fb..982c2ed 100644 ---- src/core/ngx_log.c -+++ src/core/ngx_log.c -@@ -10,6 +10,15 @@ - - - static char *ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -+#if (NGX_ENABLE_SYSLOG) -+static char *ngx_set_syslog(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -+void log_exit(ngx_cycle_t *cycle); -+ -+typedef struct{ -+ ngx_str_t name; -+ ngx_int_t macro; -+} ngx_string_to_macro_t; -+#endif - - - static ngx_command_t ngx_errlog_commands[] = { -@@ -21,6 +30,15 @@ static ngx_command_t ngx_errlog_commands[] = { - 0, - NULL}, - -+#if (NGX_ENABLE_SYSLOG) -+ {ngx_string("syslog"), -+ NGX_MAIN_CONF|NGX_CONF_TAKE12, -+ ngx_set_syslog, -+ 0, -+ 0, -+ NULL}, -+#endif -+ - ngx_null_command - }; - -@@ -43,7 +61,11 @@ ngx_module_t ngx_errlog_module = { - NULL, /* init thread */ - NULL, /* exit thread */ - NULL, /* exit process */ -- NULL, /* exit master */ -+#if (NGX_ENABLE_SYSLOG) -+ log_exit, /* exit master */ -+#else -+ NULL, -+#endif - NGX_MODULE_V1_PADDING - }; - -@@ -52,6 +74,48 @@ static ngx_log_t ngx_log; - static ngx_open_file_t ngx_log_file; - ngx_uint_t ngx_use_stderr = 1; - -+#if (NGX_ENABLE_SYSLOG) -+static ngx_string_to_macro_t ngx_syslog_facilities[] = { -+ {ngx_string("auth"), LOG_AUTH}, -+#if !(NGX_SOLARIS) -+ {ngx_string("authpriv"), LOG_AUTHPRIV}, -+#endif -+ {ngx_string("cron"), LOG_CRON}, -+ {ngx_string("daemon"), LOG_DAEMON}, -+#if !(NGX_SOLARIS) -+ {ngx_string("ftp"), LOG_FTP}, -+#endif -+ {ngx_string("kern"), LOG_KERN}, -+ {ngx_string("local0"), LOG_LOCAL0}, -+ {ngx_string("local1"), LOG_LOCAL1}, -+ {ngx_string("local2"), LOG_LOCAL2}, -+ {ngx_string("local3"), LOG_LOCAL3}, -+ {ngx_string("local4"), LOG_LOCAL4}, -+ {ngx_string("local5"), LOG_LOCAL5}, -+ {ngx_string("local6"), LOG_LOCAL6}, -+ {ngx_string("local7"), LOG_LOCAL7}, -+ {ngx_string("lpr"), LOG_LPR}, -+ {ngx_string("mail"), LOG_MAIL}, -+ {ngx_string("news"), LOG_NEWS}, -+ {ngx_string("syslog"), LOG_SYSLOG}, -+ {ngx_string("user"), LOG_USER}, -+ {ngx_string("uucp"), LOG_UUCP}, -+ { ngx_null_string, 0} -+}; -+ -+static ngx_string_to_macro_t ngx_syslog_priorities[] = { -+ {ngx_string("emerg"), LOG_EMERG}, -+ {ngx_string("alert"), LOG_ALERT}, -+ {ngx_string("crit"), LOG_CRIT}, -+ {ngx_string("error"), LOG_ERR}, -+ {ngx_string("err"), LOG_ERR}, -+ {ngx_string("warn"), LOG_WARNING}, -+ {ngx_string("notice"),LOG_NOTICE}, -+ {ngx_string("info"), LOG_INFO}, -+ {ngx_string("debug"), LOG_DEBUG}, -+ { ngx_null_string, 0} -+}; -+#endif - - static ngx_str_t err_levels[] = { - ngx_null_string, -@@ -89,11 +153,16 @@ ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, - va_list args; - #endif - u_char *p, *last, *msg; -+#if (NGX_ENABLE_SYSLOG) -+ u_char *errstr_syslog; -+#endif - u_char errstr[NGX_MAX_ERROR_STR]; - -+#if !(NGX_ENABLE_SYSLOG) - if (log->file->fd == NGX_INVALID_FILE) { - return; - } -+#endif - - last = errstr + NGX_MAX_ERROR_STR; - -@@ -102,6 +171,10 @@ ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, - - p = errstr + ngx_cached_err_log_time.len; - -+#if (NGX_ENABLE_SYSLOG) -+ errstr_syslog = p; -+#endif -+ - p = ngx_slprintf(p, last, " [%V] ", &err_levels[level]); - - /* pid#tid */ -@@ -140,11 +213,27 @@ ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, - - ngx_linefeed(p); - -+#if (NGX_ENABLE_SYSLOG) -+ if (log->file != NULL && log->file->name.len != 0) { - (void) ngx_write_fd(log->file->fd, errstr, p - errstr); -+ } -+ -+ /* Don't send the debug level info to syslog */ -+ if (log->syslog_on && level < NGX_LOG_DEBUG) { -+ /* write to syslog */ -+ syslog(log->priority, "%.*s", (int)(p - errstr_syslog), errstr_syslog); -+ } -+#else -+ (void) ngx_write_fd(log->file->fd, errstr, p - errstr); -+#endif - - if (!ngx_use_stderr - || level > NGX_LOG_WARN -+#if (NGX_ENABLE_SYSLOG) -+ || (log->file != NULL && log->file->fd == ngx_stderr)) -+#else - || log->file->fd == ngx_stderr) -+#endif - { - return; - } -@@ -367,6 +456,50 @@ ngx_log_create(ngx_cycle_t *cycle, ngx_str_t *name) - } - - -+#if (NGX_ENABLE_SYSLOG) -+ngx_int_t -+ngx_log_get_priority(ngx_conf_t *cf, ngx_str_t *priority) -+{ -+ ngx_int_t p = 0; -+ ngx_uint_t n, match = 0; -+ -+ for (n = 0; ngx_syslog_priorities[n].name.len != 0; n++) { -+ if (ngx_strncmp(priority->data, ngx_syslog_priorities[n].name.data, -+ ngx_syslog_priorities[n].name.len) == 0) { -+ p = ngx_syslog_priorities[n].macro; -+ match = 1; -+ } -+ } -+ -+ if (!match) { -+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, -+ "invalid syslog priority \"%V\"", priority); -+ return -1; -+ } -+ -+ return p; -+} -+ -+ -+char * -+ngx_log_set_priority(ngx_conf_t *cf, ngx_str_t *priority, ngx_log_t *log) -+{ -+ log->priority = ERR_SYSLOG_PRIORITY; -+ -+ if (priority->len == 0) { -+ return NGX_CONF_OK; -+ } -+ -+ log->priority = ngx_log_get_priority(cf, priority); -+ if (log->priority == (-1)) { -+ return NGX_CONF_ERROR; -+ } -+ -+ return NGX_CONF_OK; -+} -+#endif -+ -+ - char * - ngx_log_set_levels(ngx_conf_t *cf, ngx_log_t *log) - { -@@ -429,6 +562,13 @@ static char * - ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) - { - ngx_str_t *value, name; -+#if (NGX_ENABLE_SYSLOG) -+ u_char *off = NULL; -+ ngx_str_t priority; -+ -+ ngx_str_null(&name); -+ ngx_str_null(&priority); -+#endif - - if (cf->cycle->new_log.file) { - return "is duplicate"; -@@ -436,7 +576,44 @@ ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) - - value = cf->args->elts; - -+#if (NGX_ENABLE_SYSLOG) -+ if (ngx_strncmp(value[1].data, "syslog", sizeof("syslog") - 1) == 0) { -+ if (!cf->cycle->new_log.syslog_set) { -+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, -+ "You must set the syslog directive and enable it first."); -+ return NGX_CONF_ERROR; -+ } -+ -+ cf->cycle->new_log.syslog_on = 1; -+ -+ if (value[1].data[sizeof("syslog") - 1] == ':') { -+ priority.len = value[1].len - sizeof("syslog"); -+ priority.data = value[1].data + sizeof("syslog"); -+ -+ off = (u_char *)ngx_strchr(priority.data, (int) '|'); -+ if (off != NULL) { -+ priority.len = off - priority.data; -+ -+ off++; -+ name.len = value[1].data + value[1].len - off; -+ name.data = off; -+ } -+ } -+ else { -+ if (value[1].len > sizeof("syslog")) { -+ name.len = value[1].len - sizeof("syslog"); -+ name.data = value[1].data + sizeof("syslog"); -+ } -+ } -+ -+ if (ngx_log_set_priority(cf, &priority, &cf->cycle->new_log) == NGX_CONF_ERROR) { -+ return NGX_CONF_ERROR; -+ } -+ } -+ else if (ngx_strcmp(value[1].data, "stderr") == 0) { -+#else - if (ngx_strcmp(value[1].data, "stderr") == 0) { -+#endif - ngx_str_null(&name); - - } else { -@@ -457,3 +634,63 @@ ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) - - return ngx_log_set_levels(cf, &cf->cycle->new_log); - } -+ -+ -+#if (NGX_ENABLE_SYSLOG) -+ -+#define SYSLOG_IDENT_NAME "nginx" -+ -+static char * -+ngx_set_syslog(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) -+{ -+ char *program; -+ ngx_str_t *value; -+ ngx_int_t facility, match = 0; -+ ngx_uint_t n; -+ -+ value = cf->args->elts; -+ -+ if (cf->cycle->new_log.syslog_set) { -+ return "is duplicate"; -+ } -+ -+ cf->cycle->new_log.syslog_set = 1; -+ -+ for (n = 0; ngx_syslog_facilities[n].name.len != 0; n++) { -+ if (ngx_strncmp(value[1].data, ngx_syslog_facilities[n].name.data, -+ ngx_syslog_facilities[n].name.len) == 0) { -+ facility = ngx_syslog_facilities[n].macro; -+ match = 1; -+ break; -+ } -+ } -+ -+ if (match) { -+ cf->cycle->new_log.facility = facility; -+ cf->cycle->new_log.priority = ERR_SYSLOG_PRIORITY; -+ } -+ else { -+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, -+ "invalid syslog facility \"%V\"", &value[1]); -+ return NGX_CONF_ERROR; -+ } -+ -+ program = SYSLOG_IDENT_NAME; -+ if (cf->args->nelts > 2) { -+ program = (char *) value[2].data; -+ } -+ -+ openlog(program, LOG_ODELAY, facility); -+ -+ return NGX_CONF_OK; -+} -+ -+ -+void log_exit(ngx_cycle_t *cycle) -+{ -+ if (cycle->new_log.syslog_set) { -+ closelog(); -+ } -+} -+#endif -+ -diff --git src/core/ngx_log.h src/core/ngx_log.h -index 3233647..5e7fdbf 100644 ---- src/core/ngx_log.h -+++ src/core/ngx_log.h -@@ -12,6 +12,15 @@ - #include <ngx_config.h> - #include <ngx_core.h> - -+#if (NGX_ENABLE_SYSLOG) -+#include <syslog.h> -+ -+#ifndef SYSLOG_FACILITY -+#define SYSLOG_FACILITY LOG_LOCAL5 -+#endif -+#define ERR_SYSLOG_PRIORITY LOG_ERR -+#endif -+ - - #define NGX_LOG_STDERR 0 - #define NGX_LOG_EMERG 1 -@@ -61,6 +68,13 @@ struct ngx_log_s { - */ - - char *action; -+ -+#if (NGX_ENABLE_SYSLOG) -+ ngx_int_t priority; -+ ngx_int_t facility; -+ unsigned syslog_on:1; /* unsigned :1 syslog_on */ -+ unsigned syslog_set:1; /*unsigned :1 syslog_set */ -+#endif - }; - - -@@ -221,6 +235,10 @@ void ngx_cdecl ngx_log_debug_core(ngx_log_t *log, ngx_err_t err, - - ngx_log_t *ngx_log_init(u_char *prefix); - ngx_log_t *ngx_log_create(ngx_cycle_t *cycle, ngx_str_t *name); -+#if (NGX_ENABLE_SYSLOG) -+ngx_int_t ngx_log_get_priority(ngx_conf_t *cf, ngx_str_t *priority); -+char * ngx_log_set_priority(ngx_conf_t *cf, ngx_str_t *priority, ngx_log_t *log); -+#endif - char *ngx_log_set_levels(ngx_conf_t *cf, ngx_log_t *log); - void ngx_cdecl ngx_log_abort(ngx_err_t err, const char *fmt, ...); - void ngx_cdecl ngx_log_stderr(ngx_err_t err, const char *fmt, ...); -diff --git src/http/modules/ngx_http_log_module.c src/http/modules/ngx_http_log_module.c -index aa6a3fc..deceb38 100644 ---- src/http/modules/ngx_http_log_module.c -+++ src/http/modules/ngx_http_log_module.c -@@ -13,6 +13,11 @@ - #include <zlib.h> - #endif - -+#if (NGX_ENABLE_SYSLOG) -+#include <syslog.h> -+ -+#define HTTP_SYSLOG_PRIORITY LOG_NOTICE -+#endif - - typedef struct ngx_http_log_op_s ngx_http_log_op_t; - -@@ -67,6 +72,11 @@ typedef struct { - time_t disk_full_time; - time_t error_log_time; - ngx_http_log_fmt_t *format; -+ -+#if (NGX_ENABLE_SYSLOG) -+ ngx_int_t priority; -+ unsigned syslog_on:1; /* unsigned :1 syslog_on */ -+#endif - } ngx_http_log_t; - - -@@ -348,6 +358,14 @@ ngx_http_log_write(ngx_http_request_t *r, ngx_http_log_t *log, u_char *buf, - time_t now; - ssize_t n; - ngx_err_t err; -+ -+#if (NGX_ENABLE_SYSLOG) -+ n = 0; -+ if (log->syslog_on) { -+ syslog(log->priority, "%.*s", (int)len, buf); -+ } -+#endif -+ - #if (NGX_ZLIB) - ngx_http_log_buf_t *buffer; - #endif -@@ -355,6 +373,9 @@ ngx_http_log_write(ngx_http_request_t *r, ngx_http_log_t *log, u_char *buf, - if (log->script == NULL) { - name = log->file->name.data; - -+#if (NGX_ENABLE_SYSLOG) -+ if (name != NULL) { -+#endif - #if (NGX_ZLIB) - buffer = log->file->data; - -@@ -367,7 +388,11 @@ ngx_http_log_write(ngx_http_request_t *r, ngx_http_log_t *log, u_char *buf, - #else - n = ngx_write_fd(log->file->fd, buf, len); - #endif -- -+#if (NGX_ENABLE_SYSLOG) -+ } else { -+ n = len; -+ } -+#endif - } else { - name = NULL; - n = ngx_http_log_script_write(r, log->script, &name, buf, len); -@@ -1068,6 +1093,10 @@ ngx_http_log_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) - log->script = NULL; - log->disk_full_time = 0; - log->error_log_time = 0; -+#if (NGX_ENABLE_SYSLOG) -+ log->priority = HTTP_SYSLOG_PRIORITY; -+ log->syslog_on = 0; -+#endif - - lmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_log_module); - fmt = lmcf->formats.elts; -@@ -1096,6 +1125,13 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) - ngx_http_log_main_conf_t *lmcf; - ngx_http_script_compile_t sc; - -+#if (NGX_ENABLE_SYSLOG) -+ u_char *off; -+ ngx_str_t priority; -+ ngx_uint_t syslog_on = 0; -+ name = priority = (ngx_str_t)ngx_null_string; -+#endif -+ - value = cf->args->elts; - - if (ngx_strcmp(value[1].data, "off") == 0) { -@@ -1108,6 +1144,38 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) - "invalid parameter \"%V\"", &value[2]); - return NGX_CONF_ERROR; - } -+#if (NGX_ENABLE_SYSLOG) -+ else if (ngx_strncmp(value[1].data, "syslog", sizeof("syslog") - 1) == 0) { -+ if (!cf->cycle->new_log.syslog_set) { -+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, -+ "You must set the syslog directive and enable it first."); -+ return NGX_CONF_ERROR; -+ } -+ -+ syslog_on = 1; -+ if (value[1].data[sizeof("syslog") - 1] == ':') { -+ priority.len = value[1].len - sizeof("syslog"); -+ priority.data = value[1].data + sizeof("syslog"); -+ -+ off = (u_char*) ngx_strchr(priority.data, '|'); -+ if (off != NULL) { -+ priority.len = off - priority.data; -+ -+ off++; -+ name.len = value[1].data + value[1].len - off; -+ name.data = off; -+ } -+ } -+ else { -+ if (value[1].len > sizeof("syslog")) { -+ name.len = value[1].len - sizeof("syslog"); -+ name.data = value[1].data + sizeof("syslog"); -+ } -+ } -+ } else { -+ name = value[1]; -+ } -+#endif - - if (llcf->logs == NULL) { - llcf->logs = ngx_array_create(cf->pool, 2, sizeof(ngx_http_log_t)); -@@ -1125,6 +1193,52 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) - - ngx_memzero(log, sizeof(ngx_http_log_t)); - -+#if (NGX_ENABLE_SYSLOG) -+ log->syslog_on = syslog_on; -+ -+ if (priority.len == 0) { -+ log->priority = HTTP_SYSLOG_PRIORITY; -+ } -+ else { -+ log->priority = ngx_log_get_priority(cf, &priority); -+ } -+ -+ if (name.len != 0) { -+ n = ngx_http_script_variables_count(&name); -+ -+ if (n == 0) { -+ log->file = ngx_conf_open_file(cf->cycle, &name); -+ if (log->file == NULL) { -+ return NGX_CONF_ERROR; -+ } -+ } else { -+ if (ngx_conf_full_name(cf->cycle, &name, 0) != NGX_OK) { -+ return NGX_CONF_ERROR; -+ } -+ log->script = ngx_pcalloc(cf->pool, sizeof(ngx_http_log_script_t)); -+ if (log->script == NULL) { -+ return NGX_CONF_ERROR; -+ } -+ ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); -+ sc.cf = cf; -+ sc.source = &name; -+ sc.lengths = &log->script->lengths; -+ sc.values = &log->script->values; -+ sc.variables = n; -+ sc.complete_lengths = 1; -+ sc.complete_values = 1; -+ if (ngx_http_script_compile(&sc) != NGX_OK) { -+ return NGX_CONF_ERROR; -+ } -+ } -+ } -+ else { -+ log->file = ngx_conf_open_file(cf->cycle, &name); -+ if (log->file == NULL) { -+ return NGX_CONF_ERROR; -+ } -+ } -+#else - n = ngx_http_script_variables_count(&value[1]); - - if (n == 0) { -@@ -1157,6 +1271,7 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) - return NGX_CONF_ERROR; - } - } -+#endif - - 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 c491499..4f039eb 100644 ---- src/http/ngx_http_core_module.c -+++ src/http/ngx_http_core_module.c -@@ -1462,6 +1462,9 @@ ngx_http_update_location_config(ngx_http_request_t *r) - - if (r == r->main) { - ngx_http_set_connection_log(r->connection, clcf->error_log); -+#if (NGX_ENABLE_SYSLOG) -+ r->connection->log->priority = clcf->error_log->priority; -+#endif - } - - 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; - -+#if (NGX_ENABLE_SYSLOG) -+ u_char *off = NULL; -+ ngx_int_t syslog_on = 0; -+ ngx_str_t priority; -+ -+ name = priority = (ngx_str_t) ngx_null_string; -+#endif -+ -+ - if (clcf->error_log) { - return "is duplicate"; - } -@@ -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); - -+#if (NGX_ENABLE_SYSLOG) -+ } else if (ngx_strncmp(value[1].data, "syslog", sizeof("syslog") - 1) == 0) { -+ if (!cf->cycle->new_log.syslog_set) { -+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, -+ "You must set the syslog directive and enable it first."); -+ return NGX_CONF_ERROR; -+ } -+ -+ syslog_on = 1; -+ -+ if (value[1].data[sizeof("syslog") - 1] == ':') { -+ priority.len = value[1].len - sizeof("syslog"); -+ priority.data = value[1].data + sizeof("syslog"); -+ -+ off = (u_char*) ngx_strchr(priority.data, '|'); -+ if (off != NULL) { -+ priority.len = off - priority.data; -+ -+ off++; -+ name.len = value[1].data + value[1].len - off; -+ name.data = off; -+ } -+ } -+ else { -+ if (value[1].len > sizeof("syslog")) { -+ name.len = value[1].len - sizeof("syslog"); -+ name.data = value[1].data + sizeof("syslog"); -+ } -+ } -+#endif - } else { - name = value[1]; - } -@@ -4885,6 +4927,17 @@ ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) - return NGX_CONF_ERROR; - } - -+#if (NGX_ENABLE_SYSLOG) -+ if (syslog_on) { -+ clcf->error_log->syslog_on = 1; -+ if (ngx_log_set_priority(cf, &priority, clcf->error_log) == NGX_CONF_ERROR) { -+ return NGX_CONF_ERROR; -+ } -+ } -+ -+ clcf->error_log->log_level = 0; -+#endif -+ - if (cf->args->nelts == 2) { - 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 54e1c26..2b05157 100644 ---- src/http/ngx_http_request.c -+++ src/http/ngx_http_request.c -@@ -424,6 +424,9 @@ ngx_http_init_request(ngx_event_t *rev) - clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); - - 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 - - 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); - - ngx_http_set_connection_log(r->connection, clcf->error_log); -+#if (NGX_ENABLE_SYSLOG) -+ r->connection->log->priority = clcf->error_log->priority; -+#endif - - 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 @@ - *) echo " + using libatomic_ops library: $NGX_LIBATOMIC" ;; - esac - -+case $USE_SYSLOG in -+ YES) echo " + using syslog with $SYSLOG_FACILITY facility" ;; -+ *) echo " + syslog is not used" ;; -+esac -+ - echo - - ---- auto/make.orig 2009-05-12 17:15:43.000000000 +0400 -+++ auto/make 2010-12-08 12:32:25.000000000 +0300 -@@ -15,6 +15,13 @@ - ngx_objs_dir=$NGX_OBJS$ngx_regex_dirsep - ngx_use_pch=`echo $NGX_USE_PCH | sed -e "s/\//$ngx_regex_dirsep/g"` - -+#SYSLOG -+if test -z "${SYSLOG_FACILITY}"; then -+ SYSLOG_FACILITY="LOG_DAEMON" -+fi -+if test "${USE_SYSLOG}" = "YES"; then -+ CFLAGS="$CFLAGS -DNGX_ENABLE_SYSLOG -DSYSLOG_FACILITY=${SYSLOG_FACILITY}" -+fi - - cat << END > $NGX_MAKEFILE - ---- 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 - -+USE_SYSLOG=NO -+ - USE_SHA1=NO - SHA1=NONE - SHA1_OPT= -@@ -274,6 +276,9 @@ - --with-md5-opt=*) MD5_OPT="$value" ;; - --with-md5-asm) MD5_ASM=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 ;; -@@ -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 options for sha1 building - --with-sha1-asm use sha1 assembler sources - |