u_char *location;
ngx_http_core_loc_conf_t *clcf;
- r->headers_out.location = ngx_palloc(r->pool, sizeof(ngx_table_elt_t));
+ r->headers_out.location = ngx_list_push(&r->headers_out.headers);
if (r->headers_out.location == NULL) {
return NGX_ERROR;
}
ngx_memcpy(location, r->uri.data, r->uri.len);
}
- /*
- * we do not need to set the r->headers_out.location->hash and
- * r->headers_out.location->key fields
- */
-
+ r->headers_out.location->hash = 1;
+ ngx_str_set(&r->headers_out.location->key, "Location");
r->headers_out.location->value.len = r->uri.len;
r->headers_out.location->value.data = location;
ngx_http_clear_location(r);
- r->headers_out.location = ngx_palloc(r->pool, sizeof(ngx_table_elt_t));
+ r->headers_out.location = ngx_list_push(&r->headers_out.headers);
if (r->headers_out.location == NULL) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
}
}
- /*
- * we do not need to set the r->headers_out.location->hash and
- * r->headers_out.location->key fields
- */
-
+ r->headers_out.location->hash = 1;
+ ngx_str_set(&r->headers_out.location->key, "Location");
r->headers_out.location->value.len = len;
r->headers_out.location->value.data = location;
return NGX_OK;
}
- /*
- * we do not need to set the r->headers_out.location->hash and
- * r->headers_out.location->key fields
- */
+ r->headers_out.location->hash = 1;
+ ngx_str_set(&r->headers_out.location->key, "Location");
if (r->args.len == 0) {
r->headers_out.location->value = clcf->name;
}
/*
- * we do not set r->headers_out.location here to avoid the handling
- * the local redirects without a host name by ngx_http_header_filter()
+ * we do not set r->headers_out.location here to avoid handling
+ * relative redirects in ngx_http_header_filter()
*/
return NGX_OK;