[nginx] Stream: removed useless typedef.

2016-02-11 Thread Roman Arutyunyan
details:   http://hg.nginx.org/nginx/rev/4eb1b5c6d9c6
branches:  
changeset: 6392:4eb1b5c6d9c6
user:  Roman Arutyunyan 
date:  Thu Feb 11 14:20:22 2016 +0300
description:
Stream: removed useless typedef.

diffstat:

 src/stream/ngx_stream_proxy_module.c |  3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diffs (13 lines):

diff -r 965e4223e702 -r 4eb1b5c6d9c6 src/stream/ngx_stream_proxy_module.c
--- a/src/stream/ngx_stream_proxy_module.c  Wed Feb 10 11:36:25 2016 +0300
+++ b/src/stream/ngx_stream_proxy_module.c  Thu Feb 11 14:20:22 2016 +0300
@@ -10,9 +10,6 @@
 #include 
 
 
-typedef void (*ngx_stream_proxy_handler_pt)(ngx_stream_session_t *s);
-
-
 typedef struct {
 ngx_msec_t   connect_timeout;
 ngx_msec_t   timeout;

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[nginx] Stream: initialize variable right before using it.

2016-02-11 Thread Roman Arutyunyan
details:   http://hg.nginx.org/nginx/rev/70e6e1f12dee
branches:  
changeset: 6393:70e6e1f12dee
user:  Roman Arutyunyan 
date:  Thu Feb 11 14:20:26 2016 +0300
description:
Stream: initialize variable right before using it.

diffstat:

 src/stream/ngx_stream_proxy_module.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r 4eb1b5c6d9c6 -r 70e6e1f12dee src/stream/ngx_stream_proxy_module.c
--- a/src/stream/ngx_stream_proxy_module.c  Thu Feb 11 14:20:22 2016 +0300
+++ b/src/stream/ngx_stream_proxy_module.c  Thu Feb 11 14:20:26 2016 +0300
@@ -432,8 +432,6 @@ ngx_stream_proxy_connect(ngx_stream_sess
 
 ngx_log_debug1(NGX_LOG_DEBUG_STREAM, c->log, 0, "proxy connect: %i", rc);
 
-pscf = ngx_stream_get_module_srv_conf(s, ngx_stream_proxy_module);
-
 if (rc == NGX_ERROR) {
 ngx_stream_proxy_finalize(s, NGX_ERROR);
 return;
@@ -468,6 +466,8 @@ ngx_stream_proxy_connect(ngx_stream_sess
 pc->read->handler = ngx_stream_proxy_connect_handler;
 pc->write->handler = ngx_stream_proxy_connect_handler;
 
+pscf = ngx_stream_get_module_srv_conf(s, ngx_stream_proxy_module);
+
 ngx_add_timer(pc->write, pscf->connect_timeout);
 }
 

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[nginx] Dynamic modules: fixed a version mismatch message (ticke...

2016-02-11 Thread Ruslan Ermilov
details:   http://hg.nginx.org/nginx/rev/5fe617f38222
branches:  
changeset: 6394:5fe617f38222
user:  Ruslan Ermilov 
date:  Thu Feb 11 18:46:46 2016 +0300
description:
Dynamic modules: fixed a version mismatch message (ticket #898).

Based on a patch by Takashi Takizawa.

diffstat:

 src/core/ngx_module.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 70e6e1f12dee -r 5fe617f38222 src/core/ngx_module.c
--- a/src/core/ngx_module.c Thu Feb 11 14:20:26 2016 +0300
+++ b/src/core/ngx_module.c Thu Feb 11 18:46:46 2016 +0300
@@ -171,7 +171,7 @@ ngx_add_module(ngx_conf_t *cf, ngx_str_t
 if (module->version != nginx_version) {
 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"module \"%V\" version %ui instead of %ui",
-   file, module->version, nginx_version);
+   file, module->version, (ngx_uint_t) nginx_version);
 return NGX_ERROR;
 }
 

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[nginx] HTTP/2: implemented HPACK Huffman encoding for response ...

2016-02-11 Thread Valentin Bartenev
details:   http://hg.nginx.org/nginx/rev/ba3c2ca21aa5
branches:  
changeset: 6395:ba3c2ca21aa5
user:  Valentin Bartenev 
date:  Thu Feb 11 15:35:36 2016 +0300
description:
HTTP/2: implemented HPACK Huffman encoding for response headers.

This reduces the size of headers by over 30% on average.

Based on the patch by Vlad Krasnov:
http://mailman.nginx.org/pipermail/nginx-devel/2015-December/007682.html

diffstat:

 auto/cc/conf|   10 +
 src/http/v2/ngx_http_v2.h   |2 +
 src/http/v2/ngx_http_v2_filter_module.c |  157 +---
 src/http/v2/ngx_http_v2_huff_encode.c   |  240 
 4 files changed, 353 insertions(+), 56 deletions(-)

diffs (558 lines):

diff -r 5fe617f38222 -r ba3c2ca21aa5 auto/cc/conf
--- a/auto/cc/conf  Thu Feb 11 18:46:46 2016 +0300
+++ b/auto/cc/conf  Thu Feb 11 15:35:36 2016 +0300
@@ -225,6 +225,16 @@ if [ "$NGX_PLATFORM" != win32 ]; then
 . auto/feature
 
 
+ngx_feature="gcc builtin 64 bit byteswap"
+ngx_feature_name="NGX_HAVE_GCC_BSWAP64"
+ngx_feature_run=no
+ngx_feature_incs=
+ngx_feature_path=
+ngx_feature_libs=
+ngx_feature_test="__builtin_bswap64(0)"
+. auto/feature
+
+
 #ngx_feature="inline"
 #ngx_feature_name=
 #ngx_feature_run=no
diff -r 5fe617f38222 -r ba3c2ca21aa5 src/http/v2/ngx_http_v2.h
--- a/src/http/v2/ngx_http_v2.h Thu Feb 11 18:46:46 2016 +0300
+++ b/src/http/v2/ngx_http_v2.h Thu Feb 11 15:35:36 2016 +0300
@@ -274,6 +274,8 @@ ngx_int_t ngx_http_v2_table_size(ngx_htt
 
 ngx_int_t ngx_http_v2_huff_decode(u_char *state, u_char *src, size_t len,
 u_char **dst, ngx_uint_t last, ngx_log_t *log);
+size_t ngx_http_v2_huff_encode(u_char *src, size_t len, u_char *dst,
+ngx_uint_t lower);
 
 
 #define ngx_http_v2_prefix(bits)  ((1 << (bits)) - 1)
diff -r 5fe617f38222 -r ba3c2ca21aa5 src/http/v2/ngx_http_v2_filter_module.c
--- a/src/http/v2/ngx_http_v2_filter_module.c   Thu Feb 11 18:46:46 2016 +0300
+++ b/src/http/v2/ngx_http_v2_filter_module.c   Thu Feb 11 15:35:36 2016 +0300
@@ -25,6 +25,11 @@
 #define ngx_http_v2_indexed(i)  (128 + (i))
 #define ngx_http_v2_inc_indexed(i)  (64 + (i))
 
+#define ngx_http_v2_write_name(dst, src, len, tmp)\
+ngx_http_v2_string_encode(dst, src, len, tmp, 1)
+#define ngx_http_v2_write_value(dst, src, len, tmp)   \
+ngx_http_v2_string_encode(dst, src, len, tmp, 0)
+
 #define NGX_HTTP_V2_ENCODE_RAW0
 #define NGX_HTTP_V2_ENCODE_HUFF   0x80
 
@@ -46,6 +51,8 @@
 #define NGX_HTTP_V2_VARY_INDEX59
 
 
+static u_char *ngx_http_v2_string_encode(u_char *dst, u_char *src, size_t len,
+u_char *tmp, ngx_uint_t lower);
 static u_char *ngx_http_v2_write_int(u_char *pos, ngx_uint_t prefix,
 ngx_uint_t value);
 static ngx_http_v2_out_frame_t *ngx_http_v2_create_headers_frame(
@@ -119,8 +126,8 @@ static ngx_http_output_header_filter_pt 
 static ngx_int_t
 ngx_http_v2_header_filter(ngx_http_request_t *r)
 {
-u_char status, *pos, *start, *p;
-size_t len;
+u_char status, *pos, *start, *p, *tmp;
+size_t len, tmp_len;
 ngx_str_t  host, location;
 ngx_uint_t i, port;
 ngx_list_part_t   *part;
@@ -136,6 +143,14 @@ ngx_http_v2_header_filter(ngx_http_reque
 #endif
 u_char addr[NGX_SOCKADDR_STRLEN];
 
+static const u_char nginx[5] = "\x84\xaa\x63\x55\xe7";
+#if (NGX_HTTP_GZIP)
+static const u_char accept_encoding[12] =
+"\x8b\x84\x84\x2d\x69\x5b\x05\x44\x3c\x86\xaa\x6f";
+#endif
+
+static size_t nginx_ver_len = ngx_http_v2_literal_size(NGINX_VER);
+static u_char nginx_ver[ngx_http_v2_literal_size(NGINX_VER)];
 
 if (!r->stream) {
 return ngx_http_next_header_filter(r);
@@ -215,8 +230,7 @@ ngx_http_v2_header_filter(ngx_http_reque
 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
 
 if (r->headers_out.server == NULL) {
-len += 1 + (clcf->server_tokens ? ngx_http_v2_literal_size(NGINX_VER)
-: ngx_http_v2_literal_size("nginx"));
+len += 1 + (clcf->server_tokens ? nginx_ver_len : sizeof(nginx));
 }
 
 if (r->headers_out.date == NULL) {
@@ -340,10 +354,12 @@ ngx_http_v2_header_filter(ngx_http_reque
 len += 1 + NGX_HTTP_V2_INT_OCTETS + r->headers_out.location->value.len;
 }
 
+tmp_len = len;
+
 #if (NGX_HTTP_GZIP)
 if (r->gzip_vary) {
 if (clcf->gzip_vary) {
-len += 1 + ngx_http_v2_literal_size("Accept-Encoding");
+len += 1 + sizeof(accept_encoding);
 
 } else {
 r->gzip_vary = 0;
@@ -386,10 +402,20 @@ ngx_http_v2_header_filter(ngx_http_reque
 
 len += 1 + NGX_HTTP_V2_INT_OCTETS + header[i].key.len
  + NGX_HTTP_V2_INT_OCTETS + header[i].value.len;
+

Re: [PATCH] HTTP/2: HPACK Huffman encoding

2016-02-11 Thread Valentin V. Bartenev
On Friday 22 January 2016 13:53:01 Valentin V. Bartenev wrote:
> On Wednesday 20 January 2016 14:01:15 Vlad Krasnov wrote:
> > LGTM
> > 
> > Cheers,
> > Vlad
> > 
> [..]
> 
> Thank you.  The patch will be committed after internal review.
> 
[..]

Committed with the changes made during the review:
http://hg.nginx.org/nginx/rev/ba3c2ca21aa5

  wbr, Valentin V. Bartenev

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


Re: [PATCH] HTTP/2: HPACK Huffman encoding

2016-02-11 Thread Vlad Krasnov
I am very happy!

Thank you Valentin.

Cheers,
Vlad

> On 11 Feb 2016, at 08:36, Valentin V. Bartenev  wrote:
> 
> On Friday 22 January 2016 13:53:01 Valentin V. Bartenev wrote:
>> On Wednesday 20 January 2016 14:01:15 Vlad Krasnov wrote:
>>> LGTM
>>> 
>>> Cheers,
>>> Vlad
>>> 
>> [..]
>> 
>> Thank you.  The patch will be committed after internal review.
>> 
> [..]
> 
> Committed with the changes made during the review:
> http://hg.nginx.org/nginx/rev/ba3c2ca21aa5
> 
>  wbr, Valentin V. Bartenev
> 
> ___
> nginx-devel 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


Dynamic module search paths?

2016-02-11 Thread Yichun Zhang (agentzh)
Hi folks

It seems to me that the the load_module directive for loading NGINX
dynamic modules just use the server prefix when resolving relative
module DSO file paths specified in nginx.conf.

Here is my wishlist: I hope that we can have support for module search
paths specified via an external environment or an nginx command-line
option so that nginx.conf can be more portable across different
environments.

This is particularly useful when distributing various NGINX-based
applications where a single NGINX installation can serve multiple
different applications with different server prefixes in the same box
at the same time.

What do you think?

Best regards,
-agentzh

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


Already loaded NGINX modules

2016-02-11 Thread Yichun Zhang (agentzh)
Hi guys!

Currently when an NGINX module is statically linked against the NGINX
binary, the load_module directive bails out the server startup with
the error message "module already loaded" (or something like that).
Hopefully we can make this a nonfatal error (or provide an option to
make it nonfatal) because we can have more portable nginx.conf for
distributing NGINX-based applications.

Thanks for your attention!

Best regards,
-agentzh

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


Add /etc/hosts support to NGINX's own resolver

2016-02-11 Thread Yichun Zhang (agentzh)
Hi guys!

I wonder if you have any plans or interest in adding support for
system hosts configuration files (like /etc/hosts on Linux/*BSD/Mac OS
X) to NGINX's own nonblocking resolver implementation. This makes
debugging and other sysadmin work much easier otherwise we must set up
a local DNS server for special host names to work.

Thanks for your attention!

Best regards,
-agentzh

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


Re: Already loaded NGINX modules

2016-02-11 Thread Piotr Sikora
Hey Yichun,

> Currently when an NGINX module is statically linked against the NGINX
> binary, the load_module directive bails out the server startup with
> the error message "module already loaded" (or something like that).
> Hopefully we can make this a nonfatal error (or provide an option to
> make it nonfatal) because we can have more portable nginx.conf for
> distributing NGINX-based applications.

I disagree, because this would lead to unexpected behavior (since
statically linked module can be slightly different from the dynamic
module).

Which version should be used at runtime in your non-fatal scenario and why?

Best regards,
Piotr Sikora

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


Re: Already loaded NGINX modules

2016-02-11 Thread Yichun Zhang (agentzh)
Hello!

On Thu, Feb 11, 2016 at 2:33 PM, Piotr Sikora wrote:
> I disagree, because this would lead to unexpected behavior (since
> statically linked module can be slightly different from the dynamic
> module).
>
> Which version should be used at runtime in your non-fatal scenario and why?

We don't have version numbers in the DSO file names anyway :) And we
can issue warnings to error.log, even with a high log level.

Best regards,
-agentzh

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


Re: Already loaded NGINX modules

2016-02-11 Thread Yichun Zhang (agentzh)
Hello!

On Thu, Feb 11, 2016 at 3:16 PM, Yichun Zhang (agentzh) wrote:
> We don't have version numbers in the DSO file names anyway :) And we
> can issue warnings to error.log, even with a high log level.
>

Or with an explicit option to the load_module directive, as in

load_module ngx_http_lua_module.so duplicate=ignore;

What about this?

Begards,
-agentzh

Regards,
-agentzh

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


Re: Already loaded NGINX modules

2016-02-11 Thread Piotr Sikora
Hey Yichun,

> Or with an explicit option to the load_module directive, as in
>
> load_module ngx_http_lua_module.so duplicate=ignore;
>
> What about this?

That doesn't really answer my question: which version (statically
linked or dynamic) of the module should we use at runtime if both are
present... and why?

Best regards,
Piotr Sikora

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


Re: Already loaded NGINX modules

2016-02-11 Thread Yichun Zhang (agentzh)
Hello!

On Thu, Feb 11, 2016 at 3:29 PM, Piotr Sikora wrote:
>
> That doesn't really answer my question: which version (statically
> linked or dynamic) of the module should we use at runtime if both are
> present... and why?
>

For portable NGINX-based applications, for example, we only want to
ensure that some modules are *present*, like ngx_http_lua_module, and
we do not care about whether it is linked statically or dynamically.
We are only concerned about its presence. If the modules we need are
not statically linked, we want to dynamically load them. It's this
simple :) I don't think it's reasonable to use a dynamic version of a
module if it is already statically linked, is it?

Best regards,
-agentzh

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel