]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: stream_interface: Make sure we read all the data available.
authorOlivier Houchard <ohouchard@haproxy.com>
Thu, 29 Nov 2018 16:02:41 +0000 (17:02 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 29 Nov 2018 16:39:04 +0000 (17:39 +0100)
In si_cs_recv(), when there's an error on the connection or the conn_stream,
don't give up if CS_FL_RCV_MORE is set on the conn_stream, as it means there's
still data available.

src/stream_interface.c

index 93ef344ec8be5c1b7b024b031269d734d9d516c6..9cbfab13e71bf7a3810201234bb0109bc765c457 100644 (file)
@@ -1095,10 +1095,12 @@ int si_cs_recv(struct conn_stream *cs)
         * happens when we send too large a request to a backend server
         * which rejects it before reading it all.
         */
-       if (!conn_xprt_ready(conn))
-               return 0;
-       if (conn->flags & CO_FL_ERROR || cs->flags & CS_FL_ERROR)
-               return 1; // We want to make sure si_cs_wake() is called, so that process_strema is woken up, on failure
+       if (!(cs->flags & CS_FL_RCV_MORE)) {
+               if (!conn_xprt_ready(conn))
+                       return 0;
+               if (conn->flags & CO_FL_ERROR || cs->flags & CS_FL_ERROR)
+                       return 1; // We want to make sure si_cs_wake() is called, so that process_strema is woken up, on failure
+       }
 
        /* If another call to si_cs_recv() failed, and we subscribed to
         * recv events already, give up now.
@@ -1202,7 +1204,7 @@ int si_cs_recv(struct conn_stream *cs)
         * recv().
         */
        while (!(conn->flags & (CO_FL_ERROR | CO_FL_WAIT_ROOM | CO_FL_HANDSHAKE)) &&
-              !(cs->flags & (CS_FL_ERROR|CS_FL_EOS)) && !(ic->flags & CF_SHUTR)) {
+              (!(cs->flags & (CS_FL_ERROR|CS_FL_EOS)) || (cs->flags & CS_FL_RCV_MORE)) && !(ic->flags & CF_SHUTR)) {
                /* <max> may be null. This is the mux responsibility to set
                 * CS_FL_RCV_MORE on the CS if more space is needed.
                 */