From 75481bde85b5da5b33f6a0fd09fd279547bbfcac Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Sat, 24 Jul 2010 17:56:41 +0200 Subject: [PATCH] wininet: Commit URL cache entry when cache file is closed. --- dlls/wininet/http.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 80bacb4daeb..e74c97418d3 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -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]; -- 2.11.4.GIT