]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: session: do not send an HTTP/500 error on SSL sockets
authorWilly Tarreau <w@1wt.eu>
Thu, 6 Sep 2012 09:32:07 +0000 (11:32 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 6 Sep 2012 09:32:07 +0000 (11:32 +0200)
If a session fails its initialization, we don't want to send HTTP/500
over the socket if it's not a raw data layer.

src/session.c

index 0f7a9ba1f97ac7591f51d24edb02088fd82aa869..4503b41fa134a4b69f1f5ecf4871e0433f9827b2 100644 (file)
@@ -33,6 +33,7 @@
 #include <proto/frontend.h>
 #include <proto/hdr_idx.h>
 #include <proto/log.h>
+#include <proto/raw_sock.h>
 #include <proto/session.h>
 #include <proto/pipe.h>
 #include <proto/protocols.h>
@@ -185,7 +186,7 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
                session_store_counters(s);
        pool_free2(pool2_session, s);
  out_close:
-       if (ret < 0 && p->mode == PR_MODE_HTTP) {
+       if (ret < 0 && l->data == &raw_sock && p->mode == PR_MODE_HTTP) {
                /* critical error, no more memory, try to emit a 500 response */
                struct chunk *err_msg = http_error_message(s, HTTP_ERR_500);
                send(cfd, err_msg->str, err_msg->len, MSG_DONTWAIT|MSG_NOSIGNAL);