Sergey Bochenkov ha scritto:
[...]
If you need to keep the upstream response in memory,
NGX_HTTP_SUBREQUEST_IN_MEMORY flag may be useful for you. You can
also set the r->filter_need_in_memory flag in header-filter and read
full response body in the body-filter.
Thanks, but I don't think I have the need to keep it in memory;
it will complicate the implementation.
I have one more, important, question.
When will be the post_subrequest->handler called?
Always after ngx_http_subrequest returns?
The ngx_http_subrequest()-function is asyncronous and returns
immediately after all appropriate fields of ngx_http_request_t
structure will be filled. It doesn't wait for any upstream answer at
all.
The handler will be called after the end of the *subrequest*, not the
end of ngx_http_subrequest()-function call.
The problem is that you are assuming that the subrequest will make use
of the upstream module, but this is not always the case.
What happens if the subrequest will make use of the static module and
the file is very small?