Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
8f2b0fdf
Commit
8f2b0fdf
authored
Sep 18, 2012
by
Piotr Caban
Committed by
Alexandre Julliard
Sep 18, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Added support for cache entries overwriting.
parent
6935b7c7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
21 deletions
+13
-21
urlcache.c
dlls/wininet/tests/urlcache.c
+4
-10
urlcache.c
dlls/wininet/urlcache.c
+9
-11
No files found.
dlls/wininet/tests/urlcache.c
View file @
8f2b0fdf
...
...
@@ -363,7 +363,7 @@ static void test_urlcacheA(void)
create_and_write_file
(
filenameA
,
&
zero_byte
,
sizeof
(
zero_byte
));
ret
=
CommitUrlCacheEntry
(
TEST_URL1
,
NULL
,
filetime_zero
,
filetime_zero
,
NORMAL_CACHE_ENTRY
|
URLHISTORY_CACHE_ENTRY
,
NULL
,
0
,
"html"
,
NULL
);
ret
=
CommitUrlCacheEntry
(
TEST_URL1
,
NULL
,
filetime_zero
,
filetime_zero
,
NORMAL_CACHE_ENTRY
,
NULL
,
0
,
"html"
,
NULL
);
ok
(
ret
,
"CommitUrlCacheEntry failed with error %d
\n
"
,
GetLastError
());
cbCacheEntryInfo
=
0
;
ret
=
GetUrlCacheEntryInfo
(
TEST_URL1
,
NULL
,
&
cbCacheEntryInfo
);
...
...
@@ -377,6 +377,7 @@ static void test_urlcacheA(void)
"expected zero ExpireTime
\n
"
);
ok
(
!
memcmp
(
&
lpCacheEntryInfo
->
LastModifiedTime
,
&
filetime_zero
,
sizeof
(
FILETIME
)),
"expected zero LastModifiedTime
\n
"
);
todo_wine
ok
(
lpCacheEntryInfo
->
CacheEntryType
==
(
NORMAL_CACHE_ENTRY
|
URLHISTORY_CACHE_ENTRY
)
||
broken
(
lpCacheEntryInfo
->
CacheEntryType
==
NORMAL_CACHE_ENTRY
/* NT4/W2k */
),
"expected type NORMAL_CACHE_ENTRY|URLHISTORY_CACHE_ENTRY, got %08x
\n
"
,
...
...
@@ -401,32 +402,27 @@ static void test_urlcacheA(void)
ret
=
GetUrlCacheEntryInfo
(
TEST_URL1
,
lpCacheEntryInfo2
,
&
cbCacheEntryInfo
);
ok
(
ret
,
"GetUrlCacheEntryInfo failed with error %d
\n
"
,
GetLastError
());
/* but it does change the time.. */
todo_wine
ok
(
memcmp
(
&
lpCacheEntryInfo2
->
ExpireTime
,
&
filetime_zero
,
sizeof
(
FILETIME
)),
"expected positive ExpireTime
\n
"
);
todo_wine
ok
(
memcmp
(
&
lpCacheEntryInfo2
->
LastModifiedTime
,
&
filetime_zero
,
sizeof
(
FILETIME
)),
"expected positive LastModifiedTime
\n
"
);
todo_wine
ok
(
lpCacheEntryInfo2
->
CacheEntryType
==
(
NORMAL_CACHE_ENTRY
|
URLHISTORY_CACHE_ENTRY
)
||
broken
(
lpCacheEntryInfo2
->
CacheEntryType
==
NORMAL_CACHE_ENTRY
/* NT4/W2k */
),
"expected type NORMAL_CACHE_ENTRY|URLHISTORY_CACHE_ENTRY, got %08x
\n
"
,
lpCacheEntryInfo2
->
CacheEntryType
);
/* and set the headers. */
todo_wine
ok
(
lpCacheEntryInfo2
->
dwHeaderInfoSize
==
19
,
"expected headers size 19, got %d
\n
"
,
lpCacheEntryInfo2
->
dwHeaderInfoSize
);
/* Hit rate gets incremented by 1 */
todo_wine
ok
((
lpCacheEntryInfo
->
dwHitRate
+
1
)
==
lpCacheEntryInfo2
->
dwHitRate
,
"HitRate not incremented by one on commit
\n
"
);
/* Last access time should be updated */
todo_wine
ok
(
!
(
lpCacheEntryInfo
->
LastAccessTime
.
dwHighDateTime
==
lpCacheEntryInfo2
->
LastAccessTime
.
dwHighDateTime
&&
lpCacheEntryInfo
->
LastAccessTime
.
dwLowDateTime
==
lpCacheEntryInfo2
->
LastAccessTime
.
dwLowDateTime
),
"Last accessed time was not updated by commit
\n
"
);
/* File extension should be unset */
todo_wine
ok
(
lpCacheEntryInfo2
->
lpszFileExtension
==
NULL
,
"Fileextension isn't unset: %s
\n
"
,
lpCacheEntryInfo2
->
lpszFileExtension
);
...
...
@@ -519,16 +515,15 @@ static void test_urlcacheA(void)
ret
=
GetUrlCacheEntryInfo
(
TEST_URL
,
lpCacheEntryInfo
,
&
cbCacheEntryInfo
);
ok
(
ret
,
"GetUrlCacheEntryInfo failed with error %d
\n
"
,
GetLastError
());
/* with the previous entry type retained.. */
todo_wine
ok
(
lpCacheEntryInfo
->
CacheEntryType
&
NORMAL_CACHE_ENTRY
,
"expected cache entry type NORMAL_CACHE_ENTRY, got %d (0x%08x)
\n
"
,
lpCacheEntryInfo
->
CacheEntryType
,
lpCacheEntryInfo
->
CacheEntryType
);
/* and the headers overwritten.. */
todo_wine
ok
(
!
lpCacheEntryInfo
->
dwHeaderInfoSize
,
"expected headers size 0, got %d
\n
"
,
lpCacheEntryInfo
->
dwHeaderInfoSize
);
HeapFree
(
GetProcessHeap
(),
0
,
lpCacheEntryInfo
);
/* and the previous filename shouldn't exist. */
todo_wine
check_file_not_exists
(
filenameA
);
check_file_exists
(
filenameA1
);
...
...
@@ -537,7 +532,6 @@ static void test_urlcacheA(void)
ret
=
pDeleteUrlCacheEntryA
(
TEST_URL
);
ok
(
ret
,
"DeleteUrlCacheEntryA failed with error %d
\n
"
,
GetLastError
());
check_file_not_exists
(
filenameA
);
todo_wine
check_file_not_exists
(
filenameA1
);
/* Just in case, clean up files */
DeleteFileA
(
filenameA1
);
...
...
dlls/wininet/urlcache.c
View file @
8f2b0fdf
...
...
@@ -2693,6 +2693,8 @@ static BOOL CommitUrlCacheEntryInternal(
LPSTR
lpszUrlNameA
=
NULL
;
LPSTR
lpszFileExtensionA
=
NULL
;
char
*
pchLocalFileName
=
0
;
DWORD
hit_rate
=
0
;
DWORD
exempt_delta
=
0
;
DWORD
error
;
TRACE
(
"(%s, %s, ..., ..., %x, %p, %d, %s, %s)
\n
"
,
...
...
@@ -2775,12 +2777,9 @@ static BOOL CommitUrlCacheEntryInternal(
goto
cleanup
;
}
FIXME
(
"entry already in cache - don't know what to do!
\n
"
);
/*
* SetLastError(ERROR_FILE_NOT_FOUND);
* return FALSE;
*/
goto
cleanup
;
hit_rate
=
pUrlEntry
->
dwHitRate
;
exempt_delta
=
pUrlEntry
->
dwExemptDelta
;
DeleteUrlCacheEntryInternal
(
pContainer
,
pHeader
,
pHashEntry
);
}
if
(
lpszLocalFileName
)
...
...
@@ -2861,14 +2860,13 @@ static BOOL CommitUrlCacheEntryInternal(
pUrlEntry
->
CacheDir
=
cDirectory
;
pUrlEntry
->
CacheEntryType
=
CacheEntryType
;
pUrlEntry
->
dwHeaderInfoSize
=
dwHeaderSize
;
if
(
CacheEntryType
&
STICKY_CACHE_ENTRY
)
if
(
(
CacheEntryType
&
STICKY_CACHE_ENTRY
)
&&
!
exempt_delta
)
{
/* Sticky entries have a default exempt time of one day */
pUrlEntry
->
dwExemptD
elta
=
86400
;
exempt_d
elta
=
86400
;
}
else
pUrlEntry
->
dwExemptDelta
=
0
;
pUrlEntry
->
dwHitRate
=
0
;
pUrlEntry
->
dwExemptDelta
=
exempt_delta
;
pUrlEntry
->
dwHitRate
=
hit_rate
+
1
;
pUrlEntry
->
dwOffsetFileExtension
=
dwOffsetFileExtension
;
pUrlEntry
->
dwOffsetHeaderInfo
=
dwOffsetHeader
;
pUrlEntry
->
dwOffsetLocalName
=
dwOffsetLocalFileName
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment