]> git.kaiwu.me - nginx.git/commitdiff
delete surplus upstream.schema field
authorIgor Sysoev <igor@sysoev.ru>
Wed, 10 Dec 2008 14:44:48 +0000 (14:44 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Wed, 10 Dec 2008 14:44:48 +0000 (14:44 +0000)
src/http/modules/ngx_http_fastcgi_module.c
src/http/modules/ngx_http_memcached_module.c
src/http/modules/ngx_http_proxy_module.c
src/http/ngx_http_upstream.h

index e4cfa6344a47b8243d3ba08f8942618063036755..88ea672ac34dc203cef4f5b7e1cc878b7c764fd4 100644 (file)
@@ -1681,7 +1681,6 @@ ngx_http_fastcgi_create_loc_conf(ngx_conf_t *cf)
      *     conf->upstream.next_upstream = 0;
      *     conf->upstream.temp_path = NULL;
      *     conf->upstream.hide_headers_hash = { NULL, 0 };
-     *     conf->upstream.schema = { 0, NULL };
      *     conf->upstream.uri = { 0, NULL };
      *     conf->upstream.location = NULL;
      *     conf->upstream.store_lengths = NULL;
@@ -1911,7 +1910,6 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
 
     if (conf->upstream.upstream == NULL) {
         conf->upstream.upstream = prev->upstream.upstream;
-        conf->upstream.schema = prev->upstream.schema;
     }
 
     if (conf->fastcgi_lengths == NULL) {
@@ -2107,16 +2105,13 @@ ngx_http_fastcgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
     ngx_http_core_loc_conf_t   *clcf;
     ngx_http_script_compile_t   sc;
 
-    if (flcf->upstream.schema.len) {
+    if (flcf->upstream.upstream || flcf->fastcgi_lengths) {
         return "is duplicate";
     }
 
     clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
     clcf->handler = ngx_http_fastcgi_handler;
 
-    flcf->upstream.schema.len = sizeof("fastcgi://") - 1;
-    flcf->upstream.schema.data = (u_char *) "fastcgi://";
-
     value = cf->args->elts;
 
     url = &value[1];
index 9a6fb1646813ba88acb63422961caeb8b54e5adc..8710d10d35339ded858cf0d71a134d7320c80a86 100644 (file)
@@ -183,7 +183,8 @@ ngx_http_memcached_handler(ngx_http_request_t *r)
         return NGX_HTTP_INTERNAL_SERVER_ERROR;
     }
 
-    u->schema = mlcf->upstream.schema;
+    u->schema.len = sizeof("memcached://") - 1;
+    u->schema.data = (u_char *) "memcached://";
 
     u->peer.log = r->connection->log;
     u->peer.log_error = NGX_ERROR_ERR;
@@ -521,7 +522,6 @@ ngx_http_memcached_create_loc_conf(ngx_conf_t *cf)
      *     conf->upstream.bufs.num = 0;
      *     conf->upstream.next_upstream = 0;
      *     conf->upstream.temp_path = NULL;
-     *     conf->upstream.schema = { 0, NULL };
      *     conf->upstream.uri = { 0, NULL };
      *     conf->upstream.location = NULL;
      */
@@ -584,7 +584,6 @@ ngx_http_memcached_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
 
     if (conf->upstream.upstream == NULL) {
         conf->upstream.upstream = prev->upstream.upstream;
-        conf->upstream.schema = prev->upstream.schema;
     }
 
     if (conf->index == NGX_CONF_UNSET) {
@@ -604,7 +603,7 @@ ngx_http_memcached_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
     ngx_url_t                  u;
     ngx_http_core_loc_conf_t  *clcf;
 
-    if (lcf->upstream.schema.len) {
+    if (lcf->upstream.upstream) {
         return "is duplicate";
     }
 
@@ -620,9 +619,6 @@ ngx_http_memcached_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
         return NGX_CONF_ERROR;
     }
 
-    lcf->upstream.schema.len = sizeof("memcached://") - 1;
-    lcf->upstream.schema.data = (u_char *) "memcached://";
-
     clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
 
     clcf->handler = ngx_http_memcached_handler;
index 5e98ad9d4cc1c0bb15bada71fed8c9faf7ddf2c2..2cf009bd9eddb51bac1dda41f9223cddb12781bb 100644 (file)
@@ -32,6 +32,7 @@ struct ngx_http_proxy_redirect_s {
 
 
 typedef struct {
+    ngx_str_t                      schema;
     ngx_str_t                      host_header;
     ngx_str_t                      port;
     ngx_str_t                      uri;
@@ -480,7 +481,7 @@ ngx_http_proxy_handler(ngx_http_request_t *r)
 
     if (plcf->proxy_lengths == 0) {
         ctx->vars = plcf->vars;
-        u->schema = plcf->upstream.schema;
+        u->schema = plcf->vars.schema;
 #if (NGX_HTTP_SSL)
         u->ssl = (plcf->upstream.ssl != NULL);
 #endif
@@ -1631,7 +1632,6 @@ ngx_http_proxy_create_loc_conf(ngx_conf_t *cf)
      *     conf->upstream.next_upstream = 0;
      *     conf->upstream.temp_path = NULL;
      *     conf->upstream.hide_headers_hash = { NULL, 0 };
-     *     conf->upstream.schema = { 0, NULL };
      *     conf->upstream.uri = { 0, NULL };
      *     conf->upstream.location = NULL;
      *     conf->upstream.store_lengths = NULL;
@@ -1931,9 +1931,7 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
 
     if (conf->upstream.upstream == NULL) {
         conf->upstream.upstream = prev->upstream.upstream;
-
         conf->vars = prev->vars;
-        conf->upstream.schema = prev->upstream.schema;
     }
 
 
@@ -2216,7 +2214,7 @@ ngx_http_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
     ngx_http_core_loc_conf_t   *clcf;
     ngx_http_script_compile_t   sc;
 
-    if (plcf->upstream.schema.len) {
+    if (plcf->upstream.upstream || plcf->proxy_lengths) {
         return "is duplicate";
     }
 
@@ -2296,8 +2294,8 @@ ngx_http_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
         return NGX_CONF_ERROR;
     }
 
-    plcf->upstream.schema.len = add;
-    plcf->upstream.schema.data = url->data;
+    plcf->vars.schema.len = add;
+    plcf->vars.schema.data = url->data;
     plcf->location = clcf->name;
 
     clcf->handler = ngx_http_proxy_handler;
index 3ec85f94bf73f824a06635be5559e97303a645ef..d38d6c0250f75a4eff7f14cd46f4a61ff7875be3 100644 (file)
@@ -144,8 +144,6 @@ typedef struct {
     ngx_array_t                    *hide_headers;
     ngx_array_t                    *pass_headers;
 
-    ngx_str_t                       schema;
-
     ngx_array_t                    *store_lengths;
     ngx_array_t                    *store_values;