[nginx] Stream: additional logging for UDP.
details: http://hg.nginx.org/nginx/rev/a01e315b3a78 branches: changeset: 6461:a01e315b3a78 user: Vladimir Homutov date: Fri Mar 18 19:53:22 2016 +0300 description: Stream: additional logging for UDP. diffstat: src/stream/ngx_stream_handler.c | 8 +--- src/stream/ngx_stream_proxy_module.c | 7 +-- 2 files changed, 10 insertions(+), 5 deletions(-) diffs (51 lines): diff -r 034329824dd3 -r a01e315b3a78 src/stream/ngx_stream_handler.c --- a/src/stream/ngx_stream_handler.c Wed Mar 23 18:34:05 2016 +0300 +++ b/src/stream/ngx_stream_handler.c Fri Mar 18 19:53:22 2016 +0300 @@ -137,8 +137,9 @@ ngx_stream_init_connection(ngx_connectio len = ngx_sock_ntop(c->sockaddr, c->socklen, text, NGX_SOCKADDR_STRLEN, 1); -ngx_log_error(NGX_LOG_INFO, c->log, 0, "*%uA client %*s connected to %V", - c->number, len, text, &addr_conf->addr_text); +ngx_log_error(NGX_LOG_INFO, c->log, 0, "*%uA %sclient %*s connected to %V", + c->number, c->type == SOCK_DGRAM ? "udp " : "", + len, text, &addr_conf->addr_text); c->log->connection = c->number; c->log->handler = ngx_stream_log_error; @@ -328,7 +329,8 @@ ngx_stream_log_error(ngx_log_t *log, u_c s = log->data; -p = ngx_snprintf(buf, len, ", client: %V, server: %V", +p = ngx_snprintf(buf, len, ", %sclient: %V, server: %V", + s->connection->type == SOCK_DGRAM ? "udp " : "", &s->connection->addr_text, &s->connection->listening->addr_text); len -= p - buf; diff -r 034329824dd3 -r a01e315b3a78 src/stream/ngx_stream_proxy_module.c --- a/src/stream/ngx_stream_proxy_module.c Wed Mar 23 18:34:05 2016 +0300 +++ b/src/stream/ngx_stream_proxy_module.c Fri Mar 18 19:53:22 2016 +0300 @@ -552,7 +552,9 @@ ngx_stream_proxy_init_upstream(ngx_strea handler = c->log->handler; c->log->handler = NULL; -ngx_log_error(NGX_LOG_INFO, c->log, 0, "proxy %V connected to %V", +ngx_log_error(NGX_LOG_INFO, c->log, 0, + "%sproxy %V connected to %V", + pc->type == SOCK_DGRAM ? "udp " : "", &str, u->peer.name); c->log->handler = handler; @@ -1222,9 +1224,10 @@ ngx_stream_proxy_process(ngx_stream_sess c->log->handler = NULL; ngx_log_error(NGX_LOG_INFO, c->log, 0, - "%s disconnected" + "%s%s disconnected" ", bytes from/to client:%O/%O" ", bytes from/to upstream:%O/%O", + src->type == SOCK_DGRAM ? "udp " : "", from_upstream ? "upstream" : "client", s->received, c->sent, u->received, pc ? pc->sent : 0); ___ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel
[PATCH]Translation to ja(LICENSE & README)
Hi, Dounin Thank you for your response. I understand it. >There are various other languages, see here: > >http://hg.nginx.org/nginx.org/file/tip/xml > >Though all except English and Russian are stale and was deactivated. > >-- >Maxim Dounin >http://nginx.org/> Best Regards, Takahiro Kujirai ___ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel
[nginx] Win32: fixed build after 384154fc634f.
details: http://hg.nginx.org/nginx/rev/034329824dd3 branches: changeset: 6460:034329824dd3 user: Dmitry Volyntsev date: Wed Mar 23 18:34:05 2016 +0300 description: Win32: fixed build after 384154fc634f. diffstat: src/core/ngx_resolver.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diffs (22 lines): diff -r 78fc2dce69e7 -r 034329824dd3 src/core/ngx_resolver.c --- a/src/core/ngx_resolver.c Wed Mar 23 17:45:15 2016 +0300 +++ b/src/core/ngx_resolver.c Wed Mar 23 18:34:05 2016 +0300 @@ -2758,7 +2758,7 @@ ngx_resolver_process_srv(ngx_resolver_t } rn->u.srvs = srvs; -rn->nsrvs = nsrvs; +rn->nsrvs = (u_short) nsrvs; j = 0; i = ans; @@ -4243,8 +4243,7 @@ ngx_resolver_export(ngx_resolver_t *r, n static void ngx_resolver_report_srv(ngx_resolver_t *r, ngx_resolver_ctx_t *ctx) { -u_short nsrvs; -ngx_uint_tnaddrs, nw, i, j, k, l, m, n, w; +ngx_uint_tnaddrs, nsrvs, nw, i, j, k, l, m, n, w; ngx_resolver_addr_t *addrs; ngx_resolver_srv_name_t *srvs; ___ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel
[nginx] Stream: detect port absence in proxy_pass with IP literal.
details: http://hg.nginx.org/nginx/rev/78fc2dce69e7 branches: changeset: 6459:78fc2dce69e7 user: Roman Arutyunyan date: Wed Mar 23 17:45:15 2016 +0300 description: Stream: detect port absence in proxy_pass with IP literal. This is a clone of http commit 26c127bab5ef. diffstat: src/stream/ngx_stream_upstream.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 384154fc634f -r 78fc2dce69e7 src/stream/ngx_stream_upstream.c --- a/src/stream/ngx_stream_upstream.c Wed Mar 23 17:44:36 2016 +0300 +++ b/src/stream/ngx_stream_upstream.c Wed Mar 23 17:45:15 2016 +0300 @@ -388,7 +388,7 @@ ngx_stream_upstream_add(ngx_conf_t *cf, uscf->port = u->port; uscf->no_port = u->no_port; -if (u->naddrs == 1) { +if (u->naddrs == 1 && (u->port || u->family == AF_UNIX)) { uscf->servers = ngx_array_create(cf->pool, 1, sizeof(ngx_stream_upstream_server_t)); if (uscf->servers == NULL) { ___ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel
[nginx] Resolver: do not enable resolve timer if provided timeout is zero.
details: http://hg.nginx.org/nginx/rev/a6711b85da83 branches: changeset: 6457:a6711b85da83 user: Dmitry Volyntsev date: Wed Mar 23 17:44:36 2016 +0300 description: Resolver: do not enable resolve timer if provided timeout is zero. diffstat: src/core/ngx_resolver.c | 48 ++-- 1 files changed, 26 insertions(+), 22 deletions(-) diffs (83 lines): diff -r c94aba230a5a -r a6711b85da83 src/core/ngx_resolver.c --- a/src/core/ngx_resolver.c Wed Mar 23 17:44:36 2016 +0300 +++ b/src/core/ngx_resolver.c Wed Mar 23 17:44:36 2016 +0300 @@ -611,7 +611,7 @@ ngx_resolve_name_locked(ngx_resolver_t * if (rn->waiting) { -if (ctx->event == NULL) { +if (ctx->event == NULL && ctx->timeout) { ctx->event = ngx_resolver_calloc(r, sizeof(ngx_event_t)); if (ctx->event == NULL) { return NGX_ERROR; @@ -729,7 +729,7 @@ ngx_resolve_name_locked(ngx_resolver_t * goto failed; } -if (ctx->event == NULL) { +if (ctx->event == NULL && ctx->timeout) { ctx->event = ngx_resolver_calloc(r, sizeof(ngx_event_t)); if (ctx->event == NULL) { goto failed; @@ -872,18 +872,20 @@ ngx_resolve_addr(ngx_resolver_ctx_t *ctx if (rn->waiting) { -ctx->event = ngx_resolver_calloc(r, sizeof(ngx_event_t)); -if (ctx->event == NULL) { -return NGX_ERROR; +if (ctx->event == NULL && ctx->timeout) { +ctx->event = ngx_resolver_calloc(r, sizeof(ngx_event_t)); +if (ctx->event == NULL) { +return NGX_ERROR; +} + +ctx->event->handler = ngx_resolver_timeout_handler; +ctx->event->data = ctx; +ctx->event->log = r->log; +ctx->ident = -1; + +ngx_add_timer(ctx->event, ctx->timeout); } -ctx->event->handler = ngx_resolver_timeout_handler; -ctx->event->data = ctx; -ctx->event->log = r->log; -ctx->ident = -1; - -ngx_add_timer(ctx->event, ctx->timeout); - ctx->next = rn->waiting; rn->waiting = ctx; ctx->state = NGX_AGAIN; @@ -949,18 +951,20 @@ ngx_resolve_addr(ngx_resolver_ctx_t *ctx goto failed; } -ctx->event = ngx_resolver_calloc(r, sizeof(ngx_event_t)); -if (ctx->event == NULL) { -goto failed; +if (ctx->event == NULL && ctx->timeout) { +ctx->event = ngx_resolver_calloc(r, sizeof(ngx_event_t)); +if (ctx->event == NULL) { +goto failed; +} + +ctx->event->handler = ngx_resolver_timeout_handler; +ctx->event->data = ctx; +ctx->event->log = r->log; +ctx->ident = -1; + +ngx_add_timer(ctx->event, ctx->timeout); } -ctx->event->handler = ngx_resolver_timeout_handler; -ctx->event->data = ctx; -ctx->event->log = r->log; -ctx->ident = -1; - -ngx_add_timer(ctx->event, ctx->timeout); - if (ngx_queue_empty(resend_queue)) { ngx_add_timer(r->event, (ngx_msec_t) (r->resend_timeout * 1000)); } ___ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel
[nginx] Resolver: introduced valid field in resolver responses.
details: http://hg.nginx.org/nginx/rev/c94aba230a5a branches: changeset: 6456:c94aba230a5a user: Dmitry Volyntsev date: Wed Mar 23 17:44:36 2016 +0300 description: Resolver: introduced valid field in resolver responses. It hints the amount of time a response could be considered as valid. diffstat: src/core/ngx_resolver.c | 7 +++ src/core/ngx_resolver.h | 1 + 2 files changed, 8 insertions(+), 0 deletions(-) diffs (70 lines): diff -r ad2360782ecd -r c94aba230a5a src/core/ngx_resolver.c --- a/src/core/ngx_resolver.c Wed Mar 23 17:44:04 2016 +0300 +++ b/src/core/ngx_resolver.c Wed Mar 23 17:44:36 2016 +0300 @@ -551,6 +551,7 @@ ngx_resolve_name_locked(ngx_resolver_t * do { ctx->state = NGX_OK; +ctx->valid = rn->valid; ctx->naddrs = naddrs; if (addrs == NULL) { @@ -597,6 +598,7 @@ ngx_resolve_name_locked(ngx_resolver_t * do { ctx->state = NGX_RESOLVE_NXDOMAIN; +ctx->valid = ngx_time() + (r->valid ? r->valid : 10); next = ctx->next; ctx->handler(ctx); @@ -859,6 +861,7 @@ ngx_resolve_addr(ngx_resolver_ctx_t *ctx /* unlock addr mutex */ ctx->state = NGX_OK; +ctx->valid = rn->valid; ctx->handler(ctx); @@ -1948,6 +1951,7 @@ ngx_resolver_process_a(ngx_resolver_t *r while (next) { ctx = next; ctx->state = code; +ctx->valid = ngx_time() + (r->valid ? r->valid : 10); next = ctx->next; ctx->handler(ctx); @@ -2262,6 +2266,7 @@ ngx_resolver_process_a(ngx_resolver_t *r while (next) { ctx = next; ctx->state = NGX_OK; +ctx->valid = rn->valid; ctx->naddrs = naddrs; if (addrs == NULL) { @@ -2541,6 +2546,7 @@ valid: while (next) { ctx = next; ctx->state = code; +ctx->valid = ngx_time() + (r->valid ? r->valid : 10); next = ctx->next; ctx->handler(ctx); @@ -2675,6 +2681,7 @@ ptr: while (next) { ctx = next; ctx->state = NGX_OK; +ctx->valid = rn->valid; ctx->name = name; next = ctx->next; diff -r ad2360782ecd -r c94aba230a5a src/core/ngx_resolver.h --- a/src/core/ngx_resolver.h Wed Mar 23 17:44:04 2016 +0300 +++ b/src/core/ngx_resolver.h Wed Mar 23 17:44:36 2016 +0300 @@ -164,6 +164,7 @@ struct ngx_resolver_ctx_s { ngx_int_t state; ngx_str_t name; +time_tvalid; ngx_uint_tnaddrs; ngx_addr_t *addrs; ngx_addr_taddr; ___ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel
[nginx] Resolver: added support for SRV records.
details: http://hg.nginx.org/nginx/rev/384154fc634f branches: changeset: 6458:384154fc634f user: Dmitry Volyntsev date: Wed Mar 23 17:44:36 2016 +0300 description: Resolver: added support for SRV records. diffstat: src/core/ngx_resolver.c | 972 +- src/core/ngx_resolver.h | 47 +- src/http/ngx_http_upstream.h |2 +- 3 files changed, 993 insertions(+), 28 deletions(-) diffs (truncated from 1371 to 1000 lines): diff -r a6711b85da83 -r 384154fc634f src/core/ngx_resolver.c --- a/src/core/ngx_resolver.c Wed Mar 23 17:44:36 2016 +0300 +++ b/src/core/ngx_resolver.c Wed Mar 23 17:44:36 2016 +0300 @@ -74,8 +74,10 @@ static ngx_int_t ngx_resolver_send_tcp_q ngx_resolver_connection_t *rec, u_char *query, u_short qlen); static ngx_int_t ngx_resolver_create_name_query(ngx_resolver_t *r, ngx_resolver_node_t *rn, ngx_str_t *name); +static ngx_int_t ngx_resolver_create_srv_query(ngx_resolver_t *r, +ngx_resolver_node_t *rn, ngx_str_t *name); static ngx_int_t ngx_resolver_create_addr_query(ngx_resolver_t *r, -ngx_resolver_node_t *rn, ngx_addr_t *addr); +ngx_resolver_node_t *rn, ngx_resolver_addr_t *addr); static void ngx_resolver_resend_handler(ngx_event_t *ev); static time_t ngx_resolver_resend(ngx_resolver_t *r, ngx_rbtree_t *tree, ngx_queue_t *queue); @@ -88,10 +90,15 @@ static void ngx_resolver_process_respons static void ngx_resolver_process_a(ngx_resolver_t *r, u_char *buf, size_t n, ngx_uint_t ident, ngx_uint_t code, ngx_uint_t qtype, ngx_uint_t nan, ngx_uint_t trunc, ngx_uint_t ans); +static void ngx_resolver_process_srv(ngx_resolver_t *r, u_char *buf, size_t n, +ngx_uint_t ident, ngx_uint_t code, ngx_uint_t nan, +ngx_uint_t trunc, ngx_uint_t ans); static void ngx_resolver_process_ptr(ngx_resolver_t *r, u_char *buf, size_t n, ngx_uint_t ident, ngx_uint_t code, ngx_uint_t nan); static ngx_resolver_node_t *ngx_resolver_lookup_name(ngx_resolver_t *r, ngx_str_t *name, uint32_t hash); +static ngx_resolver_node_t *ngx_resolver_lookup_srv(ngx_resolver_t *r, +ngx_str_t *name, uint32_t hash); static ngx_resolver_node_t *ngx_resolver_lookup_addr(ngx_resolver_t *r, in_addr_t addr); static void ngx_resolver_rbtree_insert_value(ngx_rbtree_node_t *temp, @@ -105,9 +112,14 @@ static void *ngx_resolver_calloc(ngx_res static void ngx_resolver_free(ngx_resolver_t *r, void *p); static void ngx_resolver_free_locked(ngx_resolver_t *r, void *p); static void *ngx_resolver_dup(ngx_resolver_t *r, void *src, size_t size); -static ngx_addr_t *ngx_resolver_export(ngx_resolver_t *r, +static ngx_resolver_addr_t *ngx_resolver_export(ngx_resolver_t *r, ngx_resolver_node_t *rn, ngx_uint_t rotate); +static void ngx_resolver_report_srv(ngx_resolver_t *r, ngx_resolver_ctx_t *ctx); static u_char *ngx_resolver_log_error(ngx_log_t *log, u_char *buf, size_t len); +static void ngx_resolver_resolve_srv_names(ngx_resolver_ctx_t *ctx, +ngx_resolver_node_t *rn); +static void ngx_resolver_srv_names_handler(ngx_resolver_ctx_t *ctx); +static ngx_int_t ngx_resolver_cmp_srvs(const void *one, const void *two); #if (NGX_HAVE_INET6) static void ngx_resolver_rbtree_insert_addr6_value(ngx_rbtree_node_t *temp, @@ -149,13 +161,18 @@ ngx_resolver_create(ngx_conf_t *cf, ngx_ ngx_rbtree_init(&r->name_rbtree, &r->name_sentinel, ngx_resolver_rbtree_insert_value); +ngx_rbtree_init(&r->srv_rbtree, &r->srv_sentinel, +ngx_resolver_rbtree_insert_value); + ngx_rbtree_init(&r->addr_rbtree, &r->addr_sentinel, ngx_rbtree_insert_value); ngx_queue_init(&r->name_resend_queue); +ngx_queue_init(&r->srv_resend_queue); ngx_queue_init(&r->addr_resend_queue); ngx_queue_init(&r->name_expire_queue); +ngx_queue_init(&r->srv_expire_queue); ngx_queue_init(&r->addr_expire_queue); #if (NGX_HAVE_INET6) @@ -274,6 +291,8 @@ ngx_resolver_cleanup(void *data) ngx_resolver_cleanup_tree(r, &r->name_rbtree); +ngx_resolver_cleanup_tree(r, &r->srv_rbtree); + ngx_resolver_cleanup_tree(r, &r->addr_rbtree); #if (NGX_HAVE_INET6) @@ -383,7 +402,9 @@ ngx_resolve_start(ngx_resolver_t *r, ngx ngx_int_t ngx_resolve_name(ngx_resolver_ctx_t *ctx) { +size_t slen; ngx_int_trc; +ngx_str_tname; ngx_resolver_t *r; r = ctx->resolver; @@ -400,9 +421,41 @@ ngx_resolve_name(ngx_resolver_ctx_t *ctx return NGX_OK; } -/* lock name mutex */ - -rc = ngx_resolve_name_locked(r, ctx, &ctx->name); +if (ctx->service.len) { +slen = ctx->service.len; + +if (ngx_strlchr(ctx->service.data, +ctx->service.data + ctx->service.len, '.') +== NULL) +{ +slen += sizeof("_._tcp") - 1; +} + +name.len = slen + 1 + ctx->name.len; + +name.data = ngx_resolver_alloc(r, name
[nginx] Core: introduced the NGX_DEBUG_PALLOC macro.
details: http://hg.nginx.org/nginx/rev/ad2360782ecd branches: changeset: 6455:ad2360782ecd user: Valentin Bartenev date: Wed Mar 23 17:44:04 2016 +0300 description: Core: introduced the NGX_DEBUG_PALLOC macro. It allows to turn off accumulation of small pool allocations into a big preallocated chunk of memory. This is useful for debugging memory access with sanitizer, since such accumulation can cover buffer overruns from being detected. diffstat: src/core/ngx_palloc.c | 4 1 files changed, 4 insertions(+), 0 deletions(-) diffs (27 lines): diff -r f61472978419 -r ad2360782ecd src/core/ngx_palloc.c --- a/src/core/ngx_palloc.c Wed Mar 23 17:44:04 2016 +0300 +++ b/src/core/ngx_palloc.c Wed Mar 23 17:44:04 2016 +0300 @@ -122,9 +122,11 @@ ngx_reset_pool(ngx_pool_t *pool) void * ngx_palloc(ngx_pool_t *pool, size_t size) { +#if !(NGX_DEBUG_PALLOC) if (size <= pool->max) { return ngx_palloc_small(pool, size, 1); } +#endif return ngx_palloc_large(pool, size); } @@ -133,9 +135,11 @@ ngx_palloc(ngx_pool_t *pool, size_t size void * ngx_pnalloc(ngx_pool_t *pool, size_t size) { +#if !(NGX_DEBUG_PALLOC) if (size <= pool->max) { return ngx_palloc_small(pool, size, 0); } +#endif return ngx_palloc_large(pool, size); } ___ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel
[nginx] Core: moved logging before freeing large blocks of pool.
details: http://hg.nginx.org/nginx/rev/6be7e59fdd2c branches: changeset: 6452:6be7e59fdd2c user: Valentin Bartenev date: Wed Mar 23 17:44:04 2016 +0300 description: Core: moved logging before freeing large blocks of pool. This fixes use-after-free memory access with enabled debug log when pool->log is allocated as a large block. diffstat: src/core/ngx_palloc.c | 19 ++- 1 files changed, 10 insertions(+), 9 deletions(-) diffs (43 lines): diff -r 155871d773cc -r 6be7e59fdd2c src/core/ngx_palloc.c --- a/src/core/ngx_palloc.c Tue Mar 22 16:58:38 2016 +0300 +++ b/src/core/ngx_palloc.c Wed Mar 23 17:44:04 2016 +0300 @@ -56,15 +56,6 @@ ngx_destroy_pool(ngx_pool_t *pool) } } -for (l = pool->large; l; l = l->next) { - -ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, pool->log, 0, "free: %p", l->alloc); - -if (l->alloc) { -ngx_free(l->alloc); -} -} - #if (NGX_DEBUG) /* @@ -72,6 +63,10 @@ ngx_destroy_pool(ngx_pool_t *pool) * so we cannot use this log while free()ing the pool */ +for (l = pool->large; l; l = l->next) { +ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, pool->log, 0, "free: %p", l->alloc); +} + for (p = pool, n = pool->d.next; /* void */; p = n, n = n->d.next) { ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, pool->log, 0, "free: %p, unused: %uz", p, p->d.end - p->d.last); @@ -83,6 +78,12 @@ ngx_destroy_pool(ngx_pool_t *pool) #endif +for (l = pool->large; l; l = l->next) { +if (l->alloc) { +ngx_free(l->alloc); +} +} + for (p = pool, n = pool->d.next; /* void */; p = n, n = n->d.next) { ngx_free(p); ___ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel
[nginx] Core: use ngx_palloc_small() to allocate ngx_pool_large_t.
details: http://hg.nginx.org/nginx/rev/f61472978419 branches: changeset: 6454:f61472978419 user: Valentin Bartenev date: Wed Mar 23 17:44:04 2016 +0300 description: Core: use ngx_palloc_small() to allocate ngx_pool_large_t. This structure cannot be allocated as a large block anyway, otherwise that will result in infinite recursion, since each large allocation requires to allocate another ngx_pool_large_t. The room for the structure is guaranteed by the NGX_MIN_POOL_SIZE constant. diffstat: src/core/ngx_palloc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (21 lines): diff -r 12248fe20689 -r f61472978419 src/core/ngx_palloc.c --- a/src/core/ngx_palloc.c Wed Mar 23 17:44:04 2016 +0300 +++ b/src/core/ngx_palloc.c Wed Mar 23 17:44:04 2016 +0300 @@ -231,7 +231,7 @@ ngx_palloc_large(ngx_pool_t *pool, size_ } } -large = ngx_palloc(pool, sizeof(ngx_pool_large_t)); +large = ngx_palloc_small(pool, sizeof(ngx_pool_large_t), 1); if (large == NULL) { ngx_free(p); return NULL; @@ -256,7 +256,7 @@ ngx_pmemalign(ngx_pool_t *pool, size_t s return NULL; } -large = ngx_palloc(pool, sizeof(ngx_pool_large_t)); +large = ngx_palloc_small(pool, sizeof(ngx_pool_large_t), 1); if (large == NULL) { ngx_free(p); return NULL; ___ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel
[nginx] Core: introduced the ngx_palloc_small() function.
details: http://hg.nginx.org/nginx/rev/12248fe20689 branches: changeset: 6453:12248fe20689 user: Valentin Bartenev date: Wed Mar 23 17:44:04 2016 +0300 description: Core: introduced the ngx_palloc_small() function. It deduplicates some code for allocations from memory pool. No functional changes. diffstat: src/core/ngx_palloc.c | 61 ++ 1 files changed, 27 insertions(+), 34 deletions(-) diffs (96 lines): diff -r 6be7e59fdd2c -r 12248fe20689 src/core/ngx_palloc.c --- a/src/core/ngx_palloc.c Wed Mar 23 17:44:04 2016 +0300 +++ b/src/core/ngx_palloc.c Wed Mar 23 17:44:04 2016 +0300 @@ -9,6 +9,8 @@ #include +static ngx_inline void *ngx_palloc_small(ngx_pool_t *pool, size_t size, +ngx_uint_t align); static void *ngx_palloc_block(ngx_pool_t *pool, size_t size); static void *ngx_palloc_large(ngx_pool_t *pool, size_t size); @@ -120,27 +122,8 @@ ngx_reset_pool(ngx_pool_t *pool) void * ngx_palloc(ngx_pool_t *pool, size_t size) { -u_char *m; -ngx_pool_t *p; - if (size <= pool->max) { - -p = pool->current; - -do { -m = ngx_align_ptr(p->d.last, NGX_ALIGNMENT); - -if ((size_t) (p->d.end - m) >= size) { -p->d.last = m + size; - -return m; -} - -p = p->d.next; - -} while (p); - -return ngx_palloc_block(pool, size); +return ngx_palloc_small(pool, size, 1); } return ngx_palloc_large(pool, size); @@ -150,30 +133,40 @@ ngx_palloc(ngx_pool_t *pool, size_t size void * ngx_pnalloc(ngx_pool_t *pool, size_t size) { +if (size <= pool->max) { +return ngx_palloc_small(pool, size, 0); +} + +return ngx_palloc_large(pool, size); +} + + +static ngx_inline void * +ngx_palloc_small(ngx_pool_t *pool, size_t size, ngx_uint_t align) +{ u_char *m; ngx_pool_t *p; -if (size <= pool->max) { +p = pool->current; -p = pool->current; +do { +m = p->d.last; -do { -m = p->d.last; +if (align) { +m = ngx_align_ptr(m, NGX_ALIGNMENT); +} -if ((size_t) (p->d.end - m) >= size) { -p->d.last = m + size; +if ((size_t) (p->d.end - m) >= size) { +p->d.last = m + size; -return m; -} +return m; +} -p = p->d.next; +p = p->d.next; -} while (p); +} while (p); -return ngx_palloc_block(pool, size); -} - -return ngx_palloc_large(pool, size); +return ngx_palloc_block(pool, size); } ___ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel
[nginx] Backed out server_tokens changes.
details: http://hg.nginx.org/nginx/rev/155871d773cc branches: changeset: 6451:155871d773cc user: Maxim Dounin date: Tue Mar 22 16:58:38 2016 +0300 description: Backed out server_tokens changes. Backed out changesets: cf3e75cfa951, 6b72414dfb4f, 602dc42035fe, e5076b96fd01. diffstat: src/http/ngx_http_core_module.c | 56 ++- src/http/ngx_http_core_module.h | 4 +- src/http/ngx_http_header_filter_module.c | 47 -- src/http/ngx_http_special_response.c | 49 --- src/http/v2/ngx_http_v2_filter_module.c | 52 + 5 files changed, 45 insertions(+), 163 deletions(-) diffs (365 lines): diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -59,8 +59,6 @@ static char *ngx_http_core_set_aio(ngx_c void *conf); static char *ngx_http_core_directio(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_core_server_tokens(ngx_conf_t *cf, ngx_command_t *cmd, -void *conf); static char *ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); static char *ngx_http_core_try_files(ngx_conf_t *cf, ngx_command_t *cmd, @@ -594,10 +592,10 @@ static ngx_command_t ngx_http_core_comm NULL }, { ngx_string("server_tokens"), - NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, - ngx_http_core_server_tokens, + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, + ngx_conf_set_flag_slot, NGX_HTTP_LOC_CONF_OFFSET, - 0, + offsetof(ngx_http_core_loc_conf_t, server_tokens), NULL }, { ngx_string("if_modified_since"), @@ -3645,9 +3643,9 @@ ngx_http_core_create_loc_conf(ngx_conf_t clcf->log_not_found = NGX_CONF_UNSET; clcf->log_subrequest = NGX_CONF_UNSET; clcf->recursive_error_pages = NGX_CONF_UNSET; +clcf->server_tokens = NGX_CONF_UNSET; clcf->chunked_transfer_encoding = NGX_CONF_UNSET; clcf->etag = NGX_CONF_UNSET; -clcf->server_tokens = NGX_CONF_UNSET_UINT; clcf->types_hash_max_size = NGX_CONF_UNSET_UINT; clcf->types_hash_bucket_size = NGX_CONF_UNSET_UINT; @@ -3911,15 +3909,11 @@ ngx_http_core_merge_loc_conf(ngx_conf_t ngx_conf_merge_value(conf->log_subrequest, prev->log_subrequest, 0); ngx_conf_merge_value(conf->recursive_error_pages, prev->recursive_error_pages, 0); +ngx_conf_merge_value(conf->server_tokens, prev->server_tokens, 1); ngx_conf_merge_value(conf->chunked_transfer_encoding, prev->chunked_transfer_encoding, 1); ngx_conf_merge_value(conf->etag, prev->etag, 1); -if (conf->server_tokens == NGX_CONF_UNSET_UINT) { -ngx_conf_merge_uint_value(conf->server_tokens, prev->server_tokens, 1); -conf->server_tokens_value = prev->server_tokens_value; -} - ngx_conf_merge_ptr_value(conf->open_file_cache, prev->open_file_cache, NULL); @@ -4802,46 +4796,6 @@ ngx_http_core_directio(ngx_conf_t *cf, n static char * -ngx_http_core_server_tokens(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) -{ -ngx_http_core_loc_conf_t *clcf = conf; - -ngx_str_t *value; -ngx_http_compile_complex_value_t ccv; - -if (clcf->server_tokens != NGX_CONF_UNSET_UINT) { -return "is duplicate"; -} - -value = cf->args->elts; - -if (ngx_strcmp(value[1].data, "on") == 0) { -clcf->server_tokens = 1; -return NGX_CONF_OK; -} - -if (ngx_strcmp(value[1].data, "off") == 0) { -clcf->server_tokens = 0; -return NGX_CONF_OK; -} - -ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); - -ccv.cf = cf; -ccv.value = &value[1]; -ccv.complex_value = &clcf->server_tokens_value; - -if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { -return NGX_CONF_ERROR; -} - -clcf->server_tokens = 2; - -return NGX_CONF_OK; -} - - -static char * ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { ngx_http_core_loc_conf_t *clcf = conf; diff --git a/src/http/ngx_http_core_module.h b/src/http/ngx_http_core_module.h --- a/src/http/ngx_http_core_module.h +++ b/src/http/ngx_http_core_module.h @@ -415,12 +415,10 @@ struct ngx_http_core_loc_conf_s { ngx_flag_tlog_not_found; /* log_not_found */ ngx_flag_tlog_subrequest; /* log_subrequest */ ngx_flag_trecursive_error_pages; /* recursive_error_pages */ +ngx_flag_tserver_tokens; /* server_tokens */ ngx_flag_tchunked_transfer_encoding; /* chunked_transfer_encoding */ ngx_flag_tetag;/* etag */ -ngx_uint_tserver_tokens; /* server_tokens */ -ngx_http_complex_value_t s
Re: Nginx Overflow ? status 18446744073709551615
On Wednesday 23 March 2016 13:35:53 Jadjay wrote: [..] > Yes we have some 3-rd party modules : > > /usr/local/usr/sbin/nginx -V > > nginx version: nginx/1.6.0 [..] You are using outdated unsupported version of nginx. At first, you should update to actual version. [..] > --add-module=/root/rpmbuild//BUILD/nginx-1.6.0/modsecurity-2.8.0/nginx/modsecurity > > --add-module=/root/rpmbuild//BUILD/nginx-1.6.0/ngx_cache_purge-2.1 > --add-module=/root/rpmbuild//BUILD/nginx-1.6.0/ngx_http_substitutions_filter_module > > > --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions > -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' > --with-ld-opt=-Wl,-E > > But only modsecurity is used, > Any of 3rd-party modules (including modsecurity) can introduce bugs. wbr, Valentin V. Bartenev ___ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel
Re: [PATCH]Translation to ja(LICENSE & README)
Hello! On Wed, Mar 23, 2016 at 12:54:24PM +0900, ZEUS-mgtGM KUJIRAI, Takahiro wrote: > Hi, Dounin > > > Thank you for your response. > I understood about LICENSE & README. > > > >I think it's not going to work. We maintain Russian version of > >CHANGES only because many of the developers are Russians > >(including me) and can more or less easily write them while > >releasing a new version. > > > >We've already tried to maintain translations of the nginx.org site > >to various languages. The problem is that translations are > >[almost] not refreshed after an initial translation is done and > >quickly become stale, resulting in negative net effect. > > I saw nginx.org, I found English site & Russian site. > --- > http://nginx.org/en/ > http://nginx.org/ru/ > > What other language site is it? > > And if there is a Japanese site, I want to translate. There are various other languages, see here: http://hg.nginx.org/nginx.org/file/tip/xml Though all except English and Russian are stale and was deactivated. -- Maxim Dounin http://nginx.org/ ___ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel
Re: Nginx Overflow ? status 18446744073709551615
On Wednesday 23 March 2016 12:22:29 Jadjay wrote: > Hi, > > We have a problem with a front nginx acting as rproxy for 6 windows IIS6 > backends, > > Sometimes it seems it overflows : > > In logs the status value is 18446744073709551615 (aka the max 64-bit value) > > e.g : > > 88.XXX.XXX.138 - - [23/Mar/2016:12:14:16 +0100] "GET > /soin-amincissant-...XXX...-la-fontaine.aspx HTTP/1.1" > 18446744073709551615 0 > "http://www.___XXX___.fr/soin-amincissant-...XXX...-la-fontaine.aspx"; > "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, > like Gecko) Chrome/49.0.2623.87 Safari/537.36" "-" "range:-" > > 151.XXX.221 - - [23/Mar/2016:08:15:11 +0100] "HEAD > /Catalogue_-Bleu.aspx HTTP/1.1" 18446744073709551615 0 "-" > "Java/1.8.0_60" "-" > > > It's seems that one on 5 times it breaks nginx, by overflowing memory. > > Did you have any clue on that ? > >> Do you use any 3-rd party modules or patches? >> >> wbr, Valentin V. Bartenev Yes we have some 3-rd party modules : /usr/local/usr/sbin/nginx -V nginx version: nginx/1.6.0 built by gcc 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) TLS SNI support enabled configure arguments: --prefix=/usr/local/ --sbin-path=/usr/local/usr/sbin/nginx --conf-path=/usr/local/etc/nginx/nginx.conf --error-log-path=/usr/local/var/log/nginx/error.log --http-log-path=/usr/local/var/log/nginx/access.log --http-client-body-temp-path=/usr/local/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/usr/local/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/usr/local/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/usr/local/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/usr/local/var/lib/nginx/tmp/scgi --pid-path=/usr/local/var/run/nginx.pid --lock-path=/usr/local/var/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_spdy_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-http_perl_module --with-mail --with-mail_ssl_module --with-pcre --with-debug --add-module=/root/rpmbuild//BUILD/nginx-1.6.0/modsecurity-2.8.0/nginx/modsecurity --add-module=/root/rpmbuild//BUILD/nginx-1.6.0/ngx_cache_purge-2.1 --add-module=/root/rpmbuild//BUILD/nginx-1.6.0/ngx_http_substitutions_filter_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --with-ld-opt=-Wl,-E But only modsecurity is used, -- Jadjay jad...@rachetjay.fr ___ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel
[nginx] Cache: fixed slots accounting error introduced in c9d680b00744.
details: http://hg.nginx.org/nginx/rev/22c32937a41f branches: changeset: 6450:22c32937a41f user: Dmitry Volyntsev date: Wed Mar 23 14:16:31 2016 +0300 description: Cache: fixed slots accounting error introduced in c9d680b00744. diffstat: src/http/ngx_http_file_cache.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (18 lines): diff -r e5076b96fd01 -r 22c32937a41f src/http/ngx_http_file_cache.c --- a/src/http/ngx_http_file_cache.cTue Mar 22 15:52:28 2016 +0300 +++ b/src/http/ngx_http_file_cache.cWed Mar 23 14:16:31 2016 +0300 @@ -2115,12 +2115,12 @@ ngx_http_file_cache_add(ngx_http_file_ca "could not allocate node%s", cache->shpool->log_ctx); } -cache->sh->count++; - ngx_shmtx_unlock(&cache->shpool->mutex); return NGX_ERROR; } +cache->sh->count++; + ngx_memcpy((u_char *) &fcn->node.key, c->key, sizeof(ngx_rbtree_key_t)); ngx_memcpy(fcn->key, &c->key[sizeof(ngx_rbtree_key_t)], ___ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel
Re: Nginx Overflow ? status 18446744073709551615
On Wednesday 23 March 2016 12:22:29 Jadjay wrote: > Hi, > > We have a problem with a front nginx acting as rproxy for 6 windows IIS6 > backends, > > Sometimes it seems it overflows : > > In logs the status value is 18446744073709551615 (aka the max 64-bit value) > > e.g : > > 88.XXX.XXX.138 - - [23/Mar/2016:12:14:16 +0100] "GET > /soin-amincissant-...XXX...-la-fontaine.aspx HTTP/1.1" > 18446744073709551615 0 > "http://www.___XXX___.fr/soin-amincissant-...XXX...-la-fontaine.aspx"; > "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, > like Gecko) Chrome/49.0.2623.87 Safari/537.36" "-" "range:-" > > 151.XXX.221 - - [23/Mar/2016:08:15:11 +0100] "HEAD > /Catalogue_-Bleu.aspx HTTP/1.1" 18446744073709551615 0 "-" > "Java/1.8.0_60" "-" > > > It's seems that one on 5 times it breaks nginx, by overflowing memory. > > Did you have any clue on that ? > > Do you use any 3-rd party modules or patches? wbr, Valentin V. Bartenev ___ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel
Nginx Overflow ? status 18446744073709551615
Hi, We have a problem with a front nginx acting as rproxy for 6 windows IIS6 backends, Sometimes it seems it overflows : In logs the status value is 18446744073709551615 (aka the max 64-bit value) e.g : 88.XXX.XXX.138 - - [23/Mar/2016:12:14:16 +0100] "GET /soin-amincissant-...XXX...-la-fontaine.aspx HTTP/1.1" 18446744073709551615 0 "http://www.___XXX___.fr/soin-amincissant-...XXX...-la-fontaine.aspx"; "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36" "-" "range:-" 151.XXX.221 - - [23/Mar/2016:08:15:11 +0100] "HEAD /Catalogue_-Bleu.aspx HTTP/1.1" 18446744073709551615 0 "-" "Java/1.8.0_60" "-" It's seems that one on 5 times it breaks nginx, by overflowing memory. Did you have any clue on that ? -- Jadjay jad...@rachetjay.fr ___ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel
[njs] An option how to build njs module dynamically provided.
details: http://hg.nginx.org/njs/rev/4deb6b538b48 branches: changeset: 84:4deb6b538b48 user: Maxim Konovalov date: Wed Mar 23 12:10:44 2016 +0300 description: An option how to build njs module dynamically provided. diffstat: README | 8 1 файлов изменено, 8 вставок(+), 0 удалений(-) различия (18 строк): diff -r 480849ab9e96 -r 4deb6b538b48 README --- a/READMEFri Mar 04 14:57:21 2016 +0300 +++ b/READMEWed Mar 23 12:10:44 2016 +0300 @@ -3,6 +3,14 @@ Configure nginx with HTTP JavaScript mod ./configure --add-module=/nginx +Alternatively, you can build a dynamic version of the njs module + +./configure --add-dynamic-module=/nginx + +and add the following line to nginx.conf and reload nginx: + +load_module modules/ngx_http_js_module.so; + Please report your experiences to the NGINX development mailing list nginx-devel@nginx.org (http://mailman.nginx.org/mailman/listinfo/nginx-devel). ___ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel