Module: wine Branch: master Commit: 70f2f5d6a8d5152e25b221ce4999ae41b5677c43 URL: http://source.winehq.org/git/wine.git/?a=commit;h=70f2f5d6a8d5152e25b221ce49...
Author: Hans Leidekker hans@codeweavers.com Date: Tue Sep 16 21:32:46 2008 +0200
winhttp: Close the network connection if necessary.
---
dlls/winhttp/request.c | 16 +++++++++++++++- dlls/winhttp/winhttp_private.h | 1 + 2 files changed, 16 insertions(+), 1 deletions(-)
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;