Skip to content

Commit

Permalink
Geo: fixed insertion of ranges specified in descending order.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdocguard committed Aug 23, 2016
1 parent f927ab8 commit 20de5f1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
11 changes: 8 additions & 3 deletions src/http/modules/ngx_http_geo_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
11 changes: 8 additions & 3 deletions src/stream/ngx_stream_geo_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down

0 comments on commit 20de5f1

Please sign in to comment.