diff src/http/modules/ngx_http_proxy_module.c @ 78:9db7e0b5b27f NGINX_0_1_39

nginx 0.1.39 *) The changes in the ngx_http_charset_module: the "default_charset" directive was canceled; the "charset" directive sets the response charset; the "source_charset" directive sets the source charset only. *) Bugfix: the backend "WWW-Authenticate" header line did not transferred while the 401 response code redirecting. *) Bugfix: the ngx_http_proxy_module and ngx_http_fastcgi_module may close a connection before anything was transferred to a client; bug appeared in 0.1.38. *) Workaround: the Linux glibc crypt_r() initialization bug. *) Bugfix: the ngx_http_ssi_module did not support the relative URI in the "include virtual" command. *) Bugfix: if the backend response had the "Location" header line and nginx should not rewrite this line, then the 500 code response body was transferred; bug appeared in 0.1.29. *) Bugfix: some directives of the ngx_http_proxy_module and ngx_http_fastcgi_module were not inherited from the server to the location level; bug appeared in 0.1.29. *) Bugfix: the ngx_http_ssl_module did not support the certificate chain. *) Bugfix: the ngx_http_autoindex_module did not show correctly the long file names; bug appeared in 0.1.38. *) Bugfixes in IMAP/POP3 proxy in interaction with a backend at the login state.
author Igor Sysoev <http://sysoev.ru>
date Thu, 14 Jul 2005 00:00:00 +0400
parents da9a3b14312d
children 2aa14f638cf0
line wrap: on
line diff
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -219,7 +219,7 @@ static ngx_command_t  ngx_http_proxy_com
       NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
       ngx_conf_set_size_slot,
       NGX_HTTP_LOC_CONF_OFFSET,
-      offsetof(ngx_http_proxy_loc_conf_t, upstream.busy_buffers_size),
+      offsetof(ngx_http_proxy_loc_conf_t, upstream.busy_buffers_size_conf),
       NULL },
 
     { ngx_string("proxy_temp_path"),
@@ -233,14 +233,14 @@ static ngx_command_t  ngx_http_proxy_com
       NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
       ngx_conf_set_size_slot,
       NGX_HTTP_LOC_CONF_OFFSET,
-      offsetof(ngx_http_proxy_loc_conf_t, upstream.max_temp_file_size),
+      offsetof(ngx_http_proxy_loc_conf_t, upstream.max_temp_file_size_conf),
       NULL },
 
     { ngx_string("proxy_temp_file_write_size"),
       NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
       ngx_conf_set_size_slot,
       NGX_HTTP_LOC_CONF_OFFSET,
-      offsetof(ngx_http_proxy_loc_conf_t, upstream.temp_file_write_size),
+      offsetof(ngx_http_proxy_loc_conf_t, upstream.temp_file_write_size_conf),
       NULL },
 
     { ngx_string("proxy_next_upstream"),
@@ -720,21 +720,21 @@ ngx_http_proxy_process_status_line(ngx_h
         return NGX_OK;
     }
 
-    r->headers_out.status = p->status;
+    u->headers_in.status_n = p->status;
     u->state->status = p->status;
 
-    r->headers_out.status_line.len = p->status_end - p->status_start;
-    r->headers_out.status_line.data = ngx_palloc(r->pool,
-                                                r->headers_out.status_line.len);
-    if (r->headers_out.status_line.data == NULL) {
+    u->headers_in.status_line.len = p->status_end - p->status_start;
+    u->headers_in.status_line.data = ngx_palloc(r->pool,
+                                                u->headers_in.status_line.len);
+    if (u->headers_in.status_line.data == NULL) {
         return NGX_HTTP_INTERNAL_SERVER_ERROR;
     }
-    ngx_memcpy(r->headers_out.status_line.data, p->status_start,
-               r->headers_out.status_line.len);
+    ngx_memcpy(u->headers_in.status_line.data, p->status_start,
+               u->headers_in.status_line.len);
 
     ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                    "http proxy status %ui \"%V\"",
-                   r->headers_out.status, &r->headers_out.status_line);
+                   u->headers_in.status, &u->headers_in.status_line);
 
     u->process_header = ngx_http_proxy_process_header;
 
@@ -1301,9 +1301,10 @@ ngx_http_proxy_create_loc_conf(ngx_conf_
 
     conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE;
     conf->upstream.header_buffer_size = NGX_CONF_UNSET_SIZE;
-    conf->upstream.busy_buffers_size = NGX_CONF_UNSET_SIZE;
-    conf->upstream.max_temp_file_size = NGX_CONF_UNSET_SIZE;  
-    conf->upstream.temp_file_write_size = NGX_CONF_UNSET_SIZE;
+
+    conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE;
+    conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE;  
+    conf->upstream.temp_file_write_size_conf = NGX_CONF_UNSET_SIZE;
 
     conf->upstream.pass_unparsed_uri = NGX_CONF_UNSET;
     conf->upstream.method = NGX_CONF_UNSET_UINT;
@@ -1374,23 +1375,28 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t
     }
 
 
-    ngx_conf_merge_size_value(conf->upstream.busy_buffers_size,
-                              prev->upstream.busy_buffers_size,
+    ngx_conf_merge_size_value(conf->upstream.busy_buffers_size_conf,
+                              prev->upstream.busy_buffers_size_conf,
                               NGX_CONF_UNSET_SIZE);
 
-    if (conf->upstream.busy_buffers_size == NGX_CONF_UNSET_SIZE) {
+    if (conf->upstream.busy_buffers_size_conf == NGX_CONF_UNSET_SIZE) {
         conf->upstream.busy_buffers_size = 2 * size;
-
-    } else if (conf->upstream.busy_buffers_size < size) {
+    } else {
+        conf->upstream.busy_buffers_size =
+                                         conf->upstream.busy_buffers_size_conf;
+    }
+    
+    if (conf->upstream.busy_buffers_size < size) {
         ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
              "\"proxy_busy_buffers_size\" must be equal or bigger than "
              "maximum of the value of \"proxy_header_buffer_size\" and "
              "one of the \"proxy_buffers\"");
 
         return NGX_CONF_ERROR;
+    }
 
-    } else if (conf->upstream.busy_buffers_size
-               > (conf->upstream.bufs.num - 1) * conf->upstream.bufs.size)
+    if (conf->upstream.busy_buffers_size
+        > (conf->upstream.bufs.num - 1) * conf->upstream.bufs.size)
     {
         ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
              "\"proxy_busy_buffers_size\" must be less than "
@@ -1398,16 +1404,20 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t
 
         return NGX_CONF_ERROR;
     }
-    
+
 
-    ngx_conf_merge_size_value(conf->upstream.temp_file_write_size,
-                              prev->upstream.temp_file_write_size,
+    ngx_conf_merge_size_value(conf->upstream.temp_file_write_size_conf,
+                              prev->upstream.temp_file_write_size_conf,
                               NGX_CONF_UNSET_SIZE);
 
-    if (conf->upstream.temp_file_write_size == NGX_CONF_UNSET_SIZE) {
+    if (conf->upstream.temp_file_write_size_conf == NGX_CONF_UNSET_SIZE) {
         conf->upstream.temp_file_write_size = 2 * size;
-
-    } else if (conf->upstream.temp_file_write_size < size) {
+    } else {
+        conf->upstream.temp_file_write_size =
+                                      conf->upstream.temp_file_write_size_conf;
+    }
+    
+    if (conf->upstream.temp_file_write_size < size) {
         ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
              "\"proxy_temp_file_write_size\" must be equal or bigger than "
              "maximum of the value of \"proxy_header_buffer_size\" and "
@@ -1416,17 +1426,19 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t
         return NGX_CONF_ERROR;
     }
 
-
-    ngx_conf_merge_size_value(conf->upstream.max_temp_file_size,
-                              prev->upstream.max_temp_file_size,
+    ngx_conf_merge_size_value(conf->upstream.max_temp_file_size_conf,
+                              prev->upstream.max_temp_file_size_conf,
                               NGX_CONF_UNSET_SIZE);
 
-    if (conf->upstream.max_temp_file_size == NGX_CONF_UNSET_SIZE) {
-
+    if (conf->upstream.max_temp_file_size_conf == NGX_CONF_UNSET_SIZE) {
         conf->upstream.max_temp_file_size = 1024 * 1024 * 1024;
+    } else {
+        conf->upstream.max_temp_file_size =
+                                        conf->upstream.max_temp_file_size_conf;
+    }
 
-    } else if (conf->upstream.max_temp_file_size != 0
-               && conf->upstream.max_temp_file_size < size)
+    if (conf->upstream.max_temp_file_size != 0
+        && conf->upstream.max_temp_file_size < size)
     {
         ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
              "\"fastcgi_max_temp_file_size\" must be equal to zero to disable "
@@ -1437,6 +1449,7 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t
         return NGX_CONF_ERROR;
     }
 
+
     ngx_conf_merge_bitmask_value(conf->upstream.next_upstream,
                               prev->upstream.next_upstream,
                               (NGX_CONF_BITMASK_SET
@@ -1448,7 +1461,7 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t
                               NGX_HTTP_PROXY_TEMP_PATH, 1, 2, 0,
                               ngx_garbage_collector_temp_handler, cf);
 
-    ngx_conf_merge_msec_value(conf->upstream.pass_unparsed_uri,
+    ngx_conf_merge_value(conf->upstream.pass_unparsed_uri,
                               prev->upstream.pass_unparsed_uri, 0);
 
     if (conf->upstream.pass_unparsed_uri && conf->upstream.location->len > 1) {
@@ -1467,14 +1480,14 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t
     ngx_conf_merge_value(conf->upstream.pass_request_body,
                               prev->upstream.pass_request_body, 1);
 
-    ngx_conf_merge_msec_value(conf->upstream.redirect_errors,
+    ngx_conf_merge_value(conf->upstream.redirect_errors,
                               prev->upstream.redirect_errors, 0);
 
-    ngx_conf_merge_msec_value(conf->upstream.pass_x_powered_by,
+    ngx_conf_merge_value(conf->upstream.pass_x_powered_by,
                               prev->upstream.pass_x_powered_by, 1);
-    ngx_conf_merge_msec_value(conf->upstream.pass_server,
+    ngx_conf_merge_value(conf->upstream.pass_server,
                               prev->upstream.pass_server, 0);
-    ngx_conf_merge_msec_value(conf->upstream.pass_x_accel_expires,
+    ngx_conf_merge_value(conf->upstream.pass_x_accel_expires,
                               prev->upstream.pass_x_accel_expires, 0);
 
 
@@ -1508,7 +1521,6 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t
 
     if (conf->peers == NULL) {
         conf->peers = prev->peers;
-        conf->upstream = prev->upstream;
     }
 
     if (conf->headers_source == NULL) {