Misha Koshelev : wininet:
Separate connection closing from object destruction.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Aug 23 07:26:02 CDT 2007
Module: wine
Branch: master
Commit: 0f117e568ff084b45f5be4b250dd0d5b53c4419b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0f117e568ff084b45f5be4b250dd0d5b53c4419b
Author: Misha Koshelev <mk144210 at bcm.edu>
Date: Thu Aug 23 00:06:00 2007 -0500
wininet: Separate connection closing from object destruction.
---
dlls/wininet/ftp.c | 6 ++++++
dlls/wininet/http.c | 10 ++++++----
dlls/wininet/internet.c | 6 ++++++
dlls/wininet/internet.h | 1 +
4 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c
index d9291c2..b0c36f9 100644
--- a/dlls/wininet/ftp.c
+++ b/dlls/wininet/ftp.c
@@ -1121,6 +1121,7 @@ HINTERNET FTP_FtpOpenFileW(LPWININETFTPSESSIONW lpwfs,
lpwh->hdr.dwFlags = dwFlags;
lpwh->hdr.dwContext = dwContext;
lpwh->hdr.dwRefCount = 1;
+ lpwh->hdr.close_connection = NULL;
lpwh->hdr.destroy = FTP_CloseFileTransferHandle;
lpwh->hdr.lpfnStatusCB = lpwfs->hdr.lpfnStatusCB;
lpwh->nDataSocket = nDataSocket;
@@ -1897,6 +1898,10 @@ HINTERNET FTP_Connect(LPWININETAPPINFOW hIC, LPCWSTR lpszServerName,
lpwfs->hdr.dwContext = dwContext;
lpwfs->hdr.dwInternalFlags = dwInternalFlags;
lpwfs->hdr.dwRefCount = 1;
+ /* FIXME: Native sends INTERNET_STATUS_CLOSING_CONNECTION and
+ * INTERNET_STATUS_CONNECTION_CLOSED, need an equivalent FTP_CloseConnection
+ * function */
+ lpwfs->hdr.close_connection = NULL;
lpwfs->hdr.destroy = FTP_CloseSessionHandle;
lpwfs->hdr.lpfnStatusCB = hIC->hdr.lpfnStatusCB;
lpwfs->download_in_progress = NULL;
@@ -3006,6 +3011,7 @@ static HINTERNET FTP_ReceiveFileList(LPWININETFTPSESSIONW lpwfs, INT nSocket, LP
lpwfn->hdr.htype = WH_HFTPFINDNEXT;
lpwfn->hdr.dwContext = dwContext;
lpwfn->hdr.dwRefCount = 1;
+ lpwfn->hdr.close_connection = NULL;
lpwfn->hdr.destroy = FTP_CloseFindNextHandle;
lpwfn->hdr.lpfnStatusCB = lpwfs->hdr.lpfnStatusCB;
lpwfn->index = 1; /* Next index is 1 since we return index 0 */
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index b676f48..08be913 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -103,6 +103,7 @@ struct HttpAuthInfo
BOOL finished; /* finished authenticating */
};
+static void HTTP_CloseConnection(LPWININETHANDLEHEADER hdr);
static void HTTP_CloseHTTPRequestHandle(LPWININETHANDLEHEADER hdr);
static void HTTP_CloseHTTPSessionHandle(LPWININETHANDLEHEADER hdr);
static BOOL HTTP_OpenConnection(LPWININETHTTPREQW lpwhr);
@@ -1363,6 +1364,7 @@ HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs,
lpwhr->hdr.dwFlags = dwFlags;
lpwhr->hdr.dwContext = dwContext;
lpwhr->hdr.dwRefCount = 1;
+ lpwhr->hdr.close_connection = HTTP_CloseConnection;
lpwhr->hdr.destroy = HTTP_CloseHTTPRequestHandle;
lpwhr->hdr.lpfnStatusCB = lpwhs->hdr.lpfnStatusCB;
lpwhr->hdr.dwInternalFlags = lpwhs->hdr.dwInternalFlags & INET_CALLBACKW;
@@ -2816,6 +2818,7 @@ HINTERNET HTTP_Connect(LPWININETAPPINFOW hIC, LPCWSTR lpszServerName,
lpwhs->hdr.dwContext = dwContext;
lpwhs->hdr.dwInternalFlags = dwInternalFlags | (hIC->hdr.dwInternalFlags & INET_CALLBACKW);
lpwhs->hdr.dwRefCount = 1;
+ lpwhs->hdr.close_connection = NULL;
lpwhs->hdr.destroy = HTTP_CloseHTTPSessionHandle;
lpwhs->hdr.lpfnStatusCB = hIC->hdr.lpfnStatusCB;
@@ -3319,8 +3322,9 @@ static BOOL HTTP_ProcessHeader(LPWININETHTTPREQW lpwhr, LPCWSTR field, LPCWSTR v
* Close socket connection
*
*/
-static VOID HTTP_CloseConnection(LPWININETHTTPREQW lpwhr)
+static void HTTP_CloseConnection(LPWININETHANDLEHEADER hdr)
{
+ LPWININETHTTPREQW lpwhr = (LPWININETHTTPREQW) hdr;
LPWININETHTTPSESSIONW lpwhs = NULL;
LPWININETAPPINFOW hIC = NULL;
@@ -3380,7 +3384,7 @@ BOOL HTTP_FinishedReading(LPWININETHTTPREQW lpwhr)
&dwBufferSize, NULL) ||
strcmpiW(szConnectionResponse, szKeepAlive))
{
- HTTP_CloseConnection(lpwhr);
+ HTTP_CloseConnection(&lpwhr->hdr);
}
/* FIXME: store data in the URL cache here */
@@ -3403,8 +3407,6 @@ static void HTTP_CloseHTTPRequestHandle(LPWININETHANDLEHEADER hdr)
WININET_Release(&lpwhr->lpHttpSession->hdr);
- HTTP_CloseConnection(lpwhr);
-
HeapFree(GetProcessHeap(), 0, lpwhr->lpszPath);
HeapFree(GetProcessHeap(), 0, lpwhr->lpszVerb);
HeapFree(GetProcessHeap(), 0, lpwhr->lpszRawHeaders);
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index d24eed3..4886f7c 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -173,6 +173,11 @@ BOOL WININET_Release( LPWININETHANDLEHEADER info )
TRACE( "object %p refcount = %d\n", info, info->dwRefCount );
if( !info->dwRefCount )
{
+ if ( info->close_connection )
+ {
+ TRACE( "closing connection %p\n", info);
+ info->close_connection( info );
+ }
TRACE( "destroying object %p\n", info);
info->destroy( info );
}
@@ -477,6 +482,7 @@ HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType,
lpwai->hdr.htype = WH_HINIT;
lpwai->hdr.dwFlags = dwFlags;
lpwai->hdr.dwRefCount = 1;
+ lpwai->hdr.close_connection = NULL;
lpwai->hdr.destroy = INTERNET_CloseHandle;
lpwai->dwAccessType = dwAccessType;
lpwai->lpszProxyUsername = NULL;
diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h
index d388b5b..42ade48 100644
--- a/dlls/wininet/internet.h
+++ b/dlls/wininet/internet.h
@@ -146,6 +146,7 @@ struct _WININETHANDLEHEADER
DWORD dwError;
DWORD dwInternalFlags;
DWORD dwRefCount;
+ WININET_object_function close_connection;
WININET_object_function destroy;
INTERNET_STATUS_CALLBACK lpfnStatusCB;
};
More information about the wine-cvs
mailing list