Commit 75481bde authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

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

parent 54bdf622
......@@ -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];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment