[nginx] Core: store and dump processed configuration.

2015-06-16 Thread Vladimir Homutov
details:   http://hg.nginx.org/nginx/rev/1b7e246e6b38
branches:  
changeset: 6187:1b7e246e6b38
user:  Vladimir Homutov v...@nginx.com
date:  Thu May 14 18:54:27 2015 +0300
description:
Core: store and dump processed configuration.

If the -T option is passed, additionally to configuration test, configuration
files are output to stdout.

In the debug mode, configuration files are kept in memory and can be accessed
using a debugger.

diffstat:

 src/core/nginx.c |  30 --
 src/core/ngx_conf_file.c |  45 +++--
 src/core/ngx_conf_file.h |   7 +++
 src/core/ngx_cycle.c |   8 
 src/core/ngx_cycle.h |   2 ++
 5 files changed, 88 insertions(+), 4 deletions(-)

diffs (221 lines):

diff -r db138b3b645e -r 1b7e246e6b38 src/core/nginx.c
--- a/src/core/nginx.c  Tue Jun 16 15:47:40 2015 +0300
+++ b/src/core/nginx.c  Thu May 14 18:54:27 2015 +0300
@@ -176,9 +176,11 @@ static char **ngx_os_environ;
 int ngx_cdecl
 main(int argc, char *const *argv)
 {
-ngx_int_t i;
+ngx_buf_t*b;
 ngx_log_t*log;
+ngx_uint_ti;
 ngx_cycle_t  *cycle, init_cycle;
+ngx_conf_dump_t  *cd;
 ngx_core_conf_t  *ccf;
 
 ngx_debug_init();
@@ -196,7 +198,7 @@ main(int argc, char *const *argv)
 
 if (ngx_show_help) {
 ngx_write_stderr(
-Usage: nginx [-?hvVtq] [-s signal] [-c filename] 
+Usage: nginx [-?hvVtTq] [-s signal] [-c filename] 
  [-p prefix] [-g directives] NGX_LINEFEED
  NGX_LINEFEED
 Options: NGX_LINEFEED
@@ -205,6 +207,8 @@ main(int argc, char *const *argv)
   -V: show version and configure options then 
exit
NGX_LINEFEED
   -t: test configuration and exit NGX_LINEFEED
+  -T: test configuration, dump it and exit
+   NGX_LINEFEED
   -q: suppress non-error messages 
during configuration testing NGX_LINEFEED
   -s signal : send signal to a master process: 
@@ -333,6 +337,23 @@ main(int argc, char *const *argv)
cycle-conf_file.data);
 }
 
+if (ngx_dump_config) {
+cd = cycle-config_dump.elts;
+
+for (i = 0; i  cycle-config_dump.nelts; i++) {
+
+ngx_write_stdout(# configuration file );
+(void) ngx_write_fd(ngx_stdout, cd[i].name.data,
+cd[i].name.len);
+ngx_write_stdout(: NGX_LINEFEED);
+
+b = cd[i].buffer;
+
+(void) ngx_write_fd(ngx_stdout, b-pos, b-last - b-pos);
+ngx_write_stdout(NGX_LINEFEED);
+}
+}
+
 return 0;
 }
 
@@ -689,6 +710,11 @@ ngx_get_options(int argc, char *const *a
 ngx_test_config = 1;
 break;
 
+case 'T':
+ngx_test_config = 1;
+ngx_dump_config = 1;
+break;
+
 case 'q':
 ngx_quiet_mode = 1;
 break;
diff -r db138b3b645e -r 1b7e246e6b38 src/core/ngx_conf_file.c
--- a/src/core/ngx_conf_file.c  Tue Jun 16 15:47:40 2015 +0300
+++ b/src/core/ngx_conf_file.c  Thu May 14 18:54:27 2015 +0300
@@ -101,10 +101,13 @@ char *
 ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
 {
 char *rv;
+u_char   *p;
+off_t size;
 ngx_fd_t  fd;
 ngx_int_t rc;
-ngx_buf_t buf;
+ngx_buf_t buf, *tbuf;
 ngx_conf_file_t  *prev, conf_file;
+ngx_conf_dump_t  *cd;
 enum {
 parse_file = 0,
 parse_block,
@@ -158,6 +161,39 @@ ngx_conf_parse(ngx_conf_t *cf, ngx_str_t
 
 type = parse_file;
 
+if (ngx_dump_config
+#if (NGX_DEBUG)
+|| 1
+#endif
+   )
+{
+p = ngx_pstrdup(cf-cycle-pool, filename);
+if (p == NULL) {
+goto failed;
+}
+
+size = ngx_file_size(cf-conf_file-file.info);
+
+tbuf = ngx_create_temp_buf(cf-cycle-pool, (size_t) size);
+if (tbuf == NULL) {
+goto failed;
+}
+
+cd = ngx_array_push(cf-cycle-config_dump);
+if (cd == NULL) {
+goto failed;
+}
+
+cd-name.len = filename-len;
+cd-name.data = p;
+cd-buffer = tbuf;
+
+cf-conf_file-dump = tbuf;
+
+} else {
+cf-conf_file-dump = NULL;
+}
+
 } else if (cf-conf_file-file.fd != NGX_INVALID_FILE) {
 
 type = parse_block;
@@ -437,7 +473,7 @@ ngx_conf_read_token(ngx_conf_t *cf)
 ngx_uint_t   found, need_space, last_space, 

[nginx] Polished the recent change to the manpage.

2015-06-16 Thread Ruslan Ermilov
details:   http://hg.nginx.org/nginx/rev/54b10b289f0f
branches:  
changeset: 6189:54b10b289f0f
user:  Ruslan Ermilov r...@nginx.com
date:  Tue Jun 16 16:52:13 2015 +0300
description:
Polished the recent change to the manpage.

diffstat:

 docs/man/nginx.8 |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (14 lines):

diff -r f08e80409dfd -r 54b10b289f0f docs/man/nginx.8
--- a/docs/man/nginx.8  Tue Jun 16 16:28:56 2015 +0300
+++ b/docs/man/nginx.8  Tue Jun 16 16:52:13 2015 +0300
@@ -88,7 +88,9 @@ Do not run, just test the configuration 
 checks the configuration file syntax and then tries to open files
 referenced in the configuration file.
 .It Fl T
-Same as -t, but additionally dumps configuration files to stdout.
+Same as
+.Fl t ,
+but additionally dump configuration files to standard output.
 .It Fl V
 Print the
 .Nm

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


[nginx] release-1.9.2 tag

2015-06-16 Thread Maxim Dounin
details:   http://hg.nginx.org/nginx/rev/f96689414078
branches:  
changeset: 6191:f96689414078
user:  Maxim Dounin mdou...@mdounin.ru
date:  Tue Jun 16 17:49:40 2015 +0300
description:
release-1.9.2 tag

diffstat:

 .hgtags |  1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diffs (8 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -384,3 +384,4 @@ 2b3b737b5456c05cd63d3d834f4fb4d3776953d0
 3ef00a71f56420a9c3e9cec311c9a2109a015d67 release-1.7.12
 53d850fe292f157d2fb999c52788ec1dc53c91ed release-1.9.0
 884a967c369f73ab16ea859670d690fb094d3850 release-1.9.1
+3a32d6e7404a79a0973bcd8d0b83181c5bf66074 release-1.9.2

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


[nginx] Disabled duplicate http, mail, and stream blocks.

2015-06-16 Thread Vladimir Homutov
details:   http://hg.nginx.org/nginx/rev/78c06e5e1d76
branches:  
changeset: 6193:78c06e5e1d76
user:  Vladimir Homutov v...@nginx.com
date:  Tue Jun 16 23:28:38 2015 +0300
description:
Disabled duplicate http, mail, and stream blocks.

Such configurations have very limited use, introduce various problems and
are not officially supported.

diffstat:

 src/http/ngx_http.c |  4 
 src/mail/ngx_mail.c |  4 
 src/stream/ngx_stream.c |  4 
 3 files changed, 12 insertions(+), 0 deletions(-)

diffs (42 lines):

diff -r 7863b167dbf9 -r 78c06e5e1d76 src/http/ngx_http.c
--- a/src/http/ngx_http.c   Tue Jun 16 23:31:31 2015 +0300
+++ b/src/http/ngx_http.c   Tue Jun 16 23:28:38 2015 +0300
@@ -128,6 +128,10 @@ ngx_http_block(ngx_conf_t *cf, ngx_comma
 ngx_http_core_srv_conf_t   **cscfp;
 ngx_http_core_main_conf_t   *cmcf;
 
+if (*(ngx_http_conf_ctx_t **) conf) {
+return is duplicate;
+}
+
 /* the main http context */
 
 ctx = ngx_pcalloc(cf-pool, sizeof(ngx_http_conf_ctx_t));
diff -r 7863b167dbf9 -r 78c06e5e1d76 src/mail/ngx_mail.c
--- a/src/mail/ngx_mail.c   Tue Jun 16 23:31:31 2015 +0300
+++ b/src/mail/ngx_mail.c   Tue Jun 16 23:28:38 2015 +0300
@@ -76,6 +76,10 @@ ngx_mail_block(ngx_conf_t *cf, ngx_comma
 ngx_mail_core_srv_conf_t   **cscfp;
 ngx_mail_core_main_conf_t   *cmcf;
 
+if (*(ngx_mail_conf_ctx_t **) conf) {
+return is duplicate;
+}
+
 /* the main mail context */
 
 ctx = ngx_pcalloc(cf-pool, sizeof(ngx_mail_conf_ctx_t));
diff -r 7863b167dbf9 -r 78c06e5e1d76 src/stream/ngx_stream.c
--- a/src/stream/ngx_stream.c   Tue Jun 16 23:31:31 2015 +0300
+++ b/src/stream/ngx_stream.c   Tue Jun 16 23:28:38 2015 +0300
@@ -76,6 +76,10 @@ ngx_stream_block(ngx_conf_t *cf, ngx_com
 ngx_stream_core_srv_conf_t   **cscfp;
 ngx_stream_core_main_conf_t   *cmcf;
 
+if (*(ngx_stream_conf_ctx_t **) conf) {
+return is duplicate;
+}
+
 /* the main stream context */
 
 ctx = ngx_pcalloc(cf-pool, sizeof(ngx_stream_conf_ctx_t));

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


[nginx] Stream: the proxy_bind directive.

2015-06-16 Thread Vladimir Homutov
details:   http://hg.nginx.org/nginx/rev/4dcffe43a7ea
branches:  
changeset: 6183:4dcffe43a7ea
user:  Vladimir Homutov v...@nginx.com
date:  Tue Jun 16 09:02:45 2015 +0300
description:
Stream: the proxy_bind directive.

diffstat:

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

diffs (106 lines):

diff -r 07e416ece597 -r 4dcffe43a7ea src/stream/ngx_stream_proxy_module.c
--- a/src/stream/ngx_stream_proxy_module.c  Mon Jun 15 20:20:12 2015 +0300
+++ b/src/stream/ngx_stream_proxy_module.c  Tue Jun 16 09:02:45 2015 +0300
@@ -21,6 +21,7 @@ typedef struct {
 size_t   upstream_buf_size;
 ngx_uint_t   next_upstream_tries;
 ngx_flag_t   next_upstream;
+ngx_addr_t  *local;
 
 #if (NGX_STREAM_SSL)
 ngx_flag_t   ssl_enable;
@@ -64,6 +65,8 @@ static char *ngx_stream_proxy_merge_srv_
 void *child);
 static char *ngx_stream_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd,
 void *conf);
+static char *ngx_stream_proxy_bind(ngx_conf_t *cf, ngx_command_t *cmd,
+void *conf);
 
 #if (NGX_STREAM_SSL)
 
@@ -97,6 +100,13 @@ static ngx_command_t  ngx_stream_proxy_c
   0,
   NULL },
 
+{ ngx_string(proxy_bind),
+  NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1,
+  ngx_stream_proxy_bind,
+  NGX_STREAM_SRV_CONF_OFFSET,
+  0,
+  NULL },
+
 { ngx_string(proxy_connect_timeout),
   NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1,
   ngx_conf_set_msec_slot,
@@ -301,6 +311,8 @@ ngx_stream_proxy_handler(ngx_stream_sess
 u-peer.log = c-log;
 u-peer.log_error = NGX_ERROR_ERR;
 
+u-peer.local = pscf-local;
+
 uscf = pscf-upstream;
 
 if (uscf-peer.init(s, uscf) != NGX_OK) {
@@ -1093,6 +1105,7 @@ ngx_stream_proxy_create_srv_conf(ngx_con
 conf-upstream_buf_size = NGX_CONF_UNSET_SIZE;
 conf-next_upstream_tries = NGX_CONF_UNSET_UINT;
 conf-next_upstream = NGX_CONF_UNSET;
+conf-local = NGX_CONF_UNSET_PTR;
 
 #if (NGX_STREAM_SSL)
 conf-ssl_enable = NGX_CONF_UNSET;
@@ -1133,6 +1146,8 @@ ngx_stream_proxy_merge_srv_conf(ngx_conf
 
 ngx_conf_merge_value(conf-next_upstream, prev-next_upstream, 1);
 
+ngx_conf_merge_ptr_value(conf-local, prev-local, NULL);
+
 #if (NGX_STREAM_SSL)
 
 ngx_conf_merge_value(conf-ssl_enable, prev-ssl_enable, 0);
@@ -1290,3 +1305,45 @@ ngx_stream_proxy_pass(ngx_conf_t *cf, ng
 
 return NGX_CONF_OK;
 }
+
+
+static char *
+ngx_stream_proxy_bind(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
+{
+ngx_stream_proxy_srv_conf_t *pscf = conf;
+
+ngx_int_t   rc;
+ngx_str_t  *value;
+
+if (pscf-local != NGX_CONF_UNSET_PTR) {
+return is duplicate;
+}
+
+value = cf-args-elts;
+
+if (ngx_strcmp(value[1].data, off) == 0) {
+pscf-local = NULL;
+return NGX_CONF_OK;
+}
+
+pscf-local = ngx_palloc(cf-pool, sizeof(ngx_addr_t));
+if (pscf-local == NULL) {
+return NGX_CONF_ERROR;
+}
+
+rc = ngx_parse_addr(cf-pool, pscf-local, value[1].data, value[1].len);
+
+switch (rc) {
+case NGX_OK:
+pscf-local-name = value[1];
+return NGX_CONF_OK;
+
+case NGX_DECLINED:
+ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+   invalid address \%V\, value[1]);
+/* fall through */
+
+default:
+return NGX_CONF_ERROR;
+}
+}

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


Content-Type

2015-06-16 Thread Witold Filipczyk
Hi,
?php
header('Content-Type: text/html;');
?
breaks proper Content-Type detection. At least in the 1.6.3 version.

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


[nginx] Stream: client-side PROXY protocol.

2015-06-16 Thread Roman Arutyunyan
details:   http://hg.nginx.org/nginx/rev/fa663739e115
branches:  
changeset: 6184:fa663739e115
user:  Roman Arutyunyan a...@nginx.com
date:  Tue Jun 16 13:45:16 2015 +0300
description:
Stream: client-side PROXY protocol.

The new directive proxy_protocol toggles sending out PROXY protocol header
to upstream once connection is established.

diffstat:

 src/core/ngx_proxy_protocol.c|   49 ++
 src/core/ngx_proxy_protocol.h|2 +
 src/stream/ngx_stream_proxy_module.c |  119 ++-
 src/stream/ngx_stream_upstream.h |2 +
 4 files changed, 170 insertions(+), 2 deletions(-)

diffs (267 lines):

diff -r 4dcffe43a7ea -r fa663739e115 src/core/ngx_proxy_protocol.c
--- a/src/core/ngx_proxy_protocol.c Tue Jun 16 09:02:45 2015 +0300
+++ b/src/core/ngx_proxy_protocol.c Tue Jun 16 13:45:16 2015 +0300
@@ -89,3 +89,52 @@ invalid:
 
 return NULL;
 }
+
+
+u_char *
+ngx_proxy_protocol_write(ngx_connection_t *c, u_char *buf, u_char *last)
+{
+ngx_uint_t  port, lport;
+
+if (last - buf  NGX_PROXY_PROTOCOL_MAX_HEADER) {
+return NULL;
+}
+
+if (ngx_connection_local_sockaddr(c, NULL, 0) != NGX_OK) {
+return NULL;
+}
+
+switch (c-sockaddr-sa_family) {
+
+case AF_INET:
+buf = ngx_cpymem(buf, PROXY TCP4 , sizeof(PROXY TCP4 ) - 1);
+
+port = ntohs(((struct sockaddr_in *) c-sockaddr)-sin_port);
+lport = ntohs(((struct sockaddr_in *) c-local_sockaddr)-sin_port);
+
+break;
+
+#if (NGX_HAVE_INET6)
+case AF_INET6:
+buf = ngx_cpymem(buf, PROXY TCP6 , sizeof(PROXY TCP6 ) - 1);
+
+port = ntohs(((struct sockaddr_in6 *) c-sockaddr)-sin6_port);
+lport = ntohs(((struct sockaddr_in6 *) c-local_sockaddr)-sin6_port);
+
+break;
+#endif
+
+default:
+return ngx_cpymem(buf, PROXY UNKNOWN CRLF,
+  sizeof(PROXY UNKNOWN CRLF) - 1);
+}
+
+buf += ngx_sock_ntop(c-sockaddr, c-socklen, buf, last - buf, 0);
+
+*buf++ = ' ';
+
+buf += ngx_sock_ntop(c-local_sockaddr, c-local_socklen, buf, last - buf,
+ 0);
+
+return ngx_slprintf(buf, last,  %ui %ui CRLF, port, lport);
+}
diff -r 4dcffe43a7ea -r fa663739e115 src/core/ngx_proxy_protocol.h
--- a/src/core/ngx_proxy_protocol.h Tue Jun 16 09:02:45 2015 +0300
+++ b/src/core/ngx_proxy_protocol.h Tue Jun 16 13:45:16 2015 +0300
@@ -18,6 +18,8 @@
 
 u_char *ngx_proxy_protocol_parse(ngx_connection_t *c, u_char *buf,
 u_char *last);
+u_char *ngx_proxy_protocol_write(ngx_connection_t *c, u_char *buf,
+u_char *last);
 
 
 #endif /* _NGX_PROXY_PROTOCOL_H_INCLUDED_ */
diff -r 4dcffe43a7ea -r fa663739e115 src/stream/ngx_stream_proxy_module.c
--- a/src/stream/ngx_stream_proxy_module.c  Tue Jun 16 09:02:45 2015 +0300
+++ b/src/stream/ngx_stream_proxy_module.c  Tue Jun 16 13:45:16 2015 +0300
@@ -21,6 +21,7 @@ typedef struct {
 size_t   upstream_buf_size;
 ngx_uint_t   next_upstream_tries;
 ngx_flag_t   next_upstream;
+ngx_flag_t   proxy_protocol;
 ngx_addr_t  *local;
 
 #if (NGX_STREAM_SSL)
@@ -67,6 +68,7 @@ static char *ngx_stream_proxy_pass(ngx_c
 void *conf);
 static char *ngx_stream_proxy_bind(ngx_conf_t *cf, ngx_command_t *cmd,
 void *conf);
+static ngx_int_t ngx_stream_proxy_send_proxy_protocol(ngx_stream_session_t *s);
 
 #if (NGX_STREAM_SSL)
 
@@ -156,6 +158,13 @@ static ngx_command_t  ngx_stream_proxy_c
   offsetof(ngx_stream_proxy_srv_conf_t, next_upstream_timeout),
   NULL },
 
+{ ngx_string(proxy_protocol),
+  NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_FLAG,
+  ngx_conf_set_flag_slot,
+  NGX_STREAM_SRV_CONF_OFFSET,
+  offsetof(ngx_stream_proxy_srv_conf_t, proxy_protocol),
+  NULL },
+
 #if (NGX_STREAM_SSL)
 
 { ngx_string(proxy_ssl),
@@ -328,6 +337,8 @@ ngx_stream_proxy_handler(ngx_stream_sess
 u-peer.tries = pscf-next_upstream_tries;
 }
 
+u-proxy_protocol = pscf-proxy_protocol;
+
 p = ngx_pnalloc(c-pool, pscf-downstream_buf_size);
 if (p == NULL) {
 ngx_stream_proxy_finalize(s, NGX_ERROR);
@@ -342,6 +353,29 @@ ngx_stream_proxy_handler(ngx_stream_sess
 c-write-handler = ngx_stream_proxy_downstream_handler;
 c-read-handler = ngx_stream_proxy_downstream_handler;
 
+if (u-proxy_protocol
+#if (NGX_STREAM_SSL)
+ pscf-ssl == NULL
+#endif
+ pscf-downstream_buf_size = NGX_PROXY_PROTOCOL_MAX_HEADER
+   )
+{
+/* optimization for a typical case */
+
+ngx_log_debug0(NGX_LOG_DEBUG_STREAM, c-log, 0,
+   stream proxy send PROXY protocol header);
+
+p = ngx_proxy_protocol_write(c, u-downstream_buf.last,
+ u-downstream_buf.end);
+if (p == NULL) {
+ngx_stream_proxy_finalize(s, NGX_ERROR);
+

[nginx] Core: renamed ngx_proxy_protocol_parse to ngx_proxy_prot...

2015-06-16 Thread Roman Arutyunyan
details:   http://hg.nginx.org/nginx/rev/a420cb1c170b
branches:  
changeset: 6185:a420cb1c170b
user:  Roman Arutyunyan a...@nginx.com
date:  Tue Jun 16 13:45:19 2015 +0300
description:
Core: renamed ngx_proxy_protocol_parse to ngx_proxy_protocol_read.

The new name is consistent with the ngx_proxy_protocol_write function.

diffstat:

 src/core/ngx_proxy_protocol.c |  2 +-
 src/core/ngx_proxy_protocol.h |  2 +-
 src/http/ngx_http_request.c   |  4 ++--
 src/http/ngx_http_spdy.c  |  2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diffs (57 lines):

diff -r fa663739e115 -r a420cb1c170b src/core/ngx_proxy_protocol.c
--- a/src/core/ngx_proxy_protocol.c Tue Jun 16 13:45:16 2015 +0300
+++ b/src/core/ngx_proxy_protocol.c Tue Jun 16 13:45:19 2015 +0300
@@ -10,7 +10,7 @@
 
 
 u_char *
-ngx_proxy_protocol_parse(ngx_connection_t *c, u_char *buf, u_char *last)
+ngx_proxy_protocol_read(ngx_connection_t *c, u_char *buf, u_char *last)
 {
 size_t  len;
 u_char  ch, *p, *addr;
diff -r fa663739e115 -r a420cb1c170b src/core/ngx_proxy_protocol.h
--- a/src/core/ngx_proxy_protocol.h Tue Jun 16 13:45:16 2015 +0300
+++ b/src/core/ngx_proxy_protocol.h Tue Jun 16 13:45:19 2015 +0300
@@ -16,7 +16,7 @@
 #define NGX_PROXY_PROTOCOL_MAX_HEADER  107
 
 
-u_char *ngx_proxy_protocol_parse(ngx_connection_t *c, u_char *buf,
+u_char *ngx_proxy_protocol_read(ngx_connection_t *c, u_char *buf,
 u_char *last);
 u_char *ngx_proxy_protocol_write(ngx_connection_t *c, u_char *buf,
 u_char *last);
diff -r fa663739e115 -r a420cb1c170b src/http/ngx_http_request.c
--- a/src/http/ngx_http_request.c   Tue Jun 16 13:45:16 2015 +0300
+++ b/src/http/ngx_http_request.c   Tue Jun 16 13:45:19 2015 +0300
@@ -467,7 +467,7 @@ ngx_http_wait_request_handler(ngx_event_
 if (hc-proxy_protocol) {
 hc-proxy_protocol = 0;
 
-p = ngx_proxy_protocol_parse(c, b-pos, b-last);
+p = ngx_proxy_protocol_read(c, b-pos, b-last);
 
 if (p == NULL) {
 ngx_http_close_connection(c);
@@ -675,7 +675,7 @@ ngx_http_ssl_handshake(ngx_event_t *rev)
 if (hc-proxy_protocol) {
 hc-proxy_protocol = 0;
 
-p = ngx_proxy_protocol_parse(c, buf, buf + n);
+p = ngx_proxy_protocol_read(c, buf, buf + n);
 
 if (p == NULL) {
 ngx_http_close_connection(c);
diff -r fa663739e115 -r a420cb1c170b src/http/ngx_http_spdy.c
--- a/src/http/ngx_http_spdy.c  Tue Jun 16 13:45:16 2015 +0300
+++ b/src/http/ngx_http_spdy.c  Tue Jun 16 13:45:19 2015 +0300
@@ -866,7 +866,7 @@ ngx_http_spdy_proxy_protocol(ngx_http_sp
 log = sc-connection-log;
 log-action = reading PROXY protocol;
 
-pos = ngx_proxy_protocol_parse(sc-connection, pos, end);
+pos = ngx_proxy_protocol_read(sc-connection, pos, end);
 
 log-action = processing SPDY;
 

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


RE: Content-Type

2015-06-16 Thread Lukas Tribus
 Hi,
 ?php
 header('Content-Type: text/html;');

Thats invalid. Either:
text/html; charset=iso-8859-1
or
text/html

but not with a trailing semicolon.



 breaks proper Content-Type detection.

... in a Browser, you mean?



 At least in the 1.6.3 version.

What has nginx to do with it and why is this
posted on nginx-devel? Unless you are posting
a patch, you should post to the nginx mailing
list.


Lukas

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


Re: Content-Type [PATCH]

2015-06-16 Thread Valentin V. Bartenev
On Tuesday 16 June 2015 13:35:55 Witold Filipczyk wrote:
 On Tue, Jun 16, 2015 at 12:37:39PM +0200, Lukas Tribus wrote:
   Hi,
   ?php
   header('Content-Type: text/html;');
  
  Thats invalid. Either:
  text/html; charset=iso-8859-1
  or
  text/html
  
  but not with a trailing semicolon.
 
 Content-Type is used in many places in nginx, for example in the sub module.
 In the above example, the content-type is cheated.
 
[..]

As already pointed out text/html; isn't a valid media type.
See RFC 7231: https://tools.ietf.org/html/rfc7231#section-3.1.1.1

Please fix your application.

  wbr, Valentin V. Bartenev

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