]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: ssl: report the L4 connection as established when possible
authorWilly Tarreau <w@1wt.eu>
Fri, 28 Sep 2012 18:22:13 +0000 (20:22 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 2 Oct 2012 17:54:38 +0000 (19:54 +0200)
If we get an SSL error during the handshake, we at least try to see
if a syscall reported an error or not. In case of an error, it generally
means that the connection failed. If there is no error, then the connection
established successfully.

The difference is important for health checks which report the precise cause
to the logs and to the stats.

src/ssl_sock.c

index 71ae06f923ab09ed8145a3d17e90af7564bc2e62..efef1556af8a45b4b67881625ff4d9efaab3de23 100644 (file)
@@ -720,6 +720,12 @@ int ssl_sock_handshake(struct connection *conn, unsigned int flag)
                        __conn_sock_poll_recv(conn);
                        return 0;
                }
+               else if (ret == SSL_ERROR_SYSCALL) {
+                       /* if errno is null, then connection was successfully established */
+                       if (!errno && conn->flags & CO_FL_WAIT_L4_CONN)
+                               conn->flags &= ~CO_FL_WAIT_L4_CONN;
+                       goto out_error;
+               }
                else {
                        /* Fail on all other handshake errors */
                        goto out_error;