mirror of
https://github.com/nginx/nginx.git
synced 2025-06-11 12:22:41 +08:00
fix segfault if $server_addr failed
This commit is contained in:
parent
3d0a7168a9
commit
44d8bc2ff1
@ -250,6 +250,10 @@ ngx_http_charset_header_filter(ngx_http_request_t *r)
|
||||
vv = ngx_http_get_indexed_variable(r,
|
||||
charset - NGX_HTTP_CHARSET_VAR);
|
||||
|
||||
if (vv == NULL || vv->not_found) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
charset = ngx_http_charset_get_charset(charsets, n,
|
||||
(ngx_str_t *) vv);
|
||||
}
|
||||
@ -293,6 +297,10 @@ ngx_http_charset_header_filter(ngx_http_request_t *r)
|
||||
vv = ngx_http_get_indexed_variable(r,
|
||||
source_charset - NGX_HTTP_CHARSET_VAR);
|
||||
|
||||
if (vv == NULL || vv->not_found) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
source_charset = ngx_http_charset_get_charset(charsets, n,
|
||||
(ngx_str_t *) vv);
|
||||
}
|
||||
|
@ -115,6 +115,11 @@ ngx_http_map_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,
|
||||
|
||||
vv = ngx_http_get_flushed_variable(r, map->index);
|
||||
|
||||
if (vv == NULL || vv->not_found) {
|
||||
*v = *map->default_value;
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
len = vv->len;
|
||||
|
||||
if (len && map->hostnames && vv->data[len - 1] == '.') {
|
||||
|
@ -367,7 +367,7 @@ ngx_http_get_indexed_variable(ngx_http_request_t *r, ngx_uint_t index)
|
||||
r->variables[index].valid = 0;
|
||||
r->variables[index].not_found = 1;
|
||||
|
||||
return NULL;
|
||||
return &r->variables[index];
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user