Welcome! Log In Create A New Profile


Setting headers on subrequests

Shawn Grunberger
July 11, 2009 03:28AM
I'm investigating a bug in Evan Miller's excellent mod_zip add-on.

The mod_zip code, running as a filter, issues one or more subrequests.
To support byte ranges, Evan sends a different Range header with each
subrequest (thus relying on nginx's built-in Range filter to do the
actual truncation). To accomplish this, the code modifies the
r->headers_in.range structure of the main request before each call to
ngx_http_subrequest (the code calls this "a dirty hack"). In
psuedocode it looks like this:

while (rc == NGX_OK && more_subrequests_to_make) {
modify r->headers_in.range
rc = ngx_http_subrequest(r, uri, args, &sr, NULL, 0)
return rc

Assume that each call to ngx_http_subrequest returns NGX_OK (in other
words, the subrequests require no network access). In that case, this
code works in nginx 0.7.24 and below. A subrequest's headers are
committed and sent immediately after the call to ngx_http_subrequest.
In 0.7.25 and above, however, this code fails to set a unique header
per subrequest. Instead, all subrequests inherit the Range header set
in the final loop iteration. In other words, no subrequest is
committed and sent until after the loop completes.

Is there a "proper" way to set different header values per subrequest?
Subject Author Posted

Setting headers on subrequests

Shawn Grunberger July 11, 2009 03:28AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 84
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 214 on March 20, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready