Skip to content

Commit 064dd0c

Browse files
committed
worked around a bug in ngx_http_subrequest regarding r->headers_in inheritance.
1 parent 16c4dd1 commit 064dd0c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/ngx_http_srcache_util.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,24 @@ ngx_http_srcache_adjust_subrequest(ngx_http_request_t *sr,
155155
{
156156
ngx_table_elt_t *h;
157157
ngx_http_core_main_conf_t *cmcf;
158+
ngx_http_request_t *r;
158159

159160
sr->method = parsed_sr->method;
160161
sr->method_name = parsed_sr->method_name;
161162

163+
r = sr->parent;
164+
162165
dd("subrequest method: %d %.*s", (int) sr->method,
163166
(int) sr->method_name.len, sr->method_name.data);
164167

165-
sr->header_in = sr->parent->header_in;
168+
sr->header_in = r->header_in;
169+
170+
#if 1
171+
/* XXX work-around a bug in ngx_http_subrequest */
172+
if (r->headers_in.headers.last == &r->headers_in.headers.part) {
173+
sr->headers_in.headers.last = &sr->headers_in.headers.part;
174+
}
175+
#endif
166176

167177
/* we do not inherit the parent request's variables */
168178
cmcf = ngx_http_get_module_main_conf(sr, ngx_http_core_module);

0 commit comments

Comments
 (0)