<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><font face="Courier New">Found a simple way. The sequence was:</font><div><font face="Courier New"><br></font></div><div><font face="Courier New">client                           server</font></div><div><span style="font-family: 'Courier New'; font-size: 12pt;">             handshake ---></span></div><div><font face="Courier New">             <--- handshake</font></div><div><font face="Courier New">              request  ---></font></div><div><font face="Courier New">              <--- response</font></div><div><font face="Courier New"><br></font></div><div><font face="Courier New">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.</font></div><div><font face="Courier New"><br></font></div><div><div><div><font face="Courier New">client                           server</font></div><div><span style="font-family: 'Courier New'; font-size: 12pt;">       handshake . request  ---></span></div><div><font face="Courier New">       <--- handshake . response</font></div><div><br></div><div>So now things fit into the nginx state machine of upstream modules without any changes required.</div><div><br></div><div>Regards,</div><div>Reetesh</div><div><br></div><div><hr id="stopSpelling">From: reeteshr@outlook.com<br>To: nginx-devel@nginx.org<br>Subject: RE: How to implement handshake in an upstream module?<br>Date: Thu, 5 Dec 2013 08:53:44 +0530<br><br>

<style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}

--></style>
<div dir="ltr">Hi,<div><br></div><div>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.</div><div><br></div><div>Thanks,</div><div>Reetesh<br><br><div>> Date: Thu, 5 Dec 2013 02:38:35 +0400<br>> From: mdounin@mdounin.ru<br>> To: nginx-devel@nginx.org<br>> Subject: Re: How to implement handshake in an upstream module?<br>> <br>> Hello!<br>> <br>> On Thu, Dec 05, 2013 at 02:39:28AM +0530, Reetesh Ranjan wrote:<br>> <br>> > Before I send my main request and process the response through <br>> > create_request and process_header (and filter) callbacks, I need <br>> > to have a short handshake with the upstream servers. It consists <br>> > of a send() and a recv() from the upstream module. How to <br>> > implement this?<br>> > Would the following sequence work?States: H = do-handshake <br>> > (initial state), R = do-request1   In state H, send handshake <br>> > req first through create_request()2   In process_header() in <br>> > state == H     2.1  call 'create_request' again with state set <br>> > to R, so main request gets created     2.2  call <br>> > 'ngx_http_upstream_send_request' manually to restart the <br>> > req-response cycle3  Because of 2.2 we get a process_header() <br>> > call in state R<br>> > Regards,Reetesh                                       <br>> <br>> Obvious problem with the sequence: <br>> ngx_http_upstream_send_request() is static functions, and can't be <br>> called from a protocol module without modifications to <br>> ngx_http_upstream.c.<br>> <br>> I don't think that handshake can be implemented without <br>> modifications to upstream module.  It's designed to implement <br>> request/response logic and doesn't assume any handshakes.<br>> <br>> -- <br>> Maxim Dounin<br>> http://nginx.org/en/donation.html<br>> <br>> _______________________________________________<br>> nginx-devel mailing list<br>> nginx-devel@nginx.org<br>> http://mailman.nginx.org/mailman/listinfo/nginx-devel<br></div></div>                                       </div>
<br>_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel</div></div></div>                                         </div></body>
</html>