Mercurial > hg > nginx
comparison src/http/modules/ngx_http_fastcgi_module.c @ 1097:df8cdf626c87
fix segfault when $fastcgi_script_name is used in access_log
and there was bad request (400)
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 09 Feb 2007 11:56:23 +0000 |
parents | c28c8bdb57f4 |
children | 2d978e1443ed |
comparison
equal
deleted
inserted
replaced
1096:57db008a70ce | 1097:df8cdf626c87 |
---|---|
1967 ngx_http_variable_value_t *v, uintptr_t data) | 1967 ngx_http_variable_value_t *v, uintptr_t data) |
1968 { | 1968 { |
1969 u_char *p; | 1969 u_char *p; |
1970 ngx_http_fastcgi_loc_conf_t *flcf; | 1970 ngx_http_fastcgi_loc_conf_t *flcf; |
1971 | 1971 |
1972 v->valid = 1; | 1972 if (r->uri.len) { |
1973 v->no_cachable = 0; | 1973 v->valid = 1; |
1974 v->not_found = 0; | 1974 v->no_cachable = 0; |
1975 | 1975 v->not_found = 0; |
1976 flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module); | 1976 |
1977 | 1977 flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module); |
1978 if (r->uri.data[r->uri.len - 1] != '/') { | 1978 |
1979 v->len = r->uri.len; | 1979 if (r->uri.data[r->uri.len - 1] != '/') { |
1980 v->data = r->uri.data; | 1980 v->len = r->uri.len; |
1981 v->data = r->uri.data; | |
1982 return NGX_OK; | |
1983 } | |
1984 | |
1985 v->len = r->uri.len + flcf->index.len; | |
1986 | |
1987 v->data = ngx_palloc(r->pool, v->len); | |
1988 if (v->data == NULL) { | |
1989 return NGX_ERROR; | |
1990 } | |
1991 | |
1992 p = ngx_copy(v->data, r->uri.data, r->uri.len); | |
1993 ngx_memcpy(p, flcf->index.data, flcf->index.len); | |
1994 | |
1995 } else { | |
1996 v->len = 0; | |
1997 v->valid = 1; | |
1998 v->no_cachable = 0; | |
1999 v->not_found = 0; | |
2000 v->data = NULL; | |
2001 | |
1981 return NGX_OK; | 2002 return NGX_OK; |
1982 } | 2003 } |
1983 | |
1984 v->len = r->uri.len + flcf->index.len; | |
1985 | |
1986 v->data = ngx_palloc(r->pool, v->len); | |
1987 if (v->data == NULL) { | |
1988 return NGX_ERROR; | |
1989 } | |
1990 | |
1991 p = ngx_copy(v->data, r->uri.data, r->uri.len); | |
1992 ngx_memcpy(p, flcf->index.data, flcf->index.len); | |
1993 | 2004 |
1994 return NGX_OK; | 2005 return NGX_OK; |
1995 } | 2006 } |
1996 | 2007 |
1997 | 2008 |