Re: Subrequest without returning to nginx

2021-05-04 Thread Dipl. Ing. Sergey Brester
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? As for njs and "it also returns to nginx", either I don't really understand your approach or you simply m

Re: Subrequest without returning to nginx

2021-05-04 Thread Dipl. Ing. Sergey Brester
Hi, see how the directive mirror [2] or post_action doing this. Also take a look at njs [3], how it can make a detached subrequest. Regards, Serg. 04.05.2021 16:11, Alfred Sawaya wrote: > Hello, > > I am currently converting an Apache module to Nginx. This module uses > subrequests an

Re: Subrequest without returning to nginx

2021-05-04 Thread Alfred Sawaya
Ah, I felt it. I needed to read it from someone that knows better. So... Big refactor time :) Thank you Maxim On 04/05/2021 16:59, Maxim Dounin wrote: > Hello! > > On Tue, May 04, 2021 at 04:11:34PM +0200, Alfred Sawaya wrote: > >> I am currently converting an Apache module to Nginx. This modu

Re: Subrequest without returning to nginx

2021-05-04 Thread Alfred Sawaya
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. By "returning to nginx" I mean "stepping out of the module". Returning to the phase handler. My approach is basically wrong, I am looking for a t

Re: Subrequest without returning to nginx

2021-05-04 Thread Alfred Sawaya
ngx_http_internal_redirect ultimatly calls ngx_http_handler, which I tried by calling subrequest->write_event_handler after ngx_http_request. 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 o

Re: Subrequest without returning to nginx

2021-05-04 Thread Maxim Dounin
Hello! On Tue, May 04, 2021 at 04:11:34PM +0200, Alfred Sawaya wrote: > 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_ru

Re: Subrequest without returning to nginx

2021-05-04 Thread Alfred Sawaya
mirror and post_action both return to nginx to complete the subrequest. 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. On 04/05/2021 16:32, Dipl. Ing. Sergey Brester wrote: > > Hi, > > see how the d

Re: Subrequest without returning to nginx

2021-05-04 Thread Ranier Vilela
Em ter., 4 de mai. de 2021 às 11:11, Alfred Sawaya escreveu: > 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

Subrequest without returning to nginx

2021-05-04 Thread Alfred Sawaya
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 ne