winhttp: Close the network connection if necessary.

This commit is contained in:
Hans Leidekker 2008-09-16 21:32:46 +02:00 committed by Alexandre Julliard
parent 5c1c923d5e
commit 70f2f5d6a8
2 changed files with 16 additions and 1 deletions

View File

@ -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;
}

View File

@ -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;