MAJOR: connection: make the PROXY decoder a handshake handler
The PROXY protocol is now decoded in the connection before other
handshakes. This means that it may be extracted from a TCP stream
before SSL is decoded from this stream.
diff --git a/src/connection.c b/src/connection.c
index 9e3d79e..44e675b 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -39,6 +39,10 @@
if (unlikely(conn->flags & CO_FL_ERROR))
goto leave;
+ if (conn->flags & CO_FL_ACCEPT_PROXY)
+ if (!conn_recv_proxy(conn, CO_FL_ACCEPT_PROXY))
+ goto leave;
+
if (conn->flags & CO_FL_SI_SEND_PROXY)
if (!conn_si_send_proxy(conn, CO_FL_SI_SEND_PROXY))
goto leave;
@@ -53,7 +57,7 @@
* we must not use it anymore and should immediately leave instead.
*/
if ((conn->flags & CO_FL_INIT_SESS) &&
- conn_session_initialize(conn, CO_FL_INIT_SESS) < 0)
+ conn_session_complete(conn, CO_FL_INIT_SESS) < 0)
return 0;
if (fdtab[fd].ev & (FD_POLL_IN | FD_POLL_HUP | FD_POLL_ERR))