How to implement handshake in an upstream module?
Reetesh Ranjan
reeteshr at outlook.com
Thu Dec 5 06:27:07 UTC 2013
Found a simple way. The sequence was:
client server handshake ---> <--- handshake request ---> <--- response
The handshake, the way it is in my specific case, is logically just an extension of the request and response streams. So just merged it into the same.
client server handshake . request ---> <--- handshake . response
So now things fit into the nginx state machine of upstream modules without any changes required.
Regards,Reetesh
From: reeteshr at outlook.com
To: nginx-devel at nginx.org
Subject: RE: How to implement handshake in an upstream module?
Date: Thu, 5 Dec 2013 08:53:44 +0530
Hi,
I meant making it non-static and using. This might be the modification we need to the upstream module, rather than introducing a 'handshake' handler formally. Was looking to see if there are any 'state machine' related catches in doing so.
Thanks,Reetesh
> Date: Thu, 5 Dec 2013 02:38:35 +0400
> From: mdounin at mdounin.ru
> To: nginx-devel at nginx.org
> Subject: Re: How to implement handshake in an upstream module?
>
> Hello!
>
> On Thu, Dec 05, 2013 at 02:39:28AM +0530, Reetesh Ranjan wrote:
>
> > Before I send my main request and process the response through
> > create_request and process_header (and filter) callbacks, I need
> > to have a short handshake with the upstream servers. It consists
> > of a send() and a recv() from the upstream module. How to
> > implement this?
> > Would the following sequence work?States: H = do-handshake
> > (initial state), R = do-request1 In state H, send handshake
> > req first through create_request()2 In process_header() in
> > state == H 2.1 call 'create_request' again with state set
> > to R, so main request gets created 2.2 call
> > 'ngx_http_upstream_send_request' manually to restart the
> > req-response cycle3 Because of 2.2 we get a process_header()
> > call in state R
> > Regards,Reetesh
>
> Obvious problem with the sequence:
> ngx_http_upstream_send_request() is static functions, and can't be
> called from a protocol module without modifications to
> ngx_http_upstream.c.
>
> I don't think that handshake can be implemented without
> modifications to upstream module. It's designed to implement
> request/response logic and doesn't assume any handshakes.
>
> --
> Maxim Dounin
> http://nginx.org/en/donation.html
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
_______________________________________________
nginx-devel mailing list
nginx-devel at nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20131205/06c3e6db/attachment.html>
More information about the nginx-devel
mailing list