body filters for zero-sized subrequests
Evan Miller
emmiller at gmail.com
Wed Aug 22 12:45:20 MSD 2007
Hi Igor,
I have a module that issues subrequests and passes them through a body
filter. It seems that subrequests with zero size are not passed to the
body filter. Is this the intended behavior?
Thanks,
Evan
Source:
static ngx_int_t
ngx_http_zip_body_filter(ngx_http_request_t *r,
ngx_chain_t *in)
{
ngx_http_zip_ctx_t *ctx;
ngx_chain_t *chain_link;
int rc;
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"ngx_zip: entering body filter");
if (r != r->main) { /* subrequest */
...
Excerpts from debug log, main request + non-zero subrequest + zero
subrequest... "entering body filter" appears twice, not three times:
2007/08/22 01:21:30 [debug] 26369#0: *1 http output filter "/login/zip?"
2007/08/22 01:21:30 [debug] 26369#0: *1 copy filter: "/login/zip?"
2007/08/22 01:21:30 [debug] 26369#0: *1 ngx_zip: entering body filter
2007/08/22 01:21:30 [debug] 26369#0: *1 ngx_zip: about to parse
2007/08/22 01:21:30 [debug] 26369#0: *1 ngx_zip: parsing response buffer
of length 0
2007/08/22 01:21:30 [debug] 26369#0: *1 ngx_zip: parsed 2 file names
2007/08/22 01:21:30 [debug] 26369#0: *1 ngx_zip: initiating first of 2
subrequest(s)
2007/08/22 01:21:30 [debug] 26369#0: *1 ngx_zip: subrequest for
"/static/file.txt?" 08102508
2007/08/22 01:21:30 [debug] 26369#0: *1 http subrequest "/static/file.txt?"
...
2007/08/22 01:21:30 [debug] 26369#0: *1 http output filter
"/static/file.txt?"
2007/08/22 01:21:30 [debug] 26369#0: *1 copy filter: "/static/file.txt?"
2007/08/22 01:21:30 [debug] 26369#0: *1 read: 9, 08102D70, 68, 0
2007/08/22 01:21:30 [debug] 26369#0: *1 ngx_zip: entering body filter
2007/08/22 01:21:30 [debug] 26369#0: *1 ngx_zip: adding file header
"jeebus.html"
2007/08/22 01:21:30 [debug] 26369#0: *1 ngx_zip: adding file trailer
2007/08/22 01:21:30 [debug] 26369#0: *1 ngx_zip: processed 68/68 bytes
of file #0
2007/08/22 01:21:30 [debug] 26369#0: *1 http postpone filter
"/static/file.txt?" 08102DB4
2007/08/22 01:21:30 [debug] 26369#0: *1 http postpone filter out
"/static/file.txt?"
2007/08/22 01:21:30 [debug] 26369#0: *1 write new buf t:0 f:0 00000000,
pos 08102DF0, size: 54 file: 0, size: 0
2007/08/22 01:21:30 [debug] 26369#0: *1 write new buf t:1 f:0 08102D70,
pos 08102D70, size: 68 file: 0, size: 0
2007/08/22 01:21:30 [debug] 26369#0: *1 write new buf t:0 f:0 00000000,
pos 08102E64, size: 16 file: 0, size: 0
2007/08/22 01:21:30 [debug] 26369#0: *1 http write filter: l:0 f:0 s:138
2007/08/22 01:21:30 [debug] 26369#0: *1 copy filter: 0 "/static/file.txt?"
2007/08/22 01:21:30 [debug] 26369#0: *1 http finalize request: 0,
"/static/file.txt?"
2007/08/22 01:21:30 [debug] 26369#0: *1 event timer add: 6: 60000:2359976554
2007/08/22 01:21:30 [debug] 26369#0: *1 http parent request: "/login/zip?"
2007/08/22 01:21:30 [debug] 26369#0: *1 http request: "/login/zip?" has
postponed
2007/08/22 01:21:30 [debug] 26369#0: *1 http fast subrequest:
"/static/file.txt?" done
2007/08/22 01:21:30 [debug] 26369#0: *1 http subrequest done
"/static/file.txt?"
2007/08/22 01:21:30 [debug] 26369#0: *1 ngx_zip: subrequest for
"/static/file.txt?" 08102540
...
2007/08/22 01:21:30 [debug] 26369#0: *1 http write filter: l:0 f:0 s:276
2007/08/22 01:21:30 [debug] 26369#0: *1 copy filter: 0 "/static/file.txt?"
2007/08/22 01:21:30 [debug] 26369#0: *1 http finalize request: 0,
"/static/file.txt?"
2007/08/22 01:21:30 [debug] 26369#0: *1 event timer: 6, old: 2359976554,
new: 2359976554
2007/08/22 01:21:30 [debug] 26369#0: *1 http parent request: "/login/zip?"
2007/08/22 01:21:30 [debug] 26369#0: *1 http request: "/login/zip?" has
postponed
2007/08/22 01:21:30 [debug] 26369#0: *1 http fast subrequest:
"/static/file.txt?" done
2007/08/22 01:21:30 [debug] 26369#0: *1 http subrequest done
"/static/file.txt?"
2007/08/22 01:21:30 [debug] 26369#0: *1 ngx_zip: subrequest for
"/static/zero.txt?" 08102578
2007/08/22 01:21:30 [debug] 26369#0: *1 http subrequest "/static/zero.txt?"
...
2007/08/22 01:21:30 [debug] 26369#0: *1 http finalize request: 0,
"/static/zero.txt?"
2007/08/22 01:21:30 [debug] 26369#0: *1 event timer: 6, old: 2359976554,
new: 2359976554
2007/08/22 01:21:30 [debug] 26369#0: *1 http parent request: "/login/zip?"
2007/08/22 01:21:30 [debug] 26369#0: *1 http request: "/login/zip?" has
postponed
2007/08/22 01:21:30 [debug] 26369#0: *1 http fast subrequest:
"/static/zero.txt?" done
2007/08/22 01:21:30 [debug] 26369#0: *1 http subrequest done
"/static/zero.txt?"
More information about the nginx
mailing list