comparison src/http/ngx_http_variables.c @ 5084:f7fe817c92a2

Correctly handle multiple X-Forwarded-For headers (ticket #106).
author Ruslan Ermilov <ru@nginx.com>
date Wed, 27 Feb 2013 13:29:50 +0000
parents a805dc9c85cd
children a64c8a5da336 3169a9b2250d
comparison
equal deleted inserted replaced
5083:a805dc9c85cd 5084:f7fe817c92a2
136 * 136 *
137 * Apache SSI: DOCUMENT_NAME, LAST_MODIFIED, USER_NAME (file owner) 137 * Apache SSI: DOCUMENT_NAME, LAST_MODIFIED, USER_NAME (file owner)
138 */ 138 */
139 139
140 /* 140 /*
141 * the $http_host, $http_user_agent, $http_referer, $http_via, 141 * the $http_host, $http_user_agent, $http_referer, and $http_via
142 * and $http_x_forwarded_for variables may be handled by generic 142 * variables may be handled by generic
143 * ngx_http_variable_unknown_header_in(), but for performance reasons 143 * ngx_http_variable_unknown_header_in(), but for performance reasons
144 * they are handled using dedicated entries 144 * they are handled using dedicated entries
145 */ 145 */
146 146
147 static ngx_http_variable_t ngx_http_core_variables[] = { 147 static ngx_http_variable_t ngx_http_core_variables[] = {
159 { ngx_string("http_via"), NULL, ngx_http_variable_header, 159 { ngx_string("http_via"), NULL, ngx_http_variable_header,
160 offsetof(ngx_http_request_t, headers_in.via), 0, 0 }, 160 offsetof(ngx_http_request_t, headers_in.via), 0, 0 },
161 #endif 161 #endif
162 162
163 #if (NGX_HTTP_X_FORWARDED_FOR) 163 #if (NGX_HTTP_X_FORWARDED_FOR)
164 { ngx_string("http_x_forwarded_for"), NULL, ngx_http_variable_header, 164 { ngx_string("http_x_forwarded_for"), NULL, ngx_http_variable_headers,
165 offsetof(ngx_http_request_t, headers_in.x_forwarded_for), 0, 0 }, 165 offsetof(ngx_http_request_t, headers_in.x_forwarded_for), 0, 0 },
166 #endif 166 #endif
167 167
168 { ngx_string("http_cookie"), NULL, ngx_http_variable_cookies, 168 { ngx_string("http_cookie"), NULL, ngx_http_variable_cookies,
169 offsetof(ngx_http_request_t, headers_in.cookies), 0, 0 }, 169 offsetof(ngx_http_request_t, headers_in.cookies), 0, 0 },