<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>ngx_http_internal_redirect ultimatly calls ngx_http_handler,
which I tried by calling subrequest->write_event_handler after
ngx_http_request.</p>
<p><br>
</p>
<p>Actually I don't want to redirect the current request, juste do a
subrequest, collects the response status, body and headers, and
continue the processing of the module without returning to nginx.</p>
<p><br>
</p>
<p>The usual way is :</p>
<ul>
<li>call ngx_http_subrequest<br>
</li>
<li>return NGX_AGAIN (so it stops ngx_http_core_run_phases until
the subrequest reactive the request)</li>
<li>When the subrequest is completed, it reactive the main
request, which makes r->write_event_handle (ie
ngx_http_core_run_phases) to be triggered<br>
</li>
<li>Get the subrequest from the main request, and process the
response.</li>
</ul>
<p><br>
</p>
<p>The way I am trying to achieve is :</p>
<ul>
<li>call ngx_http_subrequest</li>
<li>wait or call some functions in order to complete the
subrequest</li>
<li>collects the response and continue the processing</li>
</ul>
<p>without returning from the function that create the subrequest.</p>
<p><br>
</p>
<p>Thank you for your help<br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 04/05/2021 16:35, Ranier Vilela
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAEudQAryO00tJO_BrLWy1xShsOas0+377pM5UBRZ=LKLPf0SOg@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Em ter., 4 de mai. de 2021
às 11:11, Alfred Sawaya <<a href="mailto:alfred@huji.fr"
moz-do-not-send="true">alfred@huji.fr</a>> escreveu:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
<br>
I am currently converting an Apache module to Nginx. This
module uses<br>
subrequests and needs (for now) to execute the subrequest
without<br>
unwinding the stack (ie without returning to nginx).<br>
<br>
I tried to call ngx_http_run_posted_requests by hand, but it
does not<br>
work as the upstream socket needs to get polled some time.<br>
<br>
<br>
So I wonder, is there any way to do this ?<br>
</blockquote>
<div>You can try: ngx_http_internal_redirect
</div>
<div> ngx_http_internal_redirect(r, &uri, NULL);</div>
<div><br>
</div>
<div>regards,</div>
<div>Ranier Vilela</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
nginx-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:nginx-devel@nginx.org">nginx-devel@nginx.org</a>
<a class="moz-txt-link-freetext" href="http://mailman.nginx.org/mailman/listinfo/nginx-devel">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a></pre>
</blockquote>
</body>
</html>