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
d7a49e81
Commit
d7a49e81
authored
Feb 13, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 15, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Added beginning support for HTTP cache files.
parent
e35bd050
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
0 deletions
+59
-0
http.c
dlls/wininet/http.c
+48
-0
internet.c
dlls/wininet/internet.c
+9
-0
internet.h
dlls/wininet/internet.h
+2
-0
No files found.
dlls/wininet/http.c
View file @
d7a49e81
...
...
@@ -2283,6 +2283,20 @@ BOOL WINAPI HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders,
return
result
;
}
static
BOOL
HTTP_GetRequestURL
(
WININETHTTPREQW
*
req
,
LPWSTR
buf
)
{
LPHTTPHEADERW
host_header
;
static
const
WCHAR
formatW
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'%'
,
's'
,
'%'
,
's'
,
0
};
host_header
=
HTTP_GetHeader
(
req
,
szHost
);
if
(
!
host_header
)
return
FALSE
;
sprintfW
(
buf
,
formatW
,
host_header
->
lpszValue
,
req
->
lpszPath
);
/* FIXME */
return
TRUE
;
}
/***********************************************************************
* HTTP_HandleRedirect (internal)
*/
...
...
@@ -2743,6 +2757,32 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders,
}
while
(
loop_next
);
/* FIXME: Better check, when we have to create the cache file */
if
(
bSuccess
&&
(
lpwhr
->
hdr
.
dwFlags
&
INTERNET_FLAG_NEED_FILE
))
{
WCHAR
url
[
INTERNET_MAX_URL_LENGTH
];
WCHAR
cacheFileName
[
MAX_PATH
+
1
];
BOOL
b
;
b
=
HTTP_GetRequestURL
(
lpwhr
,
url
);
if
(
!
b
)
{
WARN
(
"Could not get URL
\n
"
);
goto
lend
;
}
b
=
CreateUrlCacheEntryW
(
url
,
lpwhr
->
dwContentLength
>
0
?
lpwhr
->
dwContentLength
:
0
,
NULL
,
cacheFileName
,
0
);
if
(
b
)
{
lpwhr
->
lpszCacheFile
=
WININET_strdupW
(
cacheFileName
);
lpwhr
->
hCacheFile
=
CreateFileW
(
lpwhr
->
lpszCacheFile
,
GENERIC_WRITE
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
lpwhr
->
hCacheFile
==
INVALID_HANDLE_VALUE
)
{
WARN
(
"Could not create file: %u
\n
"
,
GetLastError
());
lpwhr
->
hCacheFile
=
NULL
;
}
}
else
{
WARN
(
"Could not create cache entry: %08x
\n
"
,
GetLastError
());
}
}
lend:
HeapFree
(
GetProcessHeap
(),
0
,
requestString
);
...
...
@@ -3393,6 +3433,14 @@ static void HTTP_CloseHTTPRequestHandle(LPWININETHANDLEHEADER hdr)
TRACE
(
"
\n
"
);
if
(
lpwhr
->
hCacheFile
)
CloseHandle
(
lpwhr
->
hCacheFile
);
if
(
lpwhr
->
lpszCacheFile
)
{
DeleteFileW
(
lpwhr
->
lpszCacheFile
);
/* FIXME */
HeapFree
(
GetProcessHeap
(),
0
,
lpwhr
->
lpszCacheFile
);
}
WININET_Release
(
&
lpwhr
->
lpHttpSession
->
hdr
);
HeapFree
(
GetProcessHeap
(),
0
,
lpwhr
->
lpszPath
);
...
...
dlls/wininet/internet.c
View file @
d7a49e81
...
...
@@ -1775,6 +1775,15 @@ BOOL INTERNET_ReadFile(LPWININETHANDLEHEADER lpwh, LPVOID lpBuffer,
{
lpwhr
->
dwContentRead
+=
bytes_read
;
*
pdwNumOfBytesRead
=
bytes_read
;
if
(
lpwhr
->
lpszCacheFile
)
{
BOOL
res
;
res
=
WriteFile
(
lpwhr
->
hCacheFile
,
lpBuffer
,
bytes_read
,
NULL
,
NULL
);
if
(
!
res
)
WARN
(
"WriteFile failed: %u
\n
"
,
GetLastError
());
}
if
(
!
bytes_read
&&
(
lpwhr
->
dwContentRead
==
lpwhr
->
dwContentLength
))
retval
=
HTTP_FinishedReading
(
lpwhr
);
else
...
...
dlls/wininet/internet.h
View file @
d7a49e81
...
...
@@ -209,6 +209,8 @@ typedef struct
DWORD
dwContentRead
;
/* bytes of the content read so far */
HTTPHEADERW
*
pCustHeaders
;
DWORD
nCustHeaders
;
HANDLE
hCacheFile
;
LPWSTR
lpszCacheFile
;
struct
HttpAuthInfo
*
pAuthInfo
;
struct
HttpAuthInfo
*
pProxyAuthInfo
;
}
WININETHTTPREQW
,
*
LPWININETHTTPREQW
;
...
...
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