geoip2 directive support relative path as first argument

This commit is contained in:
qlee 2018-05-02 18:32:31 +08:00
parent e39fdd7bf8
commit 6fac846f3d
2 changed files with 12 additions and 0 deletions

View file

@ -312,6 +312,12 @@ ngx_http_geoip2(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
value = cf->args->elts;
if (value[1].data && value[1].data[0] != '/') {
if (ngx_conf_full_name(cf->cycle, &value[1], 0) != NGX_OK) {
return NGX_CONF_ERROR;
}
}
if (gcf->databases == NULL) {
gcf->databases = ngx_array_create(cf->pool, 2,
sizeof(ngx_http_geoip2_db_t));

View file

@ -279,6 +279,12 @@ ngx_stream_geoip2(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
value = cf->args->elts;
if (value[1].data && value[1].data[0] != '/') {
if (ngx_conf_full_name(cf->cycle, &value[1], 0) != NGX_OK) {
return NGX_CONF_ERROR;
}
}
if (gcf->databases == NULL) {
gcf->databases = ngx_array_create(cf->pool, 2,
sizeof(ngx_stream_geoip2_db_t));