Mercurial > hg > nginx-vendor-current
comparison src/http/modules/ngx_http_geo_module.c @ 626:a7a5fa2e395b NGINX_1_0_3
nginx 1.0.3
*) Feature: the "auth_basic_user_file" directive supports "$apr1",
"{PLAIN}", and "{SSHA}" password encryption methods.
Thanks to Maxim Dounin.
*) Feature: the "geoip_org" directive and $geoip_org variable.
Thanks to Alexander Uskov, Arnaud Granal, and Denis F. Latypoff.
*) Feature: ngx_http_geo_module and ngx_http_geoip_module support IPv4
addresses mapped to IPv6 addresses.
*) Bugfix: a segmentation fault occurred in a worker process during
testing IPv4 address mapped to IPv6 address, if access or deny rules
were defined only for IPv6; the bug had appeared in 0.8.22.
*) Bugfix: a cached reponse may be broken if proxy/fastcgi/scgi/
uwsgi_cache_bypass and proxy/fastcgi/scgi/uwsgi_no_cache directive
values were different; the bug had appeared in 0.8.46.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 25 May 2011 00:00:00 +0400 |
parents | b4dcae568a2a |
children | d0f7a625f27c |
comparison
equal
deleted
inserted
replaced
625:30f948276abe | 626:a7a5fa2e395b |
---|---|
255 static in_addr_t | 255 static in_addr_t |
256 ngx_http_geo_real_addr(ngx_http_request_t *r, ngx_http_geo_ctx_t *ctx) | 256 ngx_http_geo_real_addr(ngx_http_request_t *r, ngx_http_geo_ctx_t *ctx) |
257 { | 257 { |
258 struct sockaddr_in *sin; | 258 struct sockaddr_in *sin; |
259 ngx_http_variable_value_t *v; | 259 ngx_http_variable_value_t *v; |
260 #if (NGX_HAVE_INET6) | |
261 u_char *p; | |
262 in_addr_t addr; | |
263 struct sockaddr_in6 *sin6; | |
264 #endif | |
260 | 265 |
261 if (ctx->index == -1) { | 266 if (ctx->index == -1) { |
262 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 267 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
263 "http geo started: %V", &r->connection->addr_text); | 268 "http geo started: %V", &r->connection->addr_text); |
264 | 269 |
265 if (r->connection->sockaddr->sa_family != AF_INET) { | 270 switch (r->connection->sockaddr->sa_family) { |
266 return 0; | 271 |
267 } | 272 case AF_INET: |
268 | 273 sin = (struct sockaddr_in *) r->connection->sockaddr; |
269 sin = (struct sockaddr_in *) r->connection->sockaddr; | 274 return ntohl(sin->sin_addr.s_addr); |
270 return ntohl(sin->sin_addr.s_addr); | 275 |
276 #if (NGX_HAVE_INET6) | |
277 | |
278 case AF_INET6: | |
279 sin6 = (struct sockaddr_in6 *) r->connection->sockaddr; | |
280 | |
281 if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { | |
282 p = sin6->sin6_addr.s6_addr; | |
283 addr = p[12] << 24; | |
284 addr += p[13] << 16; | |
285 addr += p[14] << 8; | |
286 addr += p[15]; | |
287 | |
288 return addr; | |
289 } | |
290 | |
291 #endif | |
292 } | |
293 | |
294 return INADDR_NONE; | |
271 } | 295 } |
272 | 296 |
273 v = ngx_http_get_flushed_variable(r, ctx->index); | 297 v = ngx_http_get_flushed_variable(r, ctx->index); |
274 | 298 |
275 if (v == NULL || v->not_found) { | 299 if (v == NULL || v->not_found) { |