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
54639c5d
Commit
54639c5d
authored
Nov 02, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Nov 02, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Commit cache file as soon as all data is written.
parent
b012765e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
18 deletions
+35
-18
http.c
dlls/wininet/http.c
+34
-17
http.c
dlls/wininet/tests/http.c
+1
-1
No files found.
dlls/wininet/http.c
View file @
54639c5d
...
...
@@ -1815,18 +1815,8 @@ static void HTTPREQ_Destroy(object_header_t *hdr)
TRACE
(
"
\n
"
);
if
(
request
->
hCacheFile
)
{
WCHAR
url
[
INTERNET_MAX_URL_LENGTH
];
CloseHandle
(
request
->
hCacheFile
);
if
(
HTTP_GetRequestURL
(
request
,
url
))
{
DWORD
headersLen
;
headersLen
=
request
->
rawHeaders
?
strlenW
(
request
->
rawHeaders
)
:
0
;
CommitUrlCacheEntryW
(
url
,
request
->
cacheFile
,
request
->
expires
,
request
->
last_modified
,
NORMAL_CACHE_ENTRY
,
request
->
rawHeaders
,
headersLen
,
NULL
,
0
);
}
DeleteFileW
(
request
->
cacheFile
);
}
heap_free
(
request
->
cacheFile
);
...
...
@@ -2233,6 +2223,25 @@ static DWORD HTTPREQ_SetOption(object_header_t *hdr, DWORD option, void *buffer,
return
INET_SetOption
(
hdr
,
option
,
buffer
,
size
);
}
static
void
commit_cache_entry
(
http_request_t
*
req
)
{
WCHAR
url
[
INTERNET_MAX_URL_LENGTH
];
TRACE
(
"%p
\n
"
,
req
);
CloseHandle
(
req
->
hCacheFile
);
req
->
hCacheFile
=
NULL
;
if
(
HTTP_GetRequestURL
(
req
,
url
))
{
DWORD
headersLen
;
headersLen
=
req
->
rawHeaders
?
strlenW
(
req
->
rawHeaders
)
:
0
;
CommitUrlCacheEntryW
(
url
,
req
->
cacheFile
,
req
->
expires
,
req
->
last_modified
,
NORMAL_CACHE_ENTRY
,
req
->
rawHeaders
,
headersLen
,
NULL
,
0
);
}
}
static
void
create_cache_entry
(
http_request_t
*
req
)
{
WCHAR
url
[
INTERNET_MAX_URL_LENGTH
];
...
...
@@ -2271,6 +2280,9 @@ static void create_cache_entry(http_request_t *req)
b
=
WriteFile
(
req
->
hCacheFile
,
req
->
read_buf
+
req
->
read_pos
,
req
->
read_size
,
&
written
,
NULL
);
if
(
!
b
)
FIXME
(
"WriteFile failed: %u
\n
"
,
GetLastError
());
if
(
req
->
data_stream
->
vtbl
->
end_of_data
(
req
->
data_stream
,
req
))
commit_cache_entry
(
req
);
}
}
...
...
@@ -2362,13 +2374,18 @@ static DWORD read_http_stream(http_request_t *req, BYTE *buf, DWORD size, DWORD
res
=
req
->
data_stream
->
vtbl
->
read
(
req
->
data_stream
,
req
,
buf
,
size
,
read
,
read_mode
);
assert
(
*
read
<=
size
);
if
(
*
read
&&
req
->
hCacheFile
)
{
BOOL
bres
;
DWORD
written
;
if
(
req
->
hCacheFile
)
{
if
(
*
read
)
{
BOOL
bres
;
DWORD
written
;
bres
=
WriteFile
(
req
->
hCacheFile
,
buf
,
*
read
,
&
written
,
NULL
);
if
(
!
bres
)
FIXME
(
"WriteFile failed: %u
\n
"
,
GetLastError
());
bres
=
WriteFile
(
req
->
hCacheFile
,
buf
,
*
read
,
&
written
,
NULL
);
if
(
!
bres
)
FIXME
(
"WriteFile failed: %u
\n
"
,
GetLastError
());
}
if
(
req
->
data_stream
->
vtbl
->
end_of_data
(
req
->
data_stream
,
req
))
commit_cache_entry
(
req
);
}
return
res
;
...
...
dlls/wininet/tests/http.c
View file @
54639c5d
...
...
@@ -1255,7 +1255,7 @@ static void test_http_cache(void)
ret
=
InternetQueryOptionA
(
request
,
INTERNET_OPTION_DATAFILE_NAME
,
file_name
,
&
size
);
ok
(
ret
,
"InternetQueryOptionA(INTERNET_OPTION_DATAFILE_NAME) failed: %u
\n
"
,
GetLastError
());
file
=
CreateFile
(
file_name
,
GENERIC_READ
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
file
=
CreateFile
(
file_name
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"Could not create file: %u
\n
"
,
GetLastError
());
file_size
=
GetFileSize
(
file
,
NULL
);
...
...
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