wininet: Commit URL cache entry when cache file is closed.

This commit is contained in:
Piotr Caban 2010-07-24 17:56:41 +02:00 committed by Alexandre Julliard
parent 54bdf622a0
commit 75481bde85
1 changed files with 25 additions and 15 deletions

View File

@ -1539,6 +1539,20 @@ static DWORD HTTP_ResolveName(http_request_t *lpwhr)
return ERROR_SUCCESS;
}
static BOOL HTTP_GetRequestURL(http_request_t *req, LPWSTR buf)
{
LPHTTPHEADERW host_header;
static const WCHAR formatW[] = {'h','t','t','p',':','/','/','%','s','%','s',0};
host_header = HTTP_GetHeader(req, hostW);
if(!host_header)
return FALSE;
sprintfW(buf, formatW, host_header->lpszValue, req->lpszPath); /* FIXME */
return TRUE;
}
/***********************************************************************
* HTTPREQ_Destroy (internal)
@ -1553,9 +1567,19 @@ static void HTTPREQ_Destroy(object_header_t *hdr)
TRACE("\n");
if(lpwhr->hCacheFile)
if(lpwhr->hCacheFile) {
WCHAR url[INTERNET_MAX_URL_LENGTH];
FILETIME ft;
CloseHandle(lpwhr->hCacheFile);
memset(&ft, 0, sizeof(FILETIME));
if(HTTP_GetRequestURL(lpwhr, url)) {
CommitUrlCacheEntryW(url, lpwhr->lpszCacheFile, ft, ft,
NORMAL_CACHE_ENTRY, NULL, 0, NULL, 0);
}
}
HeapFree(GetProcessHeap(), 0, lpwhr->lpszCacheFile);
DeleteCriticalSection( &lpwhr->read_section );
@ -1606,20 +1630,6 @@ static void HTTPREQ_CloseConnection(object_header_t *hdr)
INTERNET_STATUS_CONNECTION_CLOSED, 0, 0);
}
static BOOL HTTP_GetRequestURL(http_request_t *req, LPWSTR buf)
{
LPHTTPHEADERW host_header;
static const WCHAR formatW[] = {'h','t','t','p',':','/','/','%','s','%','s',0};
host_header = HTTP_GetHeader(req, hostW);
if(!host_header)
return FALSE;
sprintfW(buf, formatW, host_header->lpszValue, req->lpszPath); /* FIXME */
return TRUE;
}
static BOOL HTTP_KeepAlive(http_request_t *lpwhr)
{
WCHAR szVersion[10];