Zebediah Figura : http.sys: Stop receiving data as long as an unread request is available.

Alexandre Julliard julliard at winehq.org
Mon Aug 26 15:47:27 CDT 2019


Module: wine
Branch: master
Commit: 20ab0dacb8dfcb3f514364c87d6ce45292d1afe0
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=20ab0dacb8dfcb3f514364c87d6ce45292d1afe0

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Fri Aug 23 17:36:16 2019 -0500

http.sys: Stop receiving data as long as an unread request is available.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/http.sys/http.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/dlls/http.sys/http.c b/dlls/http.sys/http.c
index 506aefc..81f5d34 100644
--- a/dlls/http.sys/http.c
+++ b/dlls/http.sys/http.c
@@ -53,7 +53,10 @@ struct connection
     char *buffer;
     unsigned int len, size;
 
-    /* Things we already parsed out of the request header in parse_request(). */
+    BOOL available;
+
+    /* Things we already parsed out of the request header in parse_request().
+     * These are valid only if "available" is TRUE. */
     unsigned int req_len;
     HTTP_VERB verb;
     HTTP_VERSION version;
@@ -272,6 +275,11 @@ static int parse_request(struct connection *conn)
 
     TRACE("Received a full request, length %u bytes.\n", conn->req_len);
 
+    /* Stop selecting on incoming data until a response is queued. */
+    WSAEventSelect(conn->socket, request_event, FD_CLOSE);
+
+    conn->available = TRUE;
+
     return 1;
 }
 
@@ -294,6 +302,9 @@ static void receive_data(struct connection *conn)
     }
     conn->len += len;
 
+    if (conn->available)
+        return; /* waiting for an HttpReceiveHttpRequest() call */
+
     TRACE("Received %u bytes of data.\n", len);
 
     if (!(ret = parse_request(conn)))




More information about the wine-cvs mailing list