comparison src/http/ngx_http_variables.c @ 2539:051e9b12428e

fix segfault introduced in r2486 in $sent_http_location processing
author Igor Sysoev <igor@sysoev.ru>
date Tue, 24 Feb 2009 22:02:08 +0000
parents a6d6d762c554
children 2f3c80ff2123
comparison
equal deleted inserted replaced
2538:c5bbb6164630 2539:051e9b12428e
1314 1314
1315 static ngx_int_t 1315 static ngx_int_t
1316 ngx_http_variable_sent_location(ngx_http_request_t *r, 1316 ngx_http_variable_sent_location(ngx_http_request_t *r,
1317 ngx_http_variable_value_t *v, uintptr_t data) 1317 ngx_http_variable_value_t *v, uintptr_t data)
1318 { 1318 {
1319 ngx_str_t name;
1320
1319 if (r->headers_out.location) { 1321 if (r->headers_out.location) {
1320 v->len = r->headers_out.location->value.len; 1322 v->len = r->headers_out.location->value.len;
1321 v->valid = 1; 1323 v->valid = 1;
1322 v->no_cacheable = 0; 1324 v->no_cacheable = 0;
1323 v->not_found = 0; 1325 v->not_found = 0;
1324 v->data = r->headers_out.location->value.data; 1326 v->data = r->headers_out.location->value.data;
1325 1327
1326 return NGX_OK; 1328 return NGX_OK;
1327 } 1329 }
1328 1330
1329 return ngx_http_variable_unknown_header(v, (ngx_str_t *) data, 1331 name.len = sizeof("sent_http_location") - 1;
1332 name.data = (u_char *) "sent_http_location";
1333
1334 return ngx_http_variable_unknown_header(v, &name,
1330 &r->headers_out.headers.part, 1335 &r->headers_out.headers.part,
1331 sizeof("sent_http_") - 1); 1336 sizeof("sent_http_") - 1);
1332 } 1337 }
1333 1338
1334 1339