diff src/http/ngx_http_request.c @ 6:80ba094c6b3e NGINX_0_1_3

nginx 0.1.3 *) Feature: the ngx_http_autoindex_module and the autoindex directive. *) Feature: the proxy_set_x_url directive. *) Bugfix: proxy module may get caught in an endless loop when sendfile is not used.
author Igor Sysoev <http://sysoev.ru>
date Mon, 25 Oct 2004 00:00:00 +0400
parents 4b2dafa26fe2
children 46833bd150cb
line wrap: on
line diff
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -84,6 +84,8 @@ ngx_http_header_t  ngx_http_headers_in[]
 #if (NGX_HTTP_PROXY)
     { ngx_string("X-Forwarded-For"),
                            offsetof(ngx_http_headers_in_t, x_forwarded_for) },
+    { ngx_string("X-Real-IP"), offsetof(ngx_http_headers_in_t, x_real_ip) },
+    { ngx_string("X-URL"), offsetof(ngx_http_headers_in_t, x_url) },
 #endif
     
     { ngx_null_string, 0 }
@@ -351,7 +353,7 @@ static void ngx_http_init_request(ngx_ev
 #endif
 
     server_name = cscf->server_names.elts;
-    r->server_name = &server_name->name;
+    r->server_name = server_name->name;
 
     clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
     c->log->file = clcf->err_log->file;
@@ -1122,7 +1124,14 @@ static ngx_int_t ngx_http_process_reques
 
             r->srv_conf = name[i].core_srv_conf->ctx->srv_conf;
             r->loc_conf = name[i].core_srv_conf->ctx->loc_conf;
-            r->server_name = &name[i].name;
+
+            if (name[i].wildcard) {
+                r->server_name.len = r->headers_in.host_name_len;
+                r->server_name.data = r->headers_in.host->value.data;
+
+            } else {
+                r->server_name = name[i].name;
+            }
 
             clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
             r->connection->log->file = clcf->err_log->file;