Geo: fixed insertion of ranges specified in descending order.

This commit is contained in:
Ruslan Ermilov 2016-08-23 15:59:14 +03:00
parent 73f9b84fa9
commit e4331faa7f
2 changed files with 16 additions and 6 deletions

View File

@ -940,9 +940,14 @@ ngx_http_geo_add_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx,
return NGX_CONF_ERROR;
}
range->start = (u_short) s;
range->end = (u_short) e;
range->value = ctx->value;
range = a->elts;
ngx_memmove(&range[1], &range[0],
(a->nelts - 1) * sizeof(ngx_http_geo_range_t));
range[0].start = (u_short) s;
range[0].end = (u_short) e;
range[0].value = ctx->value;
next:

View File

@ -890,9 +890,14 @@ ngx_stream_geo_add_range(ngx_conf_t *cf, ngx_stream_geo_conf_ctx_t *ctx,
return NGX_CONF_ERROR;
}
range->start = (u_short) s;
range->end = (u_short) e;
range->value = ctx->value;
range = a->elts;
ngx_memmove(&range[1], &range[0],
(a->nelts - 1) * sizeof(ngx_stream_geo_range_t));
range[0].start = (u_short) s;
range[0].end = (u_short) e;
range[0].value = ctx->value;
next: