mirror of
https://github.com/nginx/nginx.git
synced 2025-06-10 19:42:39 +08:00
Geo: fixed the "ranges" without ranges case.
The following configuration returned an empty value for $geo: geo $geo { ranges; default default; }
This commit is contained in:
parent
cd04ca3546
commit
18a7e1b359
@ -189,19 +189,22 @@ ngx_http_geo_range_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,
|
|||||||
|
|
||||||
*v = *ctx->u.high.default_value;
|
*v = *ctx->u.high.default_value;
|
||||||
|
|
||||||
addr = ngx_http_geo_addr(r, ctx);
|
if (ctx->u.high.low) {
|
||||||
|
addr = ngx_http_geo_addr(r, ctx);
|
||||||
range = ctx->u.high.low[addr >> 16];
|
|
||||||
|
range = ctx->u.high.low[addr >> 16];
|
||||||
if (range) {
|
|
||||||
n = addr & 0xffff;
|
if (range) {
|
||||||
do {
|
n = addr & 0xffff;
|
||||||
if (n >= (ngx_uint_t) range->start && n <= (ngx_uint_t) range->end)
|
do {
|
||||||
{
|
if (n >= (ngx_uint_t) range->start
|
||||||
*v = *range->value;
|
&& n <= (ngx_uint_t) range->end)
|
||||||
break;
|
{
|
||||||
}
|
*v = *range->value;
|
||||||
} while ((++range)->value);
|
break;
|
||||||
|
}
|
||||||
|
} while ((++range)->value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||||
@ -384,9 +387,9 @@ ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||||||
geo->proxies = ctx.proxies;
|
geo->proxies = ctx.proxies;
|
||||||
geo->proxy_recursive = ctx.proxy_recursive;
|
geo->proxy_recursive = ctx.proxy_recursive;
|
||||||
|
|
||||||
if (ctx.high.low) {
|
if (ctx.ranges) {
|
||||||
|
|
||||||
if (!ctx.binary_include) {
|
if (ctx.high.low && !ctx.binary_include) {
|
||||||
for (i = 0; i < 0x10000; i++) {
|
for (i = 0; i < 0x10000; i++) {
|
||||||
a = (ngx_array_t *) ctx.high.low[i];
|
a = (ngx_array_t *) ctx.high.low[i];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user