Upstream module usage to process data

isolomka nginx-forum at forum.nginx.org
Mon May 29 10:04:05 UTC 2017


Hi All,
I'm developing NGINX module which should read some binary data from upstream
server, process it an send response to the user. 
So to do it i'm using ngx_http_upstream API to create upstream request and
get data. So the question is where is the right point to start processing of
received chain of buffers and how to avoid call to ngx_http_output_filter
from ngx_http_upstream_process_non_buffered_request?
I'm going to cal it by myself when data processing is finished.

During research i've tried to enable subrequest_in_memory flag to save all
needed data for later processing
In upstream ngx_http_upstream_process_header there is a validation if
subrequest is in memory
   if (!r->subrequest_in_memory) {
        ngx_http_upstream_send_response(r, u);
        return;
    }
When i enabled subrequest_in_memory flag i got an error  "upstream buffer is
too small to read response"
But in debugger i see that data are available in the upstream buffer. It
looks for me that response is already saved. So how to explain such
inconsistency?

Thank you in advance.

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,274486,274486#msg-274486



More information about the nginx mailing list