Retrieves ui32_t entry

This commit is contained in:
Cuong Hoang 2014-03-18 09:40:28 +11:00
parent 48435ecb0f
commit 22e52ffad1

View file

@ -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_http_geoip2_conf_t *gcf;
ngx_addr_t addr; ngx_addr_t addr;
ngx_array_t *xfwd; ngx_array_t *xfwd;
u_char *p;
#if (NGX_HAVE_INET6) #if (NGX_HAVE_INET6)
uint8_t address[16], *addressp = address; 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->data = (u_char *) entry_data.utf8_string;
v->len = entry_data.data_size; v->len = entry_data.data_size;
break; 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: default:
goto not_found; goto not_found;
} }