diff src/http/ngx_http_core_module.c @ 70:8ad297c88dcb NGINX_0_1_35

nginx 0.1.35 *) Feature: the "working_directory" directive. *) Feature: the "port_in_redirect" directive. *) Bugfix: the segmentation fault was occurred if the backend response header was in several packets; bug appeared in 0.1.29. *) Bugfix: if more than 10 servers were configured or some server did not use the "listen" directive, then the segmentation fault was occurred on the start. *) Bugfix: the segmentation fault might occur if the response was bigger than the temporary file. *) Bugfix: nginx returned the 400 response on requests like "GET http://www.domain.com/uri HTTP/1.0"; bug appeared in 0.1.28.
author Igor Sysoev <http://sysoev.ru>
date Tue, 07 Jun 2005 00:00:00 +0400
parents 0790a8599248
children b31656313b59
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -319,6 +319,13 @@ static ngx_command_t  ngx_http_core_comm
       offsetof(ngx_http_core_loc_conf_t, reset_timedout_connection),
       NULL },
 
+    { ngx_string("port_in_redirect"),
+      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,
+      offsetof(ngx_http_core_loc_conf_t, port_in_redirect),
+      NULL },
+
     { ngx_string("msie_padding"),
       NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
       ngx_conf_set_flag_slot,
@@ -1113,10 +1120,10 @@ ngx_http_delay_handler(ngx_http_request_
 static char *
 ngx_http_core_server(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy)
 {
-    int                         m;
     char                       *rv;
     void                       *mconf;
-    ngx_conf_t                  save;
+    ngx_uint_t                  m;
+    ngx_conf_t                  pcf;
     ngx_http_module_t          *module;
     ngx_http_conf_ctx_t        *ctx, *http_ctx;
     ngx_http_core_srv_conf_t   *cscf, **cscfp;
@@ -1189,13 +1196,13 @@ ngx_http_core_server(ngx_conf_t *cf, ngx
 
     /* parse inside server{} */
 
-    save = *cf;
+    pcf = *cf;
     cf->ctx = ctx;
     cf->cmd_type = NGX_HTTP_SRV_CONF;
 
     rv = ngx_conf_parse(cf, NULL);
 
-    *cf = save;
+    *cf = pcf;
 
     if (rv != NGX_CONF_OK) {
         return rv;
@@ -1622,6 +1629,7 @@ ngx_http_core_merge_srv_conf(ngx_conf_t 
         ls->port = (getuid() == 0) ? 80 : 8000;
 #endif
         ls->family = AF_INET;
+        ls->default_server = 0;
     }
 
     if (conf->server_names.nelts == 0) {
@@ -1726,6 +1734,7 @@ ngx_http_core_create_loc_conf(ngx_conf_t
     lcf->lingering_time = NGX_CONF_UNSET_MSEC;
     lcf->lingering_timeout = NGX_CONF_UNSET_MSEC;
     lcf->reset_timedout_connection = NGX_CONF_UNSET;
+    lcf->port_in_redirect = NGX_CONF_UNSET;
     lcf->msie_padding = NGX_CONF_UNSET;
 
     return lcf;
@@ -1839,6 +1848,7 @@ ngx_http_core_merge_loc_conf(ngx_conf_t 
 
     ngx_conf_merge_value(conf->reset_timedout_connection,
                               prev->reset_timedout_connection, 0);
+    ngx_conf_merge_value(conf->port_in_redirect, prev->port_in_redirect, 1);
     ngx_conf_merge_value(conf->msie_padding, prev->msie_padding, 1);
 
     if (conf->open_files == NULL) {
@@ -1857,8 +1867,8 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx
     u_char             *addr;
     ngx_int_t           port;
     ngx_uint_t          p;
+    ngx_str_t          *args;
     struct hostent     *h;
-    ngx_str_t          *args;
     ngx_http_listen_t  *ls;
 
     /*
@@ -1874,9 +1884,9 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx
     /* AF_INET only */
 
     ls->family = AF_INET;
-    ls->default_server = 0;
     ls->file_name = cf->conf_file->file.name;
     ls->line = cf->conf_file->line;
+    ls->default_server = 0;
 
     args = cf->args->elts;
     addr = args[1].data;