[nginx] Geo: fixed insertion of ranges specified in descending order.
Ruslan Ermilov
ru at nginx.com
Tue Aug 23 14:00:29 UTC 2016
details: http://hg.nginx.org/nginx/rev/53198d9bf84f
branches:
changeset: 6663:53198d9bf84f
user: Ruslan Ermilov <ru at nginx.com>
date: Tue Aug 23 15:59:14 2016 +0300
description:
Geo: fixed insertion of ranges specified in descending order.
diffstat:
src/http/modules/ngx_http_geo_module.c | 11 ++++++++---
src/stream/ngx_stream_geo_module.c | 11 ++++++++---
2 files changed, 16 insertions(+), 6 deletions(-)
diffs (42 lines):
diff -r 1301a58b5dac -r 53198d9bf84f src/http/modules/ngx_http_geo_module.c
--- a/src/http/modules/ngx_http_geo_module.c Tue Aug 23 15:59:06 2016 +0300
+++ b/src/http/modules/ngx_http_geo_module.c Tue Aug 23 15:59:14 2016 +0300
@@ -940,9 +940,14 @@ ngx_http_geo_add_range(ngx_conf_t *cf, n
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:
diff -r 1301a58b5dac -r 53198d9bf84f src/stream/ngx_stream_geo_module.c
--- a/src/stream/ngx_stream_geo_module.c Tue Aug 23 15:59:06 2016 +0300
+++ b/src/stream/ngx_stream_geo_module.c Tue Aug 23 15:59:14 2016 +0300
@@ -890,9 +890,14 @@ ngx_stream_geo_add_range(ngx_conf_t *cf,
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:
More information about the nginx-devel
mailing list