When r != r->connection->data
Yichun Zhang (agentzh)
agentzh at gmail.com
Mon Mar 16 19:11:56 UTC 2015
Hello!
On Sun, Mar 15, 2015 at 5:05 PM, Marat Dakota wrote:
> In a few modules I've found a trick:
>
> if (r != r->connection->data)
> r->connection->data = r;
>
Careful. This is a common hack to cheat nginx's
ngx_http_postpone_filter_module when the in-stock subrequest model
cannot serve us well.
When the currently serving (sub)request is not the request doing
output, r is not equal to r->connection->data. The latter means the
currently *active* request. This is needed for the postpone filter
module mentioned above. You need to carefully study the filter module
(and ngx_http_finalize_request) before doing any serious subrequest
programming. And nginx subrequests are really a mess for nontrivial
things IMHO (no offense to the official designer) and better avoid
them :)
Regards,
-agentzh
More information about the nginx-devel
mailing list