aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules/ngx_http_geoip_module.c
diff options
context:
space:
mode:
authorSergey Kandaurov <pluknet@nginx.com>2022-06-22 18:34:58 +0400
committerSergey Kandaurov <pluknet@nginx.com>2022-06-22 18:34:58 +0400
commitc64e2ec1e94974193c286b63db4f58e6e499f5cb (patch)
tree144428623b095d53c37fbecd31b0026a321dfec6 /src/http/modules/ngx_http_geoip_module.c
parent854e41fec24e1f292ec5a951e7bfc9377afc0905 (diff)
parent1009f5586ccf07375595675227d296815d91b2f2 (diff)
downloadnginx-c64e2ec1e94974193c286b63db4f58e6e499f5cb.tar.gz
nginx-c64e2ec1e94974193c286b63db4f58e6e499f5cb.zip
Merged with the default branch.
Diffstat (limited to 'src/http/modules/ngx_http_geoip_module.c')
-rw-r--r--src/http/modules/ngx_http_geoip_module.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/http/modules/ngx_http_geoip_module.c b/src/http/modules/ngx_http_geoip_module.c
index 5ea4f5fb0..eaf98764f 100644
--- a/src/http/modules/ngx_http_geoip_module.c
+++ b/src/http/modules/ngx_http_geoip_module.c
@@ -240,16 +240,16 @@ static u_long
ngx_http_geoip_addr(ngx_http_request_t *r, ngx_http_geoip_conf_t *gcf)
{
ngx_addr_t addr;
- ngx_array_t *xfwd;
+ ngx_table_elt_t *xfwd;
struct sockaddr_in *sin;
addr.sockaddr = r->connection->sockaddr;
addr.socklen = r->connection->socklen;
/* addr.name = r->connection->addr_text; */
- xfwd = &r->headers_in.x_forwarded_for;
+ xfwd = r->headers_in.x_forwarded_for;
- if (xfwd->nelts > 0 && gcf->proxies != NULL) {
+ if (xfwd != NULL && gcf->proxies != NULL) {
(void) ngx_http_get_forwarded_addr(r, &addr, xfwd, NULL,
gcf->proxies, gcf->proxy_recursive);
}
@@ -292,7 +292,7 @@ static geoipv6_t
ngx_http_geoip_addr_v6(ngx_http_request_t *r, ngx_http_geoip_conf_t *gcf)
{
ngx_addr_t addr;
- ngx_array_t *xfwd;
+ ngx_table_elt_t *xfwd;
in_addr_t addr4;
struct in6_addr addr6;
struct sockaddr_in *sin;
@@ -302,9 +302,9 @@ ngx_http_geoip_addr_v6(ngx_http_request_t *r, ngx_http_geoip_conf_t *gcf)
addr.socklen = r->connection->socklen;
/* addr.name = r->connection->addr_text; */
- xfwd = &r->headers_in.x_forwarded_for;
+ xfwd = r->headers_in.x_forwarded_for;
- if (xfwd->nelts > 0 && gcf->proxies != NULL) {
+ if (xfwd != NULL && gcf->proxies != NULL) {
(void) ngx_http_get_forwarded_addr(r, &addr, xfwd, NULL,
gcf->proxies, gcf->proxy_recursive);
}