Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
190acb9e
Commit
190acb9e
authored
Mar 09, 2011
by
Juan Lang
Committed by
Alexandre Julliard
Mar 10, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Implement sticky url cache entries.
parent
f7340864
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
15 deletions
+44
-15
urlcache.c
dlls/wininet/tests/urlcache.c
+0
-6
urlcache.c
dlls/wininet/urlcache.c
+44
-9
No files found.
dlls/wininet/tests/urlcache.c
View file @
190acb9e
...
...
@@ -512,20 +512,16 @@ static void test_urlcacheA(void)
ret
=
CommitUrlCacheEntry
(
TEST_URL
,
NULL
,
filetime_zero
,
filetime_zero
,
STICKY_CACHE_ENTRY
,
(
LPBYTE
)
ok_header
,
strlen
(
ok_header
),
"html"
,
NULL
);
todo_wine
{
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
}
SetLastError
(
0xdeadbeef
);
ret
=
CommitUrlCacheEntry
(
TEST_URL
,
NULL
,
filetime_zero
,
filetime_zero
,
NORMAL_CACHE_ENTRY
|
STICKY_CACHE_ENTRY
,
(
LPBYTE
)
ok_header
,
strlen
(
ok_header
),
"html"
,
NULL
);
todo_wine
{
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
}
ret
=
CreateUrlCacheEntry
(
TEST_URL
,
0
,
"html"
,
filenameA
,
0
);
ok
(
ret
,
"CreateUrlCacheEntry failed with error %d
\n
"
,
GetLastError
());
create_and_write_file
(
filenameA
,
&
zero_byte
,
sizeof
(
zero_byte
));
...
...
@@ -545,7 +541,6 @@ static void test_urlcacheA(void)
ok
(
lpCacheEntryInfo
->
CacheEntryType
&
(
NORMAL_CACHE_ENTRY
|
STICKY_CACHE_ENTRY
),
"expected cache entry type NORMAL_CACHE_ENTRY | STICKY_CACHE_ENTRY, got %d (0x%08x)
\n
"
,
lpCacheEntryInfo
->
CacheEntryType
,
lpCacheEntryInfo
->
CacheEntryType
);
todo_wine
ok
(
lpCacheEntryInfo
->
dwExemptDelta
==
86400
,
"expected dwExemptDelta 864000, got %d
\n
"
,
lpCacheEntryInfo
->
dwExemptDelta
);
...
...
@@ -578,7 +573,6 @@ static void test_urlcacheA(void)
ok
(
lpCacheEntryInfo
->
CacheEntryType
&
(
NORMAL_CACHE_ENTRY
|
STICKY_CACHE_ENTRY
),
"expected cache entry type NORMAL_CACHE_ENTRY | STICKY_CACHE_ENTRY, got %d (0x%08x)
\n
"
,
lpCacheEntryInfo
->
CacheEntryType
,
lpCacheEntryInfo
->
CacheEntryType
);
todo_wine
ok
(
lpCacheEntryInfo
->
dwExemptDelta
==
86400
,
"expected dwExemptDelta 864000, got %d
\n
"
,
lpCacheEntryInfo
->
dwExemptDelta
);
...
...
dlls/wininet/urlcache.c
View file @
190acb9e
...
...
@@ -2473,6 +2473,11 @@ static BOOL CommitUrlCacheEntryInternal(
debugstr_w
(
lpszFileExtension
),
debugstr_w
(
lpszOriginalUrl
));
if
(
CacheEntryType
&
STICKY_CACHE_ENTRY
&&
!
lpszLocalFileName
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
if
(
lpszOriginalUrl
)
WARN
(
": lpszOriginalUrl ignored
\n
"
);
...
...
@@ -2612,7 +2617,13 @@ static BOOL CommitUrlCacheEntryInternal(
pUrlEntry
->
CacheDir
=
cDirectory
;
pUrlEntry
->
CacheEntryType
=
CacheEntryType
;
pUrlEntry
->
dwHeaderInfoSize
=
dwHeaderSize
;
pUrlEntry
->
dwExemptDelta
=
0
;
if
(
CacheEntryType
&
STICKY_CACHE_ENTRY
)
{
/* Sticky entries have a default exempt time of one day */
pUrlEntry
->
dwExemptDelta
=
86400
;
}
else
pUrlEntry
->
dwExemptDelta
=
0
;
pUrlEntry
->
dwHitRate
=
0
;
pUrlEntry
->
dwOffsetFileExtension
=
dwOffsetFileExtension
;
pUrlEntry
->
dwOffsetHeaderInfo
=
dwOffsetHeader
;
...
...
@@ -2653,8 +2664,12 @@ static BOOL CommitUrlCacheEntryInternal(
{
if
(
pUrlEntry
->
CacheDir
<
pHeader
->
DirectoryCount
)
pHeader
->
directory_data
[
pUrlEntry
->
CacheDir
].
dwNumFiles
++
;
pHeader
->
CacheUsage
.
QuadPart
+=
file_size
.
QuadPart
;
if
(
pHeader
->
CacheUsage
.
QuadPart
>
pHeader
->
CacheLimit
.
QuadPart
)
if
(
CacheEntryType
&
STICKY_CACHE_ENTRY
)
pHeader
->
ExemptUsage
.
QuadPart
+=
file_size
.
QuadPart
;
else
pHeader
->
CacheUsage
.
QuadPart
+=
file_size
.
QuadPart
;
if
(
pHeader
->
CacheUsage
.
QuadPart
+
pHeader
->
ExemptUsage
.
QuadPart
>
pHeader
->
CacheLimit
.
QuadPart
)
FIXME
(
"file of size %s bytes fills cache
\n
"
,
wine_dbgstr_longlong
(
file_size
.
QuadPart
));
}
...
...
@@ -3032,10 +3047,20 @@ BOOL WINAPI DeleteUrlCacheEntryA(LPCSTR lpszUrlName)
if
(
pHeader
->
directory_data
[
pUrlEntry
->
CacheDir
].
dwNumFiles
)
pHeader
->
directory_data
[
pUrlEntry
->
CacheDir
].
dwNumFiles
--
;
}
if
(
pUrlEntry
->
size
.
QuadPart
<
pHeader
->
CacheUsage
.
QuadPart
)
pHeader
->
CacheUsage
.
QuadPart
-=
pUrlEntry
->
size
.
QuadPart
;
if
(
pUrlEntry
->
CacheEntryType
&
STICKY_CACHE_ENTRY
)
{
if
(
pUrlEntry
->
size
.
QuadPart
<
pHeader
->
ExemptUsage
.
QuadPart
)
pHeader
->
ExemptUsage
.
QuadPart
-=
pUrlEntry
->
size
.
QuadPart
;
else
pHeader
->
ExemptUsage
.
QuadPart
=
0
;
}
else
pHeader
->
CacheUsage
.
QuadPart
=
0
;
{
if
(
pUrlEntry
->
size
.
QuadPart
<
pHeader
->
CacheUsage
.
QuadPart
)
pHeader
->
CacheUsage
.
QuadPart
-=
pUrlEntry
->
size
.
QuadPart
;
else
pHeader
->
CacheUsage
.
QuadPart
=
0
;
}
URLCache_DeleteEntry
(
pHeader
,
pEntry
);
...
...
@@ -3115,10 +3140,20 @@ BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName)
if
(
pHeader
->
directory_data
[
pUrlEntry
->
CacheDir
].
dwNumFiles
)
pHeader
->
directory_data
[
pUrlEntry
->
CacheDir
].
dwNumFiles
--
;
}
if
(
pUrlEntry
->
size
.
QuadPart
<
pHeader
->
CacheUsage
.
QuadPart
)
pHeader
->
CacheUsage
.
QuadPart
-=
pUrlEntry
->
size
.
QuadPart
;
if
(
pUrlEntry
->
CacheEntryType
&
STICKY_CACHE_ENTRY
)
{
if
(
pUrlEntry
->
size
.
QuadPart
<
pHeader
->
ExemptUsage
.
QuadPart
)
pHeader
->
ExemptUsage
.
QuadPart
-=
pUrlEntry
->
size
.
QuadPart
;
else
pHeader
->
ExemptUsage
.
QuadPart
=
0
;
}
else
pHeader
->
CacheUsage
.
QuadPart
=
0
;
{
if
(
pUrlEntry
->
size
.
QuadPart
<
pHeader
->
CacheUsage
.
QuadPart
)
pHeader
->
CacheUsage
.
QuadPart
-=
pUrlEntry
->
size
.
QuadPart
;
else
pHeader
->
CacheUsage
.
QuadPart
=
0
;
}
URLCache_DeleteEntry
(
pHeader
,
pEntry
);
...
...
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