From 22e52ffad12ff46f22a3cd4714468596c83f4d76 Mon Sep 17 00:00:00 2001 From: Cuong Hoang Date: Tue, 18 Mar 2014 09:40:28 +1100 Subject: [PATCH 1/2] Retrieves ui32_t entry --- ngx_http_geoip2_module.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ngx_http_geoip2_module.c b/ngx_http_geoip2_module.c index fbda61b..00a0594 100644 --- a/ngx_http_geoip2_module.c +++ b/ngx_http_geoip2_module.c @@ -121,6 +121,7 @@ ngx_http_geoip2_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, ngx_http_geoip2_conf_t *gcf; ngx_addr_t addr; ngx_array_t *xfwd; + u_char *p; #if (NGX_HAVE_INET6) uint8_t address[16], *addressp = address; @@ -194,6 +195,14 @@ ngx_http_geoip2_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, v->data = (u_char *) entry_data.utf8_string; v->len = entry_data.data_size; break; + case MMDB_DATA_TYPE_UINT32: + p = ngx_palloc(r->pool, NGX_OFF_T_LEN); + if (p == NULL) { + return NGX_ERROR; + } + v->len = ngx_sprintf(p, "%O", entry_data.uint32) - p; + v->data = p; + break; default: goto not_found; } From dc49f10d921ebc5e8f230f6a6518548f3a1ca28b Mon Sep 17 00:00:00 2001 From: JIRA DVCS Date: Wed, 23 Apr 2014 22:22:02 +1000 Subject: [PATCH 2/2] Fix indentation --- ngx_http_geoip2_module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ngx_http_geoip2_module.c b/ngx_http_geoip2_module.c index 00a0594..8353717 100644 --- a/ngx_http_geoip2_module.c +++ b/ngx_http_geoip2_module.c @@ -121,7 +121,7 @@ ngx_http_geoip2_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, ngx_http_geoip2_conf_t *gcf; ngx_addr_t addr; ngx_array_t *xfwd; - u_char *p; + u_char *p; #if (NGX_HAVE_INET6) uint8_t address[16], *addressp = address; @@ -198,7 +198,7 @@ ngx_http_geoip2_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, case MMDB_DATA_TYPE_UINT32: p = ngx_palloc(r->pool, NGX_OFF_T_LEN); if (p == NULL) { - return NGX_ERROR; + return NGX_ERROR; } v->len = ngx_sprintf(p, "%O", entry_data.uint32) - p; v->data = p;