winhttp: Close the network connection if necessary.
Hans Leidekker
hans at codeweavers.com
Tue Sep 16 14:32:46 CDT 2008
diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index 4468963..1f91c99 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -1225,7 +1225,21 @@ static BOOL receive_data_chunked( request_t *request, void *buffer, DWORD size,
static void finished_reading( request_t *request )
{
- /* FIXME: close connection here if necessary */
+ static const WCHAR closeW[] = {'c','l','o','s','e',0};
+
+ BOOL close = FALSE;
+ WCHAR connection[20];
+ DWORD size = sizeof(connection);
+
+ if (request->hdr.disable_flags & WINHTTP_DISABLE_KEEP_ALIVE) close = TRUE;
+ else if (query_headers( request, WINHTTP_QUERY_CONNECTION, NULL, connection, &size, NULL ) ||
+ query_headers( request, WINHTTP_QUERY_PROXY_CONNECTION, NULL, connection, &size, NULL ))
+ {
+ if (!strcmpiW( connection, closeW )) close = TRUE;
+ }
+ else if (!strcmpW( request->version, http1_0 )) close = TRUE;
+
+ if (close) close_connection( request );
request->content_length = ~0UL;
request->content_read = 0;
}
diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h
index 0270ea8..8f5e17c 100644
--- a/dlls/winhttp/winhttp_private.h
+++ b/dlls/winhttp/winhttp_private.h
@@ -39,6 +39,7 @@
static const WCHAR getW[] = {'G','E','T',0};
static const WCHAR postW[] = {'P','O','S','T',0};
static const WCHAR slashW[] = {'/',0};
+static const WCHAR http1_0[] = {'H','T','T','P','/','1','.','0',0};
static const WCHAR http1_1[] = {'H','T','T','P','/','1','.','1',0};
typedef struct _object_header_t object_header_t;
More information about the wine-patches
mailing list