fix segfault if $server_addr failed

This commit is contained in:
Igor Sysoev 2006-10-20 19:07:50 +00:00
parent 3d0a7168a9
commit 44d8bc2ff1
3 changed files with 14 additions and 1 deletions

View File

@ -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);
}

View File

@ -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] == '.') {

View File

@ -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];
}