[nginx] svn commit:  r4733 - in branches/stable-1.2: . auto src/http
    mdounin at mdounin.ru 
    mdounin at mdounin.ru
       
    Mon Jul  2 17:41:52 UTC 2012
    
    
  
Author: mdounin
Date: 2012-07-02 17:41:52 +0000 (Mon, 02 Jul 2012)
New Revision: 4733
URL: http://trac.nginx.org/nginx/changeset/4733/nginx
Log:
Merge of r4698: X-Forwarded-For conditionals.
Fixed compile-time conditionals used to detect if X-Forwarded-For support
is needed.
Note: compatibility shims where added during merge to avoid possible
breakage of 3rd party modules.  At least cache purge module was broken
by the original commit, as it used to rely on NGX_HTTP_PROXY define.
Modified:
   branches/stable-1.2/
   branches/stable-1.2/auto/modules
   branches/stable-1.2/src/http/ngx_http_request.c
   branches/stable-1.2/src/http/ngx_http_request.h
   branches/stable-1.2/src/http/ngx_http_variables.c
Index: branches/stable-1.2
===================================================================
--- branches/stable-1.2	2012-07-02 17:25:51 UTC (rev 4732)
+++ branches/stable-1.2	2012-07-02 17:41:52 UTC (rev 4733)
Property changes on: branches/stable-1.2
___________________________________________________________________
Modified: svn:mergeinfo
## -1 +1 ##
-/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4697,4699,4704-4706
+/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706
\ No newline at end of property
Modified: branches/stable-1.2/auto/modules
===================================================================
--- branches/stable-1.2/auto/modules	2012-07-02 17:25:51 UTC (rev 4732)
+++ branches/stable-1.2/auto/modules	2012-07-02 17:41:52 UTC (rev 4733)
@@ -223,6 +223,7 @@
 
 if [ $HTTP_REALIP = YES ]; then
     have=NGX_HTTP_REALIP . auto/have
+    have=NGX_HTTP_X_FORWARDED_FOR . auto/have
     HTTP_MODULES="$HTTP_MODULES $HTTP_REALIP_MODULE"
     HTTP_SRCS="$HTTP_SRCS $HTTP_REALIP_SRCS"
 fi
@@ -234,11 +235,13 @@
 
 if [ $HTTP_GEO = YES ]; then
     have=NGX_HTTP_GEO . auto/have
+    have=NGX_HTTP_X_FORWARDED_FOR . auto/have
     HTTP_MODULES="$HTTP_MODULES $HTTP_GEO_MODULE"
     HTTP_SRCS="$HTTP_SRCS $HTTP_GEO_SRCS"
 fi
 
 if [ $HTTP_GEOIP = YES ]; then
+    have=NGX_HTTP_X_FORWARDED_FOR . auto/have
     HTTP_MODULES="$HTTP_MODULES $HTTP_GEOIP_MODULE"
     HTTP_SRCS="$HTTP_SRCS $HTTP_GEOIP_SRCS"
 fi
@@ -274,6 +277,7 @@
 
 if [ $HTTP_PROXY = YES ]; then
     have=NGX_HTTP_PROXY . auto/have
+    have=NGX_HTTP_X_FORWARDED_FOR . auto/have
     #USE_MD5=YES
     HTTP_MODULES="$HTTP_MODULES $HTTP_PROXY_MODULE"
     HTTP_DEPS="$HTTP_DEPS $HTTP_PROXY_DEPS"
Modified: branches/stable-1.2/src/http/ngx_http_request.c
===================================================================
--- branches/stable-1.2/src/http/ngx_http_request.c	2012-07-02 17:25:51 UTC (rev 4732)
+++ branches/stable-1.2/src/http/ngx_http_request.c	2012-07-02 17:41:52 UTC (rev 4733)
@@ -138,7 +138,7 @@
     { ngx_string("Keep-Alive"), offsetof(ngx_http_headers_in_t, keep_alive),
                  ngx_http_process_header_line },
 
-#if (NGX_HTTP_PROXY || NGX_HTTP_REALIP || NGX_HTTP_GEO)
+#if (NGX_HTTP_X_FORWARDED_FOR)
     { ngx_string("X-Forwarded-For"),
                  offsetof(ngx_http_headers_in_t, x_forwarded_for),
                  ngx_http_process_header_line },
Modified: branches/stable-1.2/src/http/ngx_http_request.h
===================================================================
--- branches/stable-1.2/src/http/ngx_http_request.h	2012-07-02 17:25:51 UTC (rev 4732)
+++ branches/stable-1.2/src/http/ngx_http_request.h	2012-07-02 17:41:52 UTC (rev 4733)
@@ -137,6 +137,13 @@
 #define NGX_HTTP_COPY_BUFFERED             0x04
 
 
+#if (NGX_HTTP_PROXY || NGX_HTTP_REALIP || NGX_HTTP_GEO)
+#ifndef NGX_HTTP_X_FORWARDED_FOR
+#define NGX_HTTP_X_FORWARDED_FOR           1
+#endif
+#endif
+
+
 typedef enum {
     NGX_HTTP_INITING_REQUEST_STATE = 0,
     NGX_HTTP_READING_REQUEST_STATE,
@@ -192,7 +199,7 @@
 
     ngx_table_elt_t                  *keep_alive;
 
-#if (NGX_HTTP_PROXY || NGX_HTTP_REALIP || NGX_HTTP_GEO)
+#if (NGX_HTTP_X_FORWARDED_FOR)
     ngx_table_elt_t                  *x_forwarded_for;
 #endif
 
Modified: branches/stable-1.2/src/http/ngx_http_variables.c
===================================================================
--- branches/stable-1.2/src/http/ngx_http_variables.c	2012-07-02 17:25:51 UTC (rev 4732)
+++ branches/stable-1.2/src/http/ngx_http_variables.c	2012-07-02 17:41:52 UTC (rev 4733)
@@ -134,7 +134,7 @@
       offsetof(ngx_http_request_t, headers_in.via), 0, 0 },
 #endif
 
-#if (NGX_HTTP_PROXY || NGX_HTTP_REALIP)
+#if (NGX_HTTP_X_FORWARDED_FOR)
     { ngx_string("http_x_forwarded_for"), NULL, ngx_http_variable_header,
       offsetof(ngx_http_request_t, headers_in.x_forwarded_for), 0, 0 },
 #endif
    
    
More information about the nginx-devel
mailing list