Rob Shearman : wininet: Assume that if we're connected to an HTTP/1. 1 server then connections can be kept alive by default.

Alexandre Julliard julliard at winehq.org
Sat Mar 15 05:53:48 CDT 2008


Module: wine
Branch: master
Commit: e74514b1383c099fec95086b07ad1eb89028485a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e74514b1383c099fec95086b07ad1eb89028485a

Author: Rob Shearman <rob at codeweavers.com>
Date:   Fri Mar 14 18:10:08 2008 +0000

wininet: Assume that if we're connected to an HTTP/1.1 server then connections can be kept alive by default.

So don't close the connection in this case in HTTP_FinishedReading.

---

 dlls/wininet/http.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index da5d2da..f2fa994 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -3864,16 +3864,25 @@ static BOOL HTTP_ProcessHeader(LPWININETHTTPREQW lpwhr, LPCWSTR field, LPCWSTR v
  */
 BOOL HTTP_FinishedReading(LPWININETHTTPREQW lpwhr)
 {
-    WCHAR szConnectionResponse[20];
-    DWORD dwBufferSize = sizeof(szConnectionResponse);
+    WCHAR szVersion[10];
+    DWORD dwBufferSize = sizeof(szVersion);
 
     TRACE("\n");
 
-    if (!HTTP_HttpQueryInfoW(lpwhr, HTTP_QUERY_CONNECTION, szConnectionResponse,
+    /* as per RFC 2068, S8.1.2.1, if the client is HTTP/1.1 then assume that
+     * the connection is keep-alive by default */
+    if (!HTTP_HttpQueryInfoW(lpwhr, HTTP_QUERY_VERSION, szVersion,
                              &dwBufferSize, NULL) ||
-        strcmpiW(szConnectionResponse, szKeepAlive))
+        strcmpiW(szVersion, g_szHttp1_1))
     {
-        HTTPREQ_CloseConnection(&lpwhr->hdr);
+        WCHAR szConnectionResponse[20];
+        dwBufferSize = sizeof(szConnectionResponse);
+        if (!HTTP_HttpQueryInfoW(lpwhr, HTTP_QUERY_CONNECTION, szConnectionResponse,
+                                 &dwBufferSize, NULL) ||
+            strcmpiW(szConnectionResponse, szKeepAlive))
+        {
+            HTTPREQ_CloseConnection(&lpwhr->hdr);
+        }
     }
 
     /* FIXME: store data in the URL cache here */




More information about the wine-cvs mailing list