<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>I read the njs source code for a detached subrequest (in
ngx_http_js_ext_subrequest) and it creates the subrequest, the
promise, and returns to nginx.</p>
<p>By "returning to nginx" I mean "stepping out of the module".
Returning to the phase handler.</p>
<p><br>
</p>
<p>My approach is basically wrong, I am looking for a temporary (I
hope) ugly workaround to execute a subrequest without returning
from the function that creates the subrequest.</p>
<p>Why I need to not return to nginx : because in the module I work
on, there is contextual data that are stored on the stack. So
returning to nginx means unwinding all stack frames that the
module created so far.</p>
<p>Why it should not : it should :)</p>
<p><br>
</p>
<p>Thank you for you answer <br>
</p>
<p><br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 04/05/2021 17:03, Dipl. Ing. Sergey
Brester wrote:<br>
</div>
<blockquote type="cite"
cite="mid:2dd4e9fed9f57b3716932bb8d6ccf8e4@sebres.de">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<p>What do you mean as "return to nginx"? Or with other words why
it should not? Or how you need to guarantee that a subrequest
would take place at all and will be considered on another side?</p>
<p>As for njs and "it also returns to nginx", either I don't
really understand your approach or you simply missed the word
"detached" in my answer (and njs subrequest documentation).</p>
<p> </p>
<p>04.05.2021 16:49, Alfred Sawaya wrote:</p>
<blockquote type="cite" style="padding-left:5px;
border-left:#1010ff 2px solid; margin-left:5px"><!-- html ignored -->
<!-- head ignored --><!-- meta ignored -->
<p>mirror and post_action both return to nginx to complete the
subrequest.</p>
<p>njs also does an event-driven subrequest (ie gives back a
promise and set a callback), so it also returns to nginx to
complete the subrequest.</p>
<p> </p>
<div class="moz-cite-prefix">On 04/05/2021 16:32, Dipl. Ing.
Sergey Brester wrote:</div>
<blockquote type="cite" style="padding-left:5px;
border-left:#1010ff 2px solid; margin-left:5px">
<p>Hi,</p>
<p>see how the directive <a
href="https://nginx.org/en/docs/http/ngx_http_mirror_module.html"
moz-do-not-send="true">mirror</a> or <code>post_action</code>
doing this.</p>
<p>Also take a look at <a
href="http://nginx.org/en/docs/njs/reference.html"
moz-do-not-send="true">njs</a>, how it can make a detached
subrequest.</p>
<p>Regards,<br>
Serg.</p>
<p>04.05.2021 16:11, Alfred Sawaya wrote:</p>
<blockquote style="padding-left: 5px; border-left: #1010ff 2px
solid; margin-left: 5px;"><!-- node type 8 --><!-- node type 8 --><!-- node type 8 -->
<pre>Hello,
I am currently converting an Apache module to Nginx. This module uses
subrequests and needs (for now) to execute the subrequest without
unwinding the stack (ie without returning to nginx).
I tried to call ngx_http_run_posted_requests by hand, but it does not
work as the upstream socket needs to get polled some time.
So I wonder, is there any way to do this ?
Of course I know that I shouldn't do it like this, but the current
module is not reentrant and poorly architectured. I will eventually
refactor it but later.
Thanks,
_______________________________________________
nginx-devel mailing list
<a href="mailto:nginx-devel@nginx.org" moz-do-not-send="true">nginx-devel@nginx.org</a>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" moz-do-not-send="true">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a>
</pre>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</body>
</html>