Merge pull request #50 from qlees/relative_path

geoip2 directive support relative path as first argument
This commit is contained in:
Lee 2018-05-14 20:13:51 +01:00 committed by GitHub
commit f4364b50b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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; 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) { if (gcf->databases == NULL) {
gcf->databases = ngx_array_create(cf->pool, 2, gcf->databases = ngx_array_create(cf->pool, 2,
sizeof(ngx_http_geoip2_db_t)); 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; 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) { if (gcf->databases == NULL) {
gcf->databases = ngx_array_create(cf->pool, 2, gcf->databases = ngx_array_create(cf->pool, 2,
sizeof(ngx_stream_geoip2_db_t)); sizeof(ngx_stream_geoip2_db_t));