Module: wine Branch: master Commit: 75481bde85b5da5b33f6a0fd09fd279547bbfcac URL: http://source.winehq.org/git/wine.git/?a=commit;h=75481bde85b5da5b33f6a0fd09...
Author: Piotr Caban piotr@codeweavers.com Date: Sat Jul 24 17:56:41 2010 +0200
wininet: Commit URL cache entry when cache file is closed.
---
dlls/wininet/http.c | 40 +++++++++++++++++++++++++--------------- 1 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 80bacb4..e74c974 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];