[PATCH 2/5] http.sys: Stop receiving data as long as an unread request is available.

Zebediah Figura z.figura12 at gmail.com
Fri Aug 23 17:36:16 CDT 2019


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 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 506aefccf1..81f5d3467e 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)))
-- 
2.22.0




More information about the wine-devel mailing list