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
3c31cc58
Commit
3c31cc58
authored
Nov 25, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Build with msvcrt.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
cee281a0
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
268 additions
and
282 deletions
+268
-282
Makefile.in
dlls/wininet/Makefile.in
+2
-0
cookie.c
dlls/wininet/cookie.c
+22
-21
dialogs.c
dlls/wininet/dialogs.c
+9
-12
ftp.c
dlls/wininet/ftp.c
+6
-6
gopher.c
dlls/wininet/gopher.c
+0
-2
http.c
dlls/wininet/http.c
+159
-161
internet.c
dlls/wininet/internet.c
+45
-51
internet.h
dlls/wininet/internet.h
+2
-3
netconnection.c
dlls/wininet/netconnection.c
+0
-1
urlcache.c
dlls/wininet/urlcache.c
+16
-18
utility.c
dlls/wininet/utility.c
+7
-7
No files found.
dlls/wininet/Makefile.in
View file @
3c31cc58
...
...
@@ -4,6 +4,8 @@ IMPORTLIB = wininet
IMPORTS
=
mpr shlwapi shell32 user32 ws2_32 advapi32
DELAYIMPORTS
=
secur32 crypt32 cryptui dhcpcsvc iphlpapi
EXTRADLLFLAGS
=
-mno-cygwin
C_SRCS
=
\
cookie.c
\
dialogs.c
\
...
...
dlls/wininet/cookie.c
View file @
3c31cc58
...
...
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <wchar.h>
#include "windef.h"
#include "winbase.h"
...
...
@@ -173,7 +174,7 @@ static WCHAR *create_cookie_url(substr_t domain, substr_t path, substr_t *ret_pa
p
+=
domain
.
len
;
for
(
i
=
0
;
i
<
path
.
len
;
i
++
)
p
[
i
]
=
to
lowerW
(
path
.
str
[
i
]);
p
[
i
]
=
to
wlower
(
path
.
str
[
i
]);
p
[
path
.
len
]
=
0
;
ret_path
->
str
=
p
;
...
...
@@ -194,7 +195,7 @@ static cookie_container_t *get_cookie_container(substr_t domain, substr_t path,
if
(
cookie_container
->
path
.
len
<
path
.
len
)
break
;
if
(
path
.
len
==
cookie_container
->
path
.
len
&&
!
strncmpiW
(
cookie_container
->
path
.
str
,
path
.
str
,
path
.
len
))
if
(
path
.
len
==
cookie_container
->
path
.
len
&&
!
wcsnicmp
(
cookie_container
->
path
.
str
,
path
.
str
,
path
.
len
))
return
cookie_container
;
}
...
...
@@ -265,7 +266,7 @@ static cookie_t *find_cookie(cookie_container_t *container, substr_t name)
cookie_t
*
iter
;
LIST_FOR_EACH_ENTRY
(
iter
,
&
container
->
cookie_list
,
cookie_t
,
entry
)
{
if
(
strlenW
(
iter
->
name
)
==
name
.
len
&&
!
strncmpiW
(
iter
->
name
,
name
.
str
,
name
.
len
))
if
(
lstrlenW
(
iter
->
name
)
==
name
.
len
&&
!
wcsnicmp
(
iter
->
name
,
name
.
str
,
name
.
len
))
return
iter
;
}
...
...
@@ -294,7 +295,7 @@ static void replace_cookie(cookie_container_t *container, cookie_t *new_cookie)
static
BOOL
cookie_match_path
(
cookie_container_t
*
container
,
substr_t
path
)
{
return
path
.
len
>=
container
->
path
.
len
&&
!
strncmpiW
(
container
->
path
.
str
,
path
.
str
,
container
->
path
.
len
);
return
path
.
len
>=
container
->
path
.
len
&&
!
wcsnicmp
(
container
->
path
.
str
,
path
.
str
,
container
->
path
.
len
);
}
static
BOOL
load_persistent_cookie
(
substr_t
domain
,
substr_t
path
)
...
...
@@ -603,9 +604,9 @@ static DWORD get_cookie(substr_t host, substr_t path, DWORD flags, cookie_set_t
res
->
string_len
+=
2
;
/* '; ' */
res
->
cookies
[
res
->
cnt
++
]
=
cookie_iter
;
res
->
string_len
+=
strlenW
(
cookie_iter
->
name
);
res
->
string_len
+=
l
strlenW
(
cookie_iter
->
name
);
if
(
*
cookie_iter
->
data
)
res
->
string_len
+=
1
/* = */
+
strlenW
(
cookie_iter
->
data
);
res
->
string_len
+=
1
/* = */
+
l
strlenW
(
cookie_iter
->
data
);
}
}
}
...
...
@@ -624,13 +625,13 @@ static void cookie_set_to_string(const cookie_set_t *cookie_set, WCHAR *str)
*
ptr
++
=
' '
;
}
len
=
strlenW
(
cookie_set
->
cookies
[
i
]
->
name
);
len
=
l
strlenW
(
cookie_set
->
cookies
[
i
]
->
name
);
memcpy
(
ptr
,
cookie_set
->
cookies
[
i
]
->
name
,
len
*
sizeof
(
WCHAR
));
ptr
+=
len
;
if
(
*
cookie_set
->
cookies
[
i
]
->
data
)
{
*
ptr
++
=
'='
;
len
=
strlenW
(
cookie_set
->
cookies
[
i
]
->
data
);
len
=
l
strlenW
(
cookie_set
->
cookies
[
i
]
->
data
);
memcpy
(
ptr
,
cookie_set
->
cookies
[
i
]
->
data
,
len
*
sizeof
(
WCHAR
));
ptr
+=
len
;
}
...
...
@@ -872,11 +873,11 @@ static BOOL is_domain_legal_for_cookie(substr_t domain, substr_t full_domain)
return
FALSE
;
}
if
(
domain
.
len
>
full_domain
.
len
||
!
memchrW
(
domain
.
str
,
'.'
,
domain
.
len
)
||
!
memchrW
(
full_domain
.
str
,
'.'
,
full_domain
.
len
))
if
(
domain
.
len
>
full_domain
.
len
||
!
wmemchr
(
domain
.
str
,
'.'
,
domain
.
len
)
||
!
wmemchr
(
full_domain
.
str
,
'.'
,
full_domain
.
len
))
return
FALSE
;
ptr
=
full_domain
.
str
+
full_domain
.
len
-
domain
.
len
;
if
(
strncmpiW
(
domain
.
str
,
ptr
,
domain
.
len
)
||
(
full_domain
.
len
>
domain
.
len
&&
ptr
[
-
1
]
!=
'.'
))
{
if
(
wcsnicmp
(
domain
.
str
,
ptr
,
domain
.
len
)
||
(
full_domain
.
len
>
domain
.
len
&&
ptr
[
-
1
]
!=
'.'
))
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
...
...
@@ -924,7 +925,7 @@ DWORD set_cookie(substr_t domain, substr_t path, substr_t name, substr_t data, D
/* lots of information can be parsed out of the cookie value */
if
(
!
(
end_ptr
=
memchrW
(
data
.
str
,
';'
,
data
.
len
)))
if
(
!
(
end_ptr
=
wmemchr
(
data
.
str
,
';'
,
data
.
len
)))
end_ptr
=
data
.
str
+
data
.
len
;
value
=
substr
(
data
.
str
,
end_ptr
-
data
.
str
);
data
.
str
+=
value
.
len
;
...
...
@@ -949,10 +950,10 @@ DWORD set_cookie(substr_t domain, substr_t path, substr_t name, substr_t data, D
if
(
!
data
.
len
)
break
;
if
(
!
(
end_ptr
=
memchrW
(
data
.
str
,
';'
,
data
.
len
)))
if
(
!
(
end_ptr
=
wmemchr
(
data
.
str
,
';'
,
data
.
len
)))
end_ptr
=
data
.
str
+
data
.
len
;
if
(
data
.
len
>=
(
len
=
ARRAY_SIZE
(
szDomain
))
&&
!
strncmpiW
(
data
.
str
,
szDomain
,
len
))
{
if
(
data
.
len
>=
(
len
=
ARRAY_SIZE
(
szDomain
))
&&
!
wcsnicmp
(
data
.
str
,
szDomain
,
len
))
{
substr_skip
(
&
data
,
len
);
if
(
data
.
len
&&
*
data
.
str
==
'.'
)
...
...
@@ -963,11 +964,11 @@ DWORD set_cookie(substr_t domain, substr_t path, substr_t name, substr_t data, D
domain
=
substr
(
data
.
str
,
end_ptr
-
data
.
str
);
TRACE
(
"Parsing new domain %s
\n
"
,
debugstr_wn
(
domain
.
str
,
domain
.
len
));
}
else
if
(
data
.
len
>=
(
len
=
ARRAY_SIZE
(
szPath
))
&&
!
strncmpiW
(
data
.
str
,
szPath
,
len
))
{
}
else
if
(
data
.
len
>=
(
len
=
ARRAY_SIZE
(
szPath
))
&&
!
wcsnicmp
(
data
.
str
,
szPath
,
len
))
{
substr_skip
(
&
data
,
len
);
path
=
substr
(
data
.
str
,
end_ptr
-
data
.
str
);
TRACE
(
"Parsing new path %s
\n
"
,
debugstr_wn
(
path
.
str
,
path
.
len
));
}
else
if
(
data
.
len
>=
(
len
=
ARRAY_SIZE
(
szExpires
))
&&
!
strncmpiW
(
data
.
str
,
szExpires
,
len
))
{
}
else
if
(
data
.
len
>=
(
len
=
ARRAY_SIZE
(
szExpires
))
&&
!
wcsnicmp
(
data
.
str
,
szExpires
,
len
))
{
SYSTEMTIME
st
;
WCHAR
buf
[
128
];
...
...
@@ -986,10 +987,10 @@ DWORD set_cookie(substr_t domain, substr_t path, substr_t name, substr_t data, D
}
}
}
}
else
if
(
data
.
len
>=
(
len
=
ARRAY_SIZE
(
szSecure
))
&&
!
strncmpiW
(
data
.
str
,
szSecure
,
len
))
{
}
else
if
(
data
.
len
>=
(
len
=
ARRAY_SIZE
(
szSecure
))
&&
!
wcsnicmp
(
data
.
str
,
szSecure
,
len
))
{
substr_skip
(
&
data
,
len
);
FIXME
(
"secure not handled
\n
"
);
}
else
if
(
data
.
len
>=
(
len
=
ARRAY_SIZE
(
szHttpOnly
))
&&
!
strncmpiW
(
data
.
str
,
szHttpOnly
,
len
))
{
}
else
if
(
data
.
len
>=
(
len
=
ARRAY_SIZE
(
szHttpOnly
))
&&
!
wcsnicmp
(
data
.
str
,
szHttpOnly
,
len
))
{
substr_skip
(
&
data
,
len
);
if
(
!
(
flags
&
INTERNET_COOKIE_HTTPONLY
))
{
...
...
@@ -999,11 +1000,11 @@ DWORD set_cookie(substr_t domain, substr_t path, substr_t name, substr_t data, D
}
cookie_flags
|=
INTERNET_COOKIE_HTTPONLY
;
}
else
if
(
data
.
len
>=
(
len
=
ARRAY_SIZE
(
szVersion
))
&&
!
strncmpiW
(
data
.
str
,
szVersion
,
len
))
{
}
else
if
(
data
.
len
>=
(
len
=
ARRAY_SIZE
(
szVersion
))
&&
!
wcsnicmp
(
data
.
str
,
szVersion
,
len
))
{
substr_skip
(
&
data
,
len
);
FIXME
(
"version not handled (%s)
\n
"
,
debugstr_wn
(
data
.
str
,
data
.
len
));
}
else
if
(
data
.
len
>=
(
len
=
ARRAY_SIZE
(
max_ageW
))
&&
!
strncmpiW
(
data
.
str
,
max_ageW
,
len
))
{
}
else
if
(
data
.
len
>=
(
len
=
ARRAY_SIZE
(
max_ageW
))
&&
!
wcsnicmp
(
data
.
str
,
max_ageW
,
len
))
{
/* Native doesn't support Max-Age attribute. */
WARN
(
"Max-Age ignored
\n
"
);
}
else
if
(
data
.
len
)
{
...
...
@@ -1098,8 +1099,8 @@ DWORD WINAPI InternetSetCookieExW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
/* some apps (or is it us??) try to add a cookie with no cookie name, but
* the cookie data in the form of name[=data].
*/
if
(
!
(
ptr
=
strchrW
(
lpCookieData
,
'='
)))
ptr
=
lpCookieData
+
strlenW
(
lpCookieData
);
if
(
!
(
ptr
=
wcschr
(
lpCookieData
,
'='
)))
ptr
=
lpCookieData
+
l
strlenW
(
lpCookieData
);
name
=
substr
(
lpCookieData
,
ptr
-
lpCookieData
);
data
=
substrz
(
*
ptr
==
'='
?
ptr
+
1
:
ptr
);
...
...
dlls/wininet/dialogs.c
View file @
3c31cc58
...
...
@@ -35,9 +35,6 @@
#include "cryptuiapi.h"
#include "internet.h"
#include "wine/unicode.h"
#include "resource.h"
#define MAX_STRING_LEN 1024
...
...
@@ -78,8 +75,8 @@ static BOOL WININET_GetAuthRealm( HINTERNET hRequest, LPWSTR szBuf, DWORD sz, BO
* FIXME: maybe we should check that we're
* dealing with 'Basic' Authentication
*/
p
=
strchrW
(
szBuf
,
' '
);
if
(
!
p
||
strncmpW
(
p
+
1
,
szRealm
,
strlenW
(
szRealm
)
)
)
p
=
wcschr
(
szBuf
,
' '
);
if
(
!
p
||
wcsncmp
(
p
+
1
,
szRealm
,
l
strlenW
(
szRealm
)
)
)
{
ERR
(
"response wrong? (%s)
\n
"
,
debugstr_w
(
szBuf
));
return
FALSE
;
...
...
@@ -90,11 +87,11 @@ static BOOL WININET_GetAuthRealm( HINTERNET hRequest, LPWSTR szBuf, DWORD sz, BO
if
(
*
p
==
'"'
)
{
p
++
;
q
=
strrchrW
(
p
,
'"'
);
q
=
wcsrchr
(
p
,
'"'
);
if
(
q
)
*
q
=
0
;
}
strcpyW
(
szBuf
,
p
);
l
strcpyW
(
szBuf
,
p
);
return
TRUE
;
}
...
...
@@ -137,11 +134,11 @@ static BOOL WININET_GetSetPassword( HWND hdlg, LPCWSTR szServer,
szUserPass
[
0
]
=
0
;
GetWindowTextW
(
hUserItem
,
szUserPass
,
ARRAY_SIZE
(
szUserPass
)
-
1
);
lstrcatW
(
szUserPass
,
szColon
);
u_len
=
strlenW
(
szUserPass
);
u_len
=
l
strlenW
(
szUserPass
);
GetWindowTextW
(
hPassItem
,
szUserPass
+
u_len
,
ARRAY_SIZE
(
szUserPass
)
-
u_len
);
r_len
=
(
strlenW
(
szResource
)
+
1
)
*
sizeof
(
WCHAR
);
u_len
=
(
strlenW
(
szUserPass
)
+
1
)
*
sizeof
(
WCHAR
);
r_len
=
(
l
strlenW
(
szResource
)
+
1
)
*
sizeof
(
WCHAR
);
u_len
=
(
l
strlenW
(
szUserPass
)
+
1
)
*
sizeof
(
WCHAR
);
r
=
WNetCachePassword
(
(
CHAR
*
)
szResource
,
r_len
,
(
CHAR
*
)
szUserPass
,
u_len
,
dwMagic
,
0
);
...
...
@@ -149,13 +146,13 @@ static BOOL WININET_GetSetPassword( HWND hdlg, LPCWSTR szServer,
}
sz
=
sizeof
szUserPass
;
r_len
=
(
strlenW
(
szResource
)
+
1
)
*
sizeof
(
WCHAR
);
r_len
=
(
l
strlenW
(
szResource
)
+
1
)
*
sizeof
(
WCHAR
);
r
=
WNetGetCachedPassword
(
(
CHAR
*
)
szResource
,
r_len
,
(
CHAR
*
)
szUserPass
,
&
sz
,
dwMagic
);
if
(
r
!=
WN_SUCCESS
)
return
FALSE
;
p
=
strchrW
(
szUserPass
,
':'
);
p
=
wcschr
(
szUserPass
,
':'
);
if
(
p
)
{
*
p
=
0
;
...
...
dlls/wininet/ftp.c
View file @
3c31cc58
...
...
@@ -834,8 +834,8 @@ static HINTERNET FTP_FtpFindFirstFileW(ftp_session_t *lpwfs,
if
(
lpszSearchFile
)
{
LPCWSTR
name
=
lpszSearchFile
,
p
;
if
((
p
=
strrchrW
(
name
,
'\\'
)))
name
=
p
+
1
;
if
((
p
=
strrchrW
(
name
,
'/'
)))
name
=
p
+
1
;
if
((
p
=
wcsrchr
(
name
,
'\\'
)))
name
=
p
+
1
;
if
((
p
=
wcsrchr
(
name
,
'/'
)))
name
=
p
+
1
;
if
(
name
!=
lpszSearchFile
)
{
lpszSearchPath
=
heap_strndupW
(
lpszSearchFile
,
name
-
lpszSearchFile
);
...
...
@@ -2480,7 +2480,7 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName,
list_add_head
(
&
hIC
->
hdr
.
children
,
&
lpwfs
->
hdr
.
entry
);
if
(
hIC
->
proxy
&&
hIC
->
accessType
==
INTERNET_OPEN_TYPE_PROXY
)
{
if
(
strchrW
(
hIC
->
proxy
,
' '
))
if
(
wcschr
(
hIC
->
proxy
,
' '
))
FIXME
(
"Several proxies not implemented.
\n
"
);
if
(
hIC
->
proxyBypass
)
FIXME
(
"Proxy bypass is ignored.
\n
"
);
...
...
@@ -2497,7 +2497,7 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName,
/* Nothing in the registry, get the username and use that as the password */
if
(
!
GetUserNameW
(
szPassword
,
&
len
))
{
/* Should never get here, but use an empty password as failsafe */
strcpyW
(
szPassword
,
szEmpty
);
l
strcpyW
(
szPassword
,
szEmpty
);
}
}
RegCloseKey
(
key
);
...
...
@@ -2525,7 +2525,7 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName,
}
INTERNET_SendCallback
(
&
hIC
->
hdr
,
dwContext
,
INTERNET_STATUS_RESOLVING_NAME
,
(
LPWSTR
)
lpszServerName
,
(
strlenW
(
lpszServerName
)
+
1
)
*
sizeof
(
WCHAR
));
(
LPWSTR
)
lpszServerName
,
(
l
strlenW
(
lpszServerName
)
+
1
)
*
sizeof
(
WCHAR
));
sock_namelen
=
sizeof
(
socketAddr
);
if
(
!
GetAddress
(
lpszServerName
,
lpwfs
->
serverport
,
(
struct
sockaddr
*
)
&
socketAddr
,
&
sock_namelen
,
szaddr
))
...
...
@@ -3098,7 +3098,7 @@ static BOOL FTP_SendPort(ftp_session_t *lpwfs)
BOOL
bSuccess
=
FALSE
;
TRACE
(
"
\n
"
);
s
printfW
(
szIPAddress
,
szIPFormat
,
s
wprintf
(
szIPAddress
,
ARRAY_SIZE
(
szIPAddress
)
,
szIPFormat
,
lpwfs
->
lstnSocketAddress
.
sin_addr
.
S_un
.
S_addr
&
0x000000FF
,
(
lpwfs
->
lstnSocketAddress
.
sin_addr
.
S_un
.
S_addr
&
0x0000FF00
)
>>
8
,
(
lpwfs
->
lstnSocketAddress
.
sin_addr
.
S_un
.
S_addr
&
0x00FF0000
)
>>
16
,
...
...
dlls/wininet/gopher.c
View file @
3c31cc58
...
...
@@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdarg.h>
#include "windef.h"
...
...
dlls/wininet/http.c
View file @
3c31cc58
...
...
@@ -27,8 +27,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdlib.h>
#include "winsock2.h"
...
...
@@ -58,7 +56,6 @@
#include "zlib.h"
#include "wine/debug.h"
#include "wine/exception.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
wininet
);
...
...
@@ -237,19 +234,20 @@ void server_release(server_t *server)
static
BOOL
process_host_port
(
server_t
*
server
)
{
BOOL
default_port
;
size_t
name_len
;
size_t
name_len
,
len
;
WCHAR
*
buf
;
static
const
WCHAR
httpW
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
0
};
static
const
WCHAR
httpsW
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
's'
,
0
};
static
const
WCHAR
formatW
[]
=
{
'%'
,
's'
,
':'
,
'/'
,
'/'
,
'%'
,
's'
,
':'
,
'%'
,
'u'
,
0
};
name_len
=
strlenW
(
server
->
name
);
buf
=
heap_alloc
((
name_len
+
10
/* strlen("://:<port>") */
)
*
sizeof
(
WCHAR
)
+
sizeof
(
httpsW
));
name_len
=
lstrlenW
(
server
->
name
);
len
=
name_len
+
10
/* strlen("://:<port>") */
+
ARRAY_SIZE
(
httpsW
);
buf
=
heap_alloc
(
len
*
sizeof
(
WCHAR
)
);
if
(
!
buf
)
return
FALSE
;
s
printfW
(
buf
,
formatW
,
server
->
is_https
?
httpsW
:
httpW
,
server
->
name
,
server
->
port
);
s
wprintf
(
buf
,
len
,
formatW
,
server
->
is_https
?
httpsW
:
httpW
,
server
->
name
,
server
->
port
);
server
->
scheme_host_port
=
buf
;
server
->
host_port
=
server
->
scheme_host_port
+
7
/* strlen("http://") */
;
...
...
@@ -268,7 +266,7 @@ server_t *get_server(substr_t name, INTERNET_PORT port, BOOL is_https, BOOL do_c
EnterCriticalSection
(
&
connection_pool_cs
);
LIST_FOR_EACH_ENTRY
(
iter
,
&
connection_pool
,
server_t
,
entry
)
{
if
(
iter
->
port
==
port
&&
name
.
len
==
strlenW
(
iter
->
name
)
&&
!
strncmpiW
(
iter
->
name
,
name
.
str
,
name
.
len
)
if
(
iter
->
port
==
port
&&
name
.
len
==
lstrlenW
(
iter
->
name
)
&&
!
wcsnicmp
(
iter
->
name
,
name
.
str
,
name
.
len
)
&&
iter
->
is_https
==
is_https
)
{
server
=
iter
;
server_addref
(
server
);
...
...
@@ -593,7 +591,7 @@ static void HTTP_FixURL(http_request_t *request)
request
->
path
=
heap_strdupW
(
szSlash
);
else
/* remove \r and \n*/
{
int
nLen
=
strlenW
(
request
->
path
);
int
nLen
=
l
strlenW
(
request
->
path
);
while
((
nLen
>
0
)
&&
((
request
->
path
[
nLen
-
1
]
==
'\r'
)
||
(
request
->
path
[
nLen
-
1
]
==
'\n'
)))
{
nLen
--
;
...
...
@@ -607,12 +605,12 @@ static void HTTP_FixURL(http_request_t *request)
}
if
(
CSTR_EQUAL
!=
CompareStringW
(
LOCALE_INVARIANT
,
NORM_IGNORECASE
,
request
->
path
,
strlenW
(
request
->
path
),
szHttp
,
strlenW
(
szHttp
)
)
request
->
path
,
lstrlenW
(
request
->
path
),
szHttp
,
l
strlenW
(
szHttp
)
)
&&
request
->
path
[
0
]
!=
'/'
)
/* not an absolute path ?? --> fix it !! */
{
WCHAR
*
fixurl
=
heap_alloc
((
strlenW
(
request
->
path
)
+
2
)
*
sizeof
(
WCHAR
));
WCHAR
*
fixurl
=
heap_alloc
((
l
strlenW
(
request
->
path
)
+
2
)
*
sizeof
(
WCHAR
));
*
fixurl
=
'/'
;
strcpyW
(
fixurl
+
1
,
request
->
path
);
l
strcpyW
(
fixurl
+
1
,
request
->
path
);
heap_free
(
request
->
path
);
request
->
path
=
fixurl
;
}
...
...
@@ -700,7 +698,7 @@ static WCHAR* build_response_header(http_request_t *request, BOOL use_cr)
if
(
request
->
status_code
)
{
req
[
n
++
]
=
request
->
version
;
s
printfW
(
buf
,
status_fmt
,
request
->
status_code
);
s
wprintf
(
buf
,
ARRAY_SIZE
(
buf
)
,
status_fmt
,
request
->
status_code
);
req
[
n
++
]
=
buf
;
req
[
n
++
]
=
request
->
statusText
;
if
(
use_cr
)
...
...
@@ -711,7 +709,7 @@ static WCHAR* build_response_header(http_request_t *request, BOOL use_cr)
for
(
i
=
0
;
i
<
request
->
nCustHeaders
;
i
++
)
{
if
(
!
(
request
->
custHeaders
[
i
].
wFlags
&
HDR_ISREQUEST
)
&&
strcmpW
(
request
->
custHeaders
[
i
].
lpszField
,
szStatus
))
&&
wcscmp
(
request
->
custHeaders
[
i
].
lpszField
,
szStatus
))
{
req
[
n
++
]
=
request
->
custHeaders
[
i
].
lpszField
;
req
[
n
++
]
=
colonW
;
...
...
@@ -757,7 +755,7 @@ static void HTTP_ProcessCookies( http_request_t *request )
if
(
!
setCookieHeader
->
lpszValue
)
continue
;
data
=
strchrW
(
setCookieHeader
->
lpszValue
,
'='
);
data
=
wcschr
(
setCookieHeader
->
lpszValue
,
'='
);
if
(
!
data
)
continue
;
...
...
@@ -778,9 +776,9 @@ static void strip_spaces(LPWSTR start)
str
++
;
if
(
str
!=
start
)
memmove
(
start
,
str
,
sizeof
(
WCHAR
)
*
(
strlenW
(
str
)
+
1
));
memmove
(
start
,
str
,
sizeof
(
WCHAR
)
*
(
l
strlenW
(
str
)
+
1
));
end
=
start
+
strlenW
(
start
)
-
1
;
end
=
start
+
l
strlenW
(
start
)
-
1
;
while
(
end
>=
start
&&
*
end
==
' '
)
{
*
end
=
'\0'
;
...
...
@@ -793,7 +791,7 @@ static inline BOOL is_basic_auth_value( LPCWSTR pszAuthValue, LPWSTR *pszRealm )
static
const
WCHAR
szBasic
[]
=
{
'B'
,
'a'
,
's'
,
'i'
,
'c'
};
/* Note: not nul-terminated */
static
const
WCHAR
szRealm
[]
=
{
'r'
,
'e'
,
'a'
,
'l'
,
'm'
};
/* Note: not nul-terminated */
BOOL
is_basic
;
is_basic
=
!
strncmpiW
(
pszAuthValue
,
szBasic
,
ARRAY_SIZE
(
szBasic
))
&&
is_basic
=
!
wcsnicmp
(
pszAuthValue
,
szBasic
,
ARRAY_SIZE
(
szBasic
))
&&
((
pszAuthValue
[
ARRAY_SIZE
(
szBasic
)]
==
' '
)
||
!
pszAuthValue
[
ARRAY_SIZE
(
szBasic
)]);
if
(
is_basic
&&
pszRealm
)
{
...
...
@@ -802,13 +800,13 @@ static inline BOOL is_basic_auth_value( LPCWSTR pszAuthValue, LPWSTR *pszRealm )
LPCWSTR
realm
;
ptr
++
;
*
pszRealm
=
NULL
;
token
=
strchrW
(
ptr
,
'='
);
token
=
wcschr
(
ptr
,
'='
);
if
(
!
token
)
return
TRUE
;
realm
=
ptr
;
while
(
*
realm
==
' '
)
realm
++
;
if
(
!
strncmpiW
(
realm
,
szRealm
,
ARRAY_SIZE
(
szRealm
))
&&
if
(
!
wcsnicmp
(
realm
,
szRealm
,
ARRAY_SIZE
(
szRealm
))
&&
(
realm
[
ARRAY_SIZE
(
szRealm
)]
==
' '
||
realm
[
ARRAY_SIZE
(
szRealm
)]
==
'='
))
{
token
++
;
...
...
@@ -848,7 +846,7 @@ static UINT retrieve_cached_basic_authorization(http_request_t *req, const WCHAR
EnterCriticalSection
(
&
authcache_cs
);
LIST_FOR_EACH_ENTRY
(
ad
,
&
basicAuthorizationCache
,
basicAuthorizationData
,
entry
)
{
if
(
!
strcmpiW
(
host
,
ad
->
host
)
&&
(
!
realm
||
!
strcmpW
(
realm
,
ad
->
realm
)))
if
(
!
wcsicmp
(
host
,
ad
->
host
)
&&
(
!
realm
||
!
wcscmp
(
realm
,
ad
->
realm
)))
{
char
*
colon
;
DWORD
length
;
...
...
@@ -886,7 +884,7 @@ static void cache_basic_authorization(LPWSTR host, LPWSTR realm, LPSTR auth_data
LIST_FOR_EACH
(
cursor
,
&
basicAuthorizationCache
)
{
basicAuthorizationData
*
check
=
LIST_ENTRY
(
cursor
,
basicAuthorizationData
,
entry
);
if
(
!
strcmpiW
(
host
,
check
->
host
)
&&
!
strcmpW
(
realm
,
check
->
realm
))
if
(
!
wcsicmp
(
host
,
check
->
host
)
&&
!
wcscmp
(
realm
,
check
->
realm
))
{
ad
=
check
;
break
;
...
...
@@ -924,7 +922,7 @@ static BOOL retrieve_cached_authorization(LPWSTR host, LPWSTR scheme,
EnterCriticalSection
(
&
authcache_cs
);
LIST_FOR_EACH_ENTRY
(
ad
,
&
authorizationCache
,
authorizationData
,
entry
)
{
if
(
!
strcmpiW
(
host
,
ad
->
host
)
&&
!
strcmpiW
(
scheme
,
ad
->
scheme
))
{
if
(
!
wcsicmp
(
host
,
ad
->
host
)
&&
!
wcsicmp
(
scheme
,
ad
->
scheme
))
{
TRACE
(
"Authorization found in cache
\n
"
);
nt_auth_identity
->
User
=
heap_strdupW
(
ad
->
user
);
...
...
@@ -962,7 +960,7 @@ static void cache_authorization(LPWSTR host, LPWSTR scheme,
EnterCriticalSection
(
&
authcache_cs
);
LIST_FOR_EACH_ENTRY
(
ad
,
&
authorizationCache
,
authorizationData
,
entry
)
if
(
!
strcmpiW
(
host
,
ad
->
host
)
&&
!
strcmpiW
(
scheme
,
ad
->
scheme
))
{
if
(
!
wcsicmp
(
host
,
ad
->
host
)
&&
!
wcsicmp
(
scheme
,
ad
->
scheme
))
{
found
=
TRUE
;
break
;
}
...
...
@@ -1088,7 +1086,7 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue,
if
(
domain_and_username
)
{
WCHAR
*
user
=
strchrW
(
domain_and_username
,
'\\'
);
WCHAR
*
user
=
wcschr
(
domain_and_username
,
'\\'
);
WCHAR
*
domain
=
domain_and_username
;
/* FIXME: make sure scheme accepts SEC_WINNT_AUTH_IDENTITY before calling AcquireCredentialsHandle */
...
...
@@ -1104,11 +1102,11 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue,
nt_auth_identity
.
Flags
=
SEC_WINNT_AUTH_IDENTITY_UNICODE
;
nt_auth_identity
.
User
=
user
;
nt_auth_identity
.
UserLength
=
strlenW
(
nt_auth_identity
.
User
);
nt_auth_identity
.
UserLength
=
l
strlenW
(
nt_auth_identity
.
User
);
nt_auth_identity
.
Domain
=
domain
;
nt_auth_identity
.
DomainLength
=
domain
?
user
-
domain
-
1
:
0
;
nt_auth_identity
.
Password
=
password
;
nt_auth_identity
.
PasswordLength
=
strlenW
(
nt_auth_identity
.
Password
);
nt_auth_identity
.
PasswordLength
=
l
strlenW
(
nt_auth_identity
.
Password
);
cache_authorization
(
host
,
pAuthInfo
->
scheme
,
&
nt_auth_identity
);
}
...
...
@@ -1154,8 +1152,8 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue,
else
if
(
pAuthInfo
->
finished
)
return
FALSE
;
if
((
strlenW
(
pszAuthValue
)
<
strlenW
(
pAuthInfo
->
scheme
))
||
strncmpiW
(
pszAuthValue
,
pAuthInfo
->
scheme
,
strlenW
(
pAuthInfo
->
scheme
)))
if
((
lstrlenW
(
pszAuthValue
)
<
l
strlenW
(
pAuthInfo
->
scheme
))
||
wcsnicmp
(
pszAuthValue
,
pAuthInfo
->
scheme
,
l
strlenW
(
pAuthInfo
->
scheme
)))
{
ERR
(
"authentication scheme changed from %s to %s
\n
"
,
debugstr_w
(
pAuthInfo
->
scheme
),
debugstr_w
(
pszAuthValue
));
...
...
@@ -1225,7 +1223,7 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue,
in_desc
.
cBuffers
=
1
;
in_desc
.
pBuffers
=
&
in
;
pszAuthData
=
pszAuthValue
+
strlenW
(
pAuthInfo
->
scheme
);
pszAuthData
=
pszAuthValue
+
l
strlenW
(
pAuthInfo
->
scheme
);
if
(
*
pszAuthData
==
' '
)
{
pszAuthData
++
;
...
...
@@ -1291,7 +1289,7 @@ static DWORD HTTP_HttpAddRequestHeadersW(http_request_t *request,
TRACE
(
"copying header: %s
\n
"
,
debugstr_wn
(
lpszHeader
,
dwHeaderLength
));
if
(
dwHeaderLength
==
~
0U
)
len
=
strlenW
(
lpszHeader
);
len
=
l
strlenW
(
lpszHeader
);
else
len
=
dwHeaderLength
;
buffer
=
heap_alloc
(
sizeof
(
WCHAR
)
*
(
len
+
1
));
...
...
@@ -1639,7 +1637,7 @@ static UINT HTTP_DecodeBase64( LPCWSTR base64, LPSTR bin )
static
WCHAR
*
encode_auth_data
(
const
WCHAR
*
scheme
,
const
char
*
data
,
UINT
data_len
)
{
WCHAR
*
ret
;
UINT
len
,
scheme_len
=
strlenW
(
scheme
);
UINT
len
,
scheme_len
=
l
strlenW
(
scheme
);
/* scheme + space + base64 encoded data (3/2/1 bytes data -> 4 bytes of characters) */
len
=
scheme_len
+
1
+
((
data_len
+
2
)
*
4
)
/
3
;
...
...
@@ -1671,7 +1669,7 @@ static BOOL HTTP_InsertAuthorization( http_request_t *request, struct HttpAuthIn
/* clear the data as it isn't valid now that it has been sent to the
* server, unless it's Basic authentication which doesn't do
* connection tracking */
if
(
strcmpiW
(
pAuthInfo
->
scheme
,
wszBasic
))
if
(
wcsicmp
(
pAuthInfo
->
scheme
,
wszBasic
))
{
heap_free
(
pAuthInfo
->
auth_data
);
pAuthInfo
->
auth_data
=
NULL
;
...
...
@@ -1691,7 +1689,7 @@ static BOOL HTTP_InsertAuthorization( http_request_t *request, struct HttpAuthIn
char
*
data
;
/* Don't use cached credentials when a username or Authorization was specified */
if
((
request
->
session
->
userName
&&
request
->
session
->
userName
[
0
])
||
strcmpW
(
header
,
szAuthorization
))
if
((
request
->
session
->
userName
&&
request
->
session
->
userName
[
0
])
||
wcscmp
(
header
,
szAuthorization
))
return
TRUE
;
if
(
!
(
host
=
get_host_header
(
request
)))
...
...
@@ -1725,8 +1723,8 @@ static WCHAR *build_proxy_path_url(http_request_t *req)
DWORD
size
,
len
;
WCHAR
*
url
;
len
=
strlenW
(
req
->
server
->
scheme_host_port
);
size
=
len
+
strlenW
(
req
->
path
)
+
1
;
len
=
l
strlenW
(
req
->
server
->
scheme_host_port
);
size
=
len
+
l
strlenW
(
req
->
path
)
+
1
;
if
(
*
req
->
path
!=
'/'
)
size
++
;
url
=
heap_alloc
(
size
*
sizeof
(
WCHAR
));
...
...
@@ -1737,7 +1735,7 @@ static WCHAR *build_proxy_path_url(http_request_t *req)
if
(
*
req
->
path
!=
'/'
)
url
[
len
++
]
=
'/'
;
strcpyW
(
url
+
len
,
req
->
path
);
l
strcpyW
(
url
+
len
,
req
->
path
);
TRACE
(
"url=%s
\n
"
,
debugstr_w
(
url
));
return
url
;
...
...
@@ -1749,11 +1747,11 @@ static BOOL HTTP_DomainMatches(LPCWSTR server, substr_t domain)
const
WCHAR
*
dot
,
*
ptr
;
int
len
;
if
(
domain
.
len
==
ARRAY_SIZE
(
localW
)
-
1
&&
!
strncmpiW
(
domain
.
str
,
localW
,
domain
.
len
)
&&
!
strchrW
(
server
,
'.'
))
if
(
domain
.
len
==
ARRAY_SIZE
(
localW
)
-
1
&&
!
wcsnicmp
(
domain
.
str
,
localW
,
domain
.
len
)
&&
!
wcschr
(
server
,
'.'
))
return
TRUE
;
if
(
domain
.
len
&&
*
domain
.
str
!=
'*'
)
return
domain
.
len
==
strlenW
(
server
)
&&
!
strncmpiW
(
server
,
domain
.
str
,
domain
.
len
);
return
domain
.
len
==
lstrlenW
(
server
)
&&
!
wcsnicmp
(
server
,
domain
.
str
,
domain
.
len
);
if
(
domain
.
len
<
2
||
domain
.
str
[
1
]
!=
'.'
)
return
FALSE
;
...
...
@@ -1762,11 +1760,11 @@ static BOOL HTTP_DomainMatches(LPCWSTR server, substr_t domain)
* the wildcard exactly. E.g. if the wildcard is *.a.b, and the
* hostname is www.foo.a.b, it matches, but a.b does not.
*/
dot
=
strchrW
(
server
,
'.'
);
dot
=
wcschr
(
server
,
'.'
);
if
(
!
dot
)
return
FALSE
;
len
=
strlenW
(
dot
+
1
);
len
=
l
strlenW
(
dot
+
1
);
if
(
len
<
domain
.
len
-
2
)
return
FALSE
;
...
...
@@ -1775,7 +1773,7 @@ static BOOL HTTP_DomainMatches(LPCWSTR server, substr_t domain)
* server's domain.
*/
ptr
=
dot
+
1
+
len
-
domain
.
len
+
2
;
if
(
!
strncmpiW
(
ptr
,
domain
.
str
+
2
,
domain
.
len
-
2
))
if
(
!
wcsnicmp
(
ptr
,
domain
.
str
+
2
,
domain
.
len
-
2
))
/* This is only a match if the preceding character is
* a '.', i.e. that it is a matching domain. E.g.
* if domain is '*.b.c' and server is 'www.ab.c' they
...
...
@@ -1783,7 +1781,7 @@ static BOOL HTTP_DomainMatches(LPCWSTR server, substr_t domain)
*/
return
*
(
ptr
-
1
)
==
'.'
;
return
len
==
domain
.
len
-
2
&&
!
strncmpiW
(
dot
+
1
,
domain
.
str
+
2
,
len
);
return
len
==
domain
.
len
-
2
&&
!
wcsnicmp
(
dot
+
1
,
domain
.
str
+
2
,
len
);
}
static
BOOL
HTTP_ShouldBypassProxy
(
appinfo_t
*
lpwai
,
LPCWSTR
server
)
...
...
@@ -1796,11 +1794,11 @@ static BOOL HTTP_ShouldBypassProxy(appinfo_t *lpwai, LPCWSTR server)
while
(
1
)
{
LPCWSTR
tmp
=
ptr
;
ptr
=
strchrW
(
ptr
,
';'
);
ptr
=
wcschr
(
ptr
,
';'
);
if
(
!
ptr
)
ptr
=
strchrW
(
tmp
,
' '
);
ptr
=
wcschr
(
tmp
,
' '
);
if
(
!
ptr
)
ptr
=
tmp
+
strlenW
(
tmp
);
ptr
=
tmp
+
l
strlenW
(
tmp
);
ret
=
HTTP_DomainMatches
(
server
,
substr
(
tmp
,
ptr
-
tmp
)
);
if
(
ret
||
!*
ptr
)
break
;
...
...
@@ -1825,14 +1823,14 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_req
if
(
!
proxy
)
return
FALSE
;
if
(
CSTR_EQUAL
!=
CompareStringW
(
LOCALE_SYSTEM_DEFAULT
,
NORM_IGNORECASE
,
proxy
,
strlenW
(
szHttp
),
szHttp
,
strlenW
(
szHttp
)))
{
WCHAR
*
proxy_url
=
heap_alloc
(
strlenW
(
proxy
)
*
sizeof
(
WCHAR
)
+
sizeof
(
szHttp
));
proxy
,
lstrlenW
(
szHttp
),
szHttp
,
l
strlenW
(
szHttp
)))
{
WCHAR
*
proxy_url
=
heap_alloc
(
l
strlenW
(
proxy
)
*
sizeof
(
WCHAR
)
+
sizeof
(
szHttp
));
if
(
!
proxy_url
)
{
heap_free
(
proxy
);
return
FALSE
;
}
strcpyW
(
proxy_url
,
szHttp
);
strcatW
(
proxy_url
,
proxy
);
l
strcpyW
(
proxy_url
,
szHttp
);
l
strcatW
(
proxy_url
,
proxy
);
heap_free
(
proxy
);
proxy
=
proxy_url
;
}
...
...
@@ -1866,7 +1864,7 @@ static DWORD HTTP_ResolveName(http_request_t *request)
INTERNET_SendCallback
(
&
request
->
hdr
,
request
->
hdr
.
dwContext
,
INTERNET_STATUS_RESOLVING_NAME
,
server
->
name
,
(
strlenW
(
server
->
name
)
+
1
)
*
sizeof
(
WCHAR
));
(
l
strlenW
(
server
->
name
)
+
1
)
*
sizeof
(
WCHAR
));
addr_len
=
sizeof
(
server
->
addr
);
if
(
!
GetAddress
(
server
->
name
,
server
->
port
,
(
SOCKADDR
*
)
&
server
->
addr
,
&
addr_len
,
server
->
addr_str
))
...
...
@@ -1896,20 +1894,20 @@ static WCHAR *compose_request_url(http_request_t *req)
else
scheme
=
http
;
len
=
strlenW
(
scheme
)
+
strlenW
(
host
)
+
(
req
->
path
[
0
]
!=
'/'
?
1
:
0
)
+
strlenW
(
req
->
path
);
len
=
lstrlenW
(
scheme
)
+
lstrlenW
(
host
)
+
(
req
->
path
[
0
]
!=
'/'
?
1
:
0
)
+
l
strlenW
(
req
->
path
);
ptr
=
buf
=
heap_alloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
if
(
buf
)
{
strcpyW
(
ptr
,
scheme
);
ptr
+=
strlenW
(
ptr
);
l
strcpyW
(
ptr
,
scheme
);
ptr
+=
l
strlenW
(
ptr
);
strcpyW
(
ptr
,
host
);
ptr
+=
strlenW
(
ptr
);
l
strcpyW
(
ptr
,
host
);
ptr
+=
l
strlenW
(
ptr
);
if
(
req
->
path
[
0
]
!=
'/'
)
*
ptr
++
=
'/'
;
strcpyW
(
ptr
,
req
->
path
);
ptr
+=
strlenW
(
ptr
);
l
strcpyW
(
ptr
,
req
->
path
);
ptr
+=
l
strlenW
(
ptr
);
*
ptr
=
0
;
}
...
...
@@ -2024,7 +2022,7 @@ static BOOL HTTP_KeepAlive(http_request_t *request)
/* as per RFC 2068, S8.1.2.1, if the client is HTTP/1.1 then assume that
* the connection is keep-alive by default */
if
(
HTTP_HttpQueryInfoW
(
request
,
HTTP_QUERY_VERSION
,
szVersion
,
&
dwBufferSize
,
NULL
)
==
ERROR_SUCCESS
&&
!
strcmpiW
(
szVersion
,
g_szHttp1_1
))
&&
!
wcsicmp
(
szVersion
,
g_szHttp1_1
))
{
keepalive
=
TRUE
;
}
...
...
@@ -2033,7 +2031,7 @@ static BOOL HTTP_KeepAlive(http_request_t *request)
if
(
HTTP_HttpQueryInfoW
(
request
,
HTTP_QUERY_PROXY_CONNECTION
,
szConnectionResponse
,
&
dwBufferSize
,
NULL
)
==
ERROR_SUCCESS
||
HTTP_HttpQueryInfoW
(
request
,
HTTP_QUERY_CONNECTION
,
szConnectionResponse
,
&
dwBufferSize
,
NULL
)
==
ERROR_SUCCESS
)
{
keepalive
=
!
strcmpiW
(
szConnectionResponse
,
szKeepAlive
);
keepalive
=
!
wcsicmp
(
szConnectionResponse
,
szKeepAlive
);
}
return
keepalive
;
...
...
@@ -2053,14 +2051,14 @@ static DWORD str_to_buffer(const WCHAR *str, void *buffer, DWORD *size, BOOL uni
{
WCHAR
*
buf
=
buffer
;
if
(
str
)
len
=
strlenW
(
str
);
if
(
str
)
len
=
l
strlenW
(
str
);
else
len
=
0
;
if
(
*
size
<
(
len
+
1
)
*
sizeof
(
WCHAR
))
{
*
size
=
(
len
+
1
)
*
sizeof
(
WCHAR
);
return
ERROR_INSUFFICIENT_BUFFER
;
}
if
(
str
)
strcpyW
(
buf
,
str
);
if
(
str
)
l
strcpyW
(
buf
,
str
);
else
buf
[
0
]
=
0
;
*
size
=
len
;
...
...
@@ -2398,7 +2396,7 @@ static void commit_cache_entry(http_request_t *req)
req
->
hCacheFile
=
NULL
;
header
=
build_response_header
(
req
,
TRUE
);
header_len
=
(
header
?
strlenW
(
header
)
:
0
);
header_len
=
(
header
?
l
strlenW
(
header
)
:
0
);
res
=
CommitUrlCacheEntryW
(
req
->
req_file
->
url
,
req
->
req_file
->
file_name
,
req
->
expires
,
req
->
last_modified
,
NORMAL_CACHE_ENTRY
,
header
,
header_len
,
NULL
,
0
);
...
...
@@ -2446,12 +2444,12 @@ static void create_cache_entry(http_request_t *req)
while
(
*
ptr
==
' '
||
*
ptr
==
'\t'
)
ptr
++
;
end
=
strchrW
(
ptr
,
','
);
end
=
wcschr
(
ptr
,
','
);
if
(
!
end
)
end
=
ptr
+
strlenW
(
ptr
);
end
=
ptr
+
l
strlenW
(
ptr
);
if
(
!
strncmpiW
(
ptr
,
no_cacheW
,
ARRAY_SIZE
(
no_cacheW
)
-
1
)
||
!
strncmpiW
(
ptr
,
no_storeW
,
ARRAY_SIZE
(
no_storeW
)
-
1
))
{
if
(
!
wcsnicmp
(
ptr
,
no_cacheW
,
ARRAY_SIZE
(
no_cacheW
)
-
1
)
||
!
wcsnicmp
(
ptr
,
no_storeW
,
ARRAY_SIZE
(
no_storeW
)
-
1
))
{
b
=
FALSE
;
break
;
}
...
...
@@ -2914,7 +2912,7 @@ static DWORD set_content_length(http_request_t *request)
WCHAR
encoding
[
20
];
DWORD
size
;
if
(
request
->
status_code
==
HTTP_STATUS_NO_CONTENT
||
!
strcmpW
(
request
->
verb
,
headW
))
{
if
(
request
->
status_code
==
HTTP_STATUS_NO_CONTENT
||
!
wcscmp
(
request
->
verb
,
headW
))
{
request
->
contentLength
=
request
->
netconn_stream
.
content_length
=
0
;
return
ERROR_SUCCESS
;
}
...
...
@@ -2931,7 +2929,7 @@ static DWORD set_content_length(http_request_t *request)
size
=
sizeof
(
encoding
);
if
(
HTTP_HttpQueryInfoW
(
request
,
HTTP_QUERY_TRANSFER_ENCODING
,
encoding
,
&
size
,
NULL
)
==
ERROR_SUCCESS
&&
!
strcmpiW
(
encoding
,
szChunked
))
!
wcsicmp
(
encoding
,
szChunked
))
{
chunked_stream_t
*
chunked_stream
;
...
...
@@ -2964,12 +2962,12 @@ static DWORD set_content_length(http_request_t *request)
encoding_idx
=
HTTP_GetCustomHeaderIndex
(
request
,
szContent_Encoding
,
0
,
FALSE
);
if
(
encoding_idx
!=
-
1
)
{
if
(
!
strcmpiW
(
request
->
custHeaders
[
encoding_idx
].
lpszValue
,
gzipW
))
{
if
(
!
wcsicmp
(
request
->
custHeaders
[
encoding_idx
].
lpszValue
,
gzipW
))
{
HTTP_DeleteCustomHeader
(
request
,
encoding_idx
);
LeaveCriticalSection
(
&
request
->
headers_section
);
return
init_gzip_stream
(
request
,
TRUE
);
}
if
(
!
strcmpiW
(
request
->
custHeaders
[
encoding_idx
].
lpszValue
,
deflateW
))
{
if
(
!
wcsicmp
(
request
->
custHeaders
[
encoding_idx
].
lpszValue
,
deflateW
))
{
HTTP_DeleteCustomHeader
(
request
,
encoding_idx
);
LeaveCriticalSection
(
&
request
->
headers_section
);
return
init_gzip_stream
(
request
,
FALSE
);
...
...
@@ -3068,7 +3066,7 @@ static DWORD drain_content(http_request_t *req, BOOL blocking)
if
(
!
is_valid_netconn
(
req
->
netconn
))
return
ERROR_NO_DATA
;
if
(
!
strcmpW
(
req
->
verb
,
szHEAD
))
if
(
!
wcscmp
(
req
->
verb
,
szHEAD
))
return
ERROR_SUCCESS
;
EnterCriticalSection
(
&
req
->
read_section
);
...
...
@@ -3382,14 +3380,14 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session,
len
=
1
;
rc
=
UrlCanonicalizeW
(
lpszObjectName
,
&
dummy
,
&
len
,
URL_ESCAPE_SPACES_ONLY
);
if
(
rc
!=
E_POINTER
)
len
=
strlenW
(
lpszObjectName
)
+
1
;
len
=
l
strlenW
(
lpszObjectName
)
+
1
;
request
->
path
=
heap_alloc
(
len
*
sizeof
(
WCHAR
));
rc
=
UrlCanonicalizeW
(
lpszObjectName
,
request
->
path
,
&
len
,
URL_ESCAPE_SPACES_ONLY
);
if
(
rc
!=
S_OK
)
{
ERR
(
"Unable to escape string!(%s) (%d)
\n
"
,
debugstr_w
(
lpszObjectName
),
rc
);
strcpyW
(
request
->
path
,
lpszObjectName
);
l
strcpyW
(
request
->
path
,
lpszObjectName
);
}
}
else
{
static
const
WCHAR
slashW
[]
=
{
'/'
,
0
};
...
...
@@ -3600,7 +3598,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
return
ERROR_OUTOFMEMORY
;
}
len
=
strlenW
(
headers
)
*
sizeof
(
WCHAR
);
len
=
l
strlenW
(
headers
)
*
sizeof
(
WCHAR
);
if
(
len
+
sizeof
(
WCHAR
)
>
*
lpdwBufferLength
)
{
len
+=
sizeof
(
WCHAR
);
...
...
@@ -3634,7 +3632,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
return
ERROR_OUTOFMEMORY
;
}
len
=
strlenW
(
headers
)
*
sizeof
(
WCHAR
);
len
=
l
strlenW
(
headers
)
*
sizeof
(
WCHAR
);
if
(
len
>
*
lpdwBufferLength
)
{
*
lpdwBufferLength
=
len
;
...
...
@@ -3665,7 +3663,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
case
HTTP_QUERY_STATUS_TEXT
:
if
(
request
->
statusText
)
{
DWORD
len
=
strlenW
(
request
->
statusText
);
DWORD
len
=
l
strlenW
(
request
->
statusText
);
if
(
len
+
1
>
*
lpdwBufferLength
/
sizeof
(
WCHAR
))
{
*
lpdwBufferLength
=
(
len
+
1
)
*
sizeof
(
WCHAR
);
...
...
@@ -3685,7 +3683,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
case
HTTP_QUERY_VERSION
:
if
(
request
->
version
)
{
DWORD
len
=
strlenW
(
request
->
version
);
DWORD
len
=
l
strlenW
(
request
->
version
);
if
(
len
+
1
>
*
lpdwBufferLength
/
sizeof
(
WCHAR
))
{
*
lpdwBufferLength
=
(
len
+
1
)
*
sizeof
(
WCHAR
);
...
...
@@ -3729,7 +3727,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
DWORD
size
;
static
const
WCHAR
formatW
[]
=
{
'%'
,
'u'
,
0
};
size
=
s
printfW
(
buf
,
formatW
,
request
->
status_code
)
*
sizeof
(
WCHAR
);
size
=
s
wprintf
(
buf
,
ARRAY_SIZE
(
buf
)
,
formatW
,
request
->
status_code
)
*
sizeof
(
WCHAR
);
if
(
size
<=
*
lpdwBufferLength
)
{
memcpy
(
lpBuffer
,
buf
,
size
+
sizeof
(
WCHAR
));
...
...
@@ -3775,7 +3773,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
}
errno
=
0
;
value
=
strtoulW
(
lphttpHdr
->
lpszValue
,
NULL
,
10
);
value
=
wcstoul
(
lphttpHdr
->
lpszValue
,
NULL
,
10
);
if
(
value
>
UINT_MAX
||
(
value
==
ULONG_MAX
&&
errno
==
ERANGE
))
{
LeaveCriticalSection
(
&
request
->
headers_section
);
...
...
@@ -3810,7 +3808,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
}
else
if
(
lphttpHdr
->
lpszValue
)
{
DWORD
len
=
(
strlenW
(
lphttpHdr
->
lpszValue
)
+
1
)
*
sizeof
(
WCHAR
);
DWORD
len
=
(
l
strlenW
(
lphttpHdr
->
lpszValue
)
+
1
)
*
sizeof
(
WCHAR
);
if
(
len
>
*
lpdwBufferLength
)
{
...
...
@@ -4118,7 +4116,7 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, WCHAR *url)
{
URL_COMPONENTSW
urlComponents
=
{
sizeof
(
urlComponents
)
};
http_session_t
*
session
=
request
->
session
;
size_t
url_len
=
strlenW
(
url
);
size_t
url_len
=
l
strlenW
(
url
);
if
(
url
[
0
]
==
'/'
)
{
...
...
@@ -4177,7 +4175,7 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, WCHAR *url)
host
=
substr
(
urlComponents
.
lpszHostName
,
urlComponents
.
dwHostNameLength
);
if
(
host
.
len
!=
strlenW
(
request
->
server
->
name
)
||
strncmpiW
(
request
->
server
->
name
,
host
.
str
,
host
.
len
)
if
(
host
.
len
!=
lstrlenW
(
request
->
server
->
name
)
||
wcsnicmp
(
request
->
server
->
name
,
host
.
str
,
host
.
len
)
||
request
->
server
->
port
!=
urlComponents
.
nPort
)
{
server_t
*
new_server
;
...
...
@@ -4211,7 +4209,7 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, WCHAR *url)
if
(
rc
!=
S_OK
)
{
ERR
(
"Unable to escape string!(%s) (%d)
\n
"
,
debugstr_w
(
path
),
rc
);
strcpyW
(
request
->
path
,
path
);
l
strcpyW
(
request
->
path
,
path
);
}
heap_free
(
path
);
}
...
...
@@ -4234,14 +4232,14 @@ static LPWSTR HTTP_build_req( LPCWSTR *list, int len )
LPWSTR
str
;
for
(
t
=
list
;
*
t
;
t
++
)
len
+=
strlenW
(
*
t
);
len
+=
l
strlenW
(
*
t
);
len
++
;
str
=
heap_alloc
(
len
*
sizeof
(
WCHAR
));
*
str
=
0
;
for
(
t
=
list
;
*
t
;
t
++
)
strcatW
(
str
,
*
t
);
l
strcatW
(
str
,
*
t
);
return
str
;
}
...
...
@@ -4255,7 +4253,7 @@ static void HTTP_InsertCookies(http_request_t *request)
if
(
res
!=
ERROR_SUCCESS
||
!
cookies
)
return
;
HTTP_HttpAddRequestHeadersW
(
request
,
cookies
,
strlenW
(
cookies
),
HTTP_HttpAddRequestHeadersW
(
request
,
cookies
,
l
strlenW
(
cookies
),
HTTP_ADDREQ_FLAG_REPLACE
|
HTTP_ADDREQ_FLAG_ADD
);
heap_free
(
cookies
);
}
...
...
@@ -4271,7 +4269,7 @@ static WORD HTTP_ParseWkday(LPCWSTR day)
{
's'
,
'a'
,
't'
,
0
}};
unsigned
int
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
days
);
i
++
)
if
(
!
strcmpiW
(
day
,
days
[
i
]))
if
(
!
wcsicmp
(
day
,
days
[
i
]))
return
i
;
/* Invalid */
...
...
@@ -4293,18 +4291,18 @@ static WORD HTTP_ParseMonth(LPCWSTR month)
static
const
WCHAR
nov
[]
=
{
'n'
,
'o'
,
'v'
,
0
};
static
const
WCHAR
dec
[]
=
{
'd'
,
'e'
,
'c'
,
0
};
if
(
!
strcmpiW
(
month
,
jan
))
return
1
;
if
(
!
strcmpiW
(
month
,
feb
))
return
2
;
if
(
!
strcmpiW
(
month
,
mar
))
return
3
;
if
(
!
strcmpiW
(
month
,
apr
))
return
4
;
if
(
!
strcmpiW
(
month
,
may
))
return
5
;
if
(
!
strcmpiW
(
month
,
jun
))
return
6
;
if
(
!
strcmpiW
(
month
,
jul
))
return
7
;
if
(
!
strcmpiW
(
month
,
aug
))
return
8
;
if
(
!
strcmpiW
(
month
,
sep
))
return
9
;
if
(
!
strcmpiW
(
month
,
oct
))
return
10
;
if
(
!
strcmpiW
(
month
,
nov
))
return
11
;
if
(
!
strcmpiW
(
month
,
dec
))
return
12
;
if
(
!
wcsicmp
(
month
,
jan
))
return
1
;
if
(
!
wcsicmp
(
month
,
feb
))
return
2
;
if
(
!
wcsicmp
(
month
,
mar
))
return
3
;
if
(
!
wcsicmp
(
month
,
apr
))
return
4
;
if
(
!
wcsicmp
(
month
,
may
))
return
5
;
if
(
!
wcsicmp
(
month
,
jun
))
return
6
;
if
(
!
wcsicmp
(
month
,
jul
))
return
7
;
if
(
!
wcsicmp
(
month
,
aug
))
return
8
;
if
(
!
wcsicmp
(
month
,
sep
))
return
9
;
if
(
!
wcsicmp
(
month
,
oct
))
return
10
;
if
(
!
wcsicmp
(
month
,
nov
))
return
11
;
if
(
!
wcsicmp
(
month
,
dec
))
return
12
;
/* Invalid */
return
0
;
}
...
...
@@ -4320,10 +4318,10 @@ static BOOL HTTP_ParseTime(SYSTEMTIME *st, LPCWSTR *str)
WCHAR
*
nextPtr
;
unsigned
long
num
;
while
(
is
spaceW
(
*
ptr
))
while
(
is
wspace
(
*
ptr
))
ptr
++
;
num
=
strtoulW
(
ptr
,
&
nextPtr
,
10
);
num
=
wcstoul
(
ptr
,
&
nextPtr
,
10
);
if
(
!
nextPtr
||
nextPtr
<=
ptr
||
*
nextPtr
!=
':'
)
{
ERR
(
"unexpected time format %s
\n
"
,
debugstr_w
(
ptr
));
...
...
@@ -4336,7 +4334,7 @@ static BOOL HTTP_ParseTime(SYSTEMTIME *st, LPCWSTR *str)
}
ptr
=
nextPtr
+
1
;
st
->
wHour
=
(
WORD
)
num
;
num
=
strtoulW
(
ptr
,
&
nextPtr
,
10
);
num
=
wcstoul
(
ptr
,
&
nextPtr
,
10
);
if
(
!
nextPtr
||
nextPtr
<=
ptr
||
*
nextPtr
!=
':'
)
{
ERR
(
"unexpected time format %s
\n
"
,
debugstr_w
(
ptr
));
...
...
@@ -4349,7 +4347,7 @@ static BOOL HTTP_ParseTime(SYSTEMTIME *st, LPCWSTR *str)
}
ptr
=
nextPtr
+
1
;
st
->
wMinute
=
(
WORD
)
num
;
num
=
strtoulW
(
ptr
,
&
nextPtr
,
10
);
num
=
wcstoul
(
ptr
,
&
nextPtr
,
10
);
if
(
!
nextPtr
||
nextPtr
<=
ptr
)
{
ERR
(
"unexpected time format %s
\n
"
,
debugstr_w
(
ptr
));
...
...
@@ -4373,7 +4371,7 @@ static BOOL HTTP_ParseDateAsAsctime(LPCWSTR value, FILETIME *ft)
SYSTEMTIME
st
=
{
0
};
unsigned
long
num
;
for
(
ptr
=
value
,
dayPtr
=
day
;
*
ptr
&&
!
is
spaceW
(
*
ptr
)
&&
for
(
ptr
=
value
,
dayPtr
=
day
;
*
ptr
&&
!
is
wspace
(
*
ptr
)
&&
dayPtr
-
day
<
ARRAY_SIZE
(
day
)
-
1
;
ptr
++
,
dayPtr
++
)
*
dayPtr
=
*
ptr
;
*
dayPtr
=
0
;
...
...
@@ -4384,10 +4382,10 @@ static BOOL HTTP_ParseDateAsAsctime(LPCWSTR value, FILETIME *ft)
return
FALSE
;
}
while
(
is
spaceW
(
*
ptr
))
while
(
is
wspace
(
*
ptr
))
ptr
++
;
for
(
monthPtr
=
month
;
!
is
spaceW
(
*
ptr
)
&&
monthPtr
-
month
<
ARRAY_SIZE
(
month
)
-
1
;
for
(
monthPtr
=
month
;
!
is
wspace
(
*
ptr
)
&&
monthPtr
-
month
<
ARRAY_SIZE
(
month
)
-
1
;
monthPtr
++
,
ptr
++
)
*
monthPtr
=
*
ptr
;
*
monthPtr
=
0
;
...
...
@@ -4398,10 +4396,10 @@ static BOOL HTTP_ParseDateAsAsctime(LPCWSTR value, FILETIME *ft)
return
FALSE
;
}
while
(
is
spaceW
(
*
ptr
))
while
(
is
wspace
(
*
ptr
))
ptr
++
;
num
=
strtoulW
(
ptr
,
&
nextPtr
,
10
);
num
=
wcstoul
(
ptr
,
&
nextPtr
,
10
);
if
(
!
nextPtr
||
nextPtr
<=
ptr
||
!
num
||
num
>
31
)
{
ERR
(
"unexpected day %s
\n
"
,
debugstr_w
(
ptr
));
...
...
@@ -4410,16 +4408,16 @@ static BOOL HTTP_ParseDateAsAsctime(LPCWSTR value, FILETIME *ft)
ptr
=
nextPtr
;
st
.
wDay
=
(
WORD
)
num
;
while
(
is
spaceW
(
*
ptr
))
while
(
is
wspace
(
*
ptr
))
ptr
++
;
if
(
!
HTTP_ParseTime
(
&
st
,
&
ptr
))
return
FALSE
;
while
(
is
spaceW
(
*
ptr
))
while
(
is
wspace
(
*
ptr
))
ptr
++
;
num
=
strtoulW
(
ptr
,
&
nextPtr
,
10
);
num
=
wcstoul
(
ptr
,
&
nextPtr
,
10
);
if
(
!
nextPtr
||
nextPtr
<=
ptr
||
num
<
1601
||
num
>
30827
)
{
ERR
(
"unexpected year %s
\n
"
,
debugstr_w
(
ptr
));
...
...
@@ -4428,13 +4426,13 @@ static BOOL HTTP_ParseDateAsAsctime(LPCWSTR value, FILETIME *ft)
ptr
=
nextPtr
;
st
.
wYear
=
(
WORD
)
num
;
while
(
is
spaceW
(
*
ptr
))
while
(
is
wspace
(
*
ptr
))
ptr
++
;
/* asctime() doesn't report a timezone, but some web servers do, so accept
* with or without GMT.
*/
if
(
*
ptr
&&
strcmpW
(
ptr
,
gmt
))
if
(
*
ptr
&&
wcscmp
(
ptr
,
gmt
))
{
ERR
(
"unexpected timezone %s
\n
"
,
debugstr_w
(
ptr
));
return
FALSE
;
...
...
@@ -4450,7 +4448,7 @@ static BOOL HTTP_ParseRfc1123Date(LPCWSTR value, FILETIME *ft)
unsigned
long
num
;
SYSTEMTIME
st
=
{
0
};
ptr
=
strchrW
(
value
,
','
);
ptr
=
wcschr
(
value
,
','
);
if
(
!
ptr
)
return
FALSE
;
if
(
ptr
-
value
!=
3
)
...
...
@@ -4468,10 +4466,10 @@ static BOOL HTTP_ParseRfc1123Date(LPCWSTR value, FILETIME *ft)
}
ptr
++
;
while
(
is
spaceW
(
*
ptr
))
while
(
is
wspace
(
*
ptr
))
ptr
++
;
num
=
strtoulW
(
ptr
,
&
nextPtr
,
10
);
num
=
wcstoul
(
ptr
,
&
nextPtr
,
10
);
if
(
!
nextPtr
||
nextPtr
<=
ptr
||
!
num
||
num
>
31
)
{
WARN
(
"unexpected day %s
\n
"
,
debugstr_w
(
value
));
...
...
@@ -4480,10 +4478,10 @@ static BOOL HTTP_ParseRfc1123Date(LPCWSTR value, FILETIME *ft)
ptr
=
nextPtr
;
st
.
wDay
=
(
WORD
)
num
;
while
(
is
spaceW
(
*
ptr
))
while
(
is
wspace
(
*
ptr
))
ptr
++
;
for
(
monthPtr
=
month
;
!
is
spaceW
(
*
ptr
)
&&
monthPtr
-
month
<
ARRAY_SIZE
(
month
)
-
1
;
for
(
monthPtr
=
month
;
!
is
wspace
(
*
ptr
)
&&
monthPtr
-
month
<
ARRAY_SIZE
(
month
)
-
1
;
monthPtr
++
,
ptr
++
)
*
monthPtr
=
*
ptr
;
*
monthPtr
=
0
;
...
...
@@ -4494,10 +4492,10 @@ static BOOL HTTP_ParseRfc1123Date(LPCWSTR value, FILETIME *ft)
return
FALSE
;
}
while
(
is
spaceW
(
*
ptr
))
while
(
is
wspace
(
*
ptr
))
ptr
++
;
num
=
strtoulW
(
ptr
,
&
nextPtr
,
10
);
num
=
wcstoul
(
ptr
,
&
nextPtr
,
10
);
if
(
!
nextPtr
||
nextPtr
<=
ptr
||
num
<
1601
||
num
>
30827
)
{
ERR
(
"unexpected year %s
\n
"
,
debugstr_w
(
value
));
...
...
@@ -4509,10 +4507,10 @@ static BOOL HTTP_ParseRfc1123Date(LPCWSTR value, FILETIME *ft)
if
(
!
HTTP_ParseTime
(
&
st
,
&
ptr
))
return
FALSE
;
while
(
is
spaceW
(
*
ptr
))
while
(
is
wspace
(
*
ptr
))
ptr
++
;
if
(
strcmpW
(
ptr
,
gmt
))
if
(
wcscmp
(
ptr
,
gmt
))
{
ERR
(
"unexpected time zone %s
\n
"
,
debugstr_w
(
ptr
));
return
FALSE
;
...
...
@@ -4531,7 +4529,7 @@ static WORD HTTP_ParseWeekday(LPCWSTR day)
{
's'
,
'a'
,
't'
,
'u'
,
'r'
,
'd'
,
'a'
,
'y'
,
0
}};
unsigned
int
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
days
);
i
++
)
if
(
!
strcmpiW
(
day
,
days
[
i
]))
if
(
!
wcsicmp
(
day
,
days
[
i
]))
return
i
;
/* Invalid */
...
...
@@ -4546,7 +4544,7 @@ static BOOL HTTP_ParseRfc850Date(LPCWSTR value, FILETIME *ft)
unsigned
long
num
;
SYSTEMTIME
st
=
{
0
};
ptr
=
strchrW
(
value
,
','
);
ptr
=
wcschr
(
value
,
','
);
if
(
!
ptr
)
return
FALSE
;
if
(
ptr
-
value
==
3
)
...
...
@@ -4578,10 +4576,10 @@ static BOOL HTTP_ParseRfc850Date(LPCWSTR value, FILETIME *ft)
}
ptr
++
;
while
(
is
spaceW
(
*
ptr
))
while
(
is
wspace
(
*
ptr
))
ptr
++
;
num
=
strtoulW
(
ptr
,
&
nextPtr
,
10
);
num
=
wcstoul
(
ptr
,
&
nextPtr
,
10
);
if
(
!
nextPtr
||
nextPtr
<=
ptr
||
!
num
||
num
>
31
)
{
ERR
(
"unexpected day %s
\n
"
,
debugstr_w
(
value
));
...
...
@@ -4615,7 +4613,7 @@ static BOOL HTTP_ParseRfc850Date(LPCWSTR value, FILETIME *ft)
}
ptr
++
;
num
=
strtoulW
(
ptr
,
&
nextPtr
,
10
);
num
=
wcstoul
(
ptr
,
&
nextPtr
,
10
);
if
(
!
nextPtr
||
nextPtr
<=
ptr
||
num
<
1601
||
num
>
30827
)
{
ERR
(
"unexpected year %s
\n
"
,
debugstr_w
(
value
));
...
...
@@ -4627,10 +4625,10 @@ static BOOL HTTP_ParseRfc850Date(LPCWSTR value, FILETIME *ft)
if
(
!
HTTP_ParseTime
(
&
st
,
&
ptr
))
return
FALSE
;
while
(
is
spaceW
(
*
ptr
))
while
(
is
wspace
(
*
ptr
))
ptr
++
;
if
(
strcmpW
(
ptr
,
gmt
))
if
(
wcscmp
(
ptr
,
gmt
))
{
ERR
(
"unexpected time zone %s
\n
"
,
debugstr_w
(
ptr
));
return
FALSE
;
...
...
@@ -4643,12 +4641,12 @@ static BOOL HTTP_ParseDate(LPCWSTR value, FILETIME *ft)
static
const
WCHAR
zero
[]
=
{
'0'
,
0
};
BOOL
ret
;
if
(
!
strcmpW
(
value
,
zero
))
if
(
!
wcscmp
(
value
,
zero
))
{
ft
->
dwLowDateTime
=
ft
->
dwHighDateTime
=
0
;
ret
=
TRUE
;
}
else
if
(
strchrW
(
value
,
','
))
else
if
(
wcschr
(
value
,
','
))
{
ret
=
HTTP_ParseRfc1123Date
(
value
,
ft
);
if
(
!
ret
)
...
...
@@ -4685,12 +4683,12 @@ static void HTTP_ProcessExpires(http_request_t *request)
for
(
ptr
=
ccHeader
->
lpszValue
;
ptr
&&
*
ptr
;
)
{
LPWSTR
comma
=
strchrW
(
ptr
,
','
),
end
,
equal
;
LPWSTR
comma
=
wcschr
(
ptr
,
','
),
end
,
equal
;
if
(
comma
)
end
=
comma
;
else
end
=
ptr
+
strlenW
(
ptr
);
end
=
ptr
+
l
strlenW
(
ptr
);
for
(
equal
=
end
-
1
;
equal
>
ptr
&&
*
equal
!=
'='
;
equal
--
)
;
if
(
*
equal
==
'='
)
...
...
@@ -4698,12 +4696,12 @@ static void HTTP_ProcessExpires(http_request_t *request)
static
const
WCHAR
max_age
[]
=
{
'm'
,
'a'
,
'x'
,
'-'
,
'a'
,
'g'
,
'e'
,
0
};
if
(
!
strncmpiW
(
ptr
,
max_age
,
equal
-
ptr
-
1
))
if
(
!
wcsnicmp
(
ptr
,
max_age
,
equal
-
ptr
-
1
))
{
LPWSTR
nextPtr
;
unsigned
long
age
;
age
=
strtoulW
(
equal
+
1
,
&
nextPtr
,
10
);
age
=
wcstoul
(
equal
+
1
,
&
nextPtr
,
10
);
if
(
nextPtr
>
equal
+
1
)
{
LARGE_INTEGER
ft
;
...
...
@@ -4722,7 +4720,7 @@ static void HTTP_ProcessExpires(http_request_t *request)
if
(
comma
)
{
ptr
=
comma
+
1
;
while
(
is
spaceW
(
*
ptr
))
while
(
is
wspace
(
*
ptr
))
ptr
++
;
}
else
...
...
@@ -4784,11 +4782,11 @@ static void http_process_keep_alive(http_request_t *req)
EnterCriticalSection
(
&
req
->
headers_section
);
if
((
index
=
HTTP_GetCustomHeaderIndex
(
req
,
szConnection
,
0
,
FALSE
))
!=
-
1
)
req
->
netconn
->
keep_alive
=
!
strcmpiW
(
req
->
custHeaders
[
index
].
lpszValue
,
szKeepAlive
);
req
->
netconn
->
keep_alive
=
!
wcsicmp
(
req
->
custHeaders
[
index
].
lpszValue
,
szKeepAlive
);
else
if
((
index
=
HTTP_GetCustomHeaderIndex
(
req
,
szProxy_Connection
,
0
,
FALSE
))
!=
-
1
)
req
->
netconn
->
keep_alive
=
!
strcmpiW
(
req
->
custHeaders
[
index
].
lpszValue
,
szKeepAlive
);
req
->
netconn
->
keep_alive
=
!
wcsicmp
(
req
->
custHeaders
[
index
].
lpszValue
,
szKeepAlive
);
else
req
->
netconn
->
keep_alive
=
!
strcmpiW
(
req
->
version
,
g_szHttp1_1
);
req
->
netconn
->
keep_alive
=
!
wcsicmp
(
req
->
version
,
g_szHttp1_1
);
LeaveCriticalSection
(
&
req
->
headers_section
);
}
...
...
@@ -4887,7 +4885,7 @@ static void set_content_length_header( http_request_t *request, DWORD len, DWORD
{
'C'
,
'o'
,
'n'
,
't'
,
'e'
,
'n'
,
't'
,
'-'
,
'L'
,
'e'
,
'n'
,
'g'
,
't'
,
'h'
,
':'
,
' '
,
'%'
,
'u'
,
'\r'
,
'\n'
,
0
};
WCHAR
buf
[
ARRAY_SIZE
(
fmtW
)
+
10
];
s
printfW
(
buf
,
fmtW
,
len
);
s
wprintf
(
buf
,
ARRAY_SIZE
(
buf
)
,
fmtW
,
len
);
HTTP_HttpAddRequestHeadersW
(
request
,
buf
,
~
0u
,
flags
);
}
...
...
@@ -4921,7 +4919,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
HTTP_ProcessHeader
(
request
,
hostW
,
request
->
server
->
canon_host_port
,
HTTP_ADDREQ_FLAG_ADD_IF_NEW
|
HTTP_ADDHDR_FLAG_REQ
);
if
(
dwContentLength
||
strcmpW
(
request
->
verb
,
szGET
))
if
(
dwContentLength
||
wcscmp
(
request
->
verb
,
szGET
))
{
set_content_length_header
(
request
,
dwContentLength
,
HTTP_ADDREQ_FLAG_ADD_IF_NEW
);
request
->
bytesToWrite
=
dwContentLength
;
...
...
@@ -4932,23 +4930,23 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
static
const
WCHAR
user_agent
[]
=
{
'U'
,
's'
,
'e'
,
'r'
,
'-'
,
'A'
,
'g'
,
'e'
,
'n'
,
't'
,
':'
,
' '
,
'%'
,
's'
,
'\r'
,
'\n'
,
0
};
int
len
;
len
=
strlenW
(
request
->
session
->
appInfo
->
agent
)
+
strlenW
(
user_agent
);
len
=
lstrlenW
(
request
->
session
->
appInfo
->
agent
)
+
l
strlenW
(
user_agent
);
agent_header
=
heap_alloc
(
len
*
sizeof
(
WCHAR
));
s
printfW
(
agent_header
,
user_agent
,
request
->
session
->
appInfo
->
agent
);
s
wprintf
(
agent_header
,
len
,
user_agent
,
request
->
session
->
appInfo
->
agent
);
HTTP_HttpAddRequestHeadersW
(
request
,
agent_header
,
strlenW
(
agent_header
),
HTTP_ADDREQ_FLAG_ADD_IF_NEW
);
HTTP_HttpAddRequestHeadersW
(
request
,
agent_header
,
l
strlenW
(
agent_header
),
HTTP_ADDREQ_FLAG_ADD_IF_NEW
);
heap_free
(
agent_header
);
}
if
(
request
->
hdr
.
dwFlags
&
INTERNET_FLAG_PRAGMA_NOCACHE
)
{
static
const
WCHAR
pragma_nocache
[]
=
{
'P'
,
'r'
,
'a'
,
'g'
,
'm'
,
'a'
,
':'
,
' '
,
'n'
,
'o'
,
'-'
,
'c'
,
'a'
,
'c'
,
'h'
,
'e'
,
'\r'
,
'\n'
,
0
};
HTTP_HttpAddRequestHeadersW
(
request
,
pragma_nocache
,
strlenW
(
pragma_nocache
),
HTTP_ADDREQ_FLAG_ADD_IF_NEW
);
HTTP_HttpAddRequestHeadersW
(
request
,
pragma_nocache
,
l
strlenW
(
pragma_nocache
),
HTTP_ADDREQ_FLAG_ADD_IF_NEW
);
}
if
((
request
->
hdr
.
dwFlags
&
INTERNET_FLAG_NO_CACHE_WRITE
)
&&
strcmpW
(
request
->
verb
,
szGET
))
if
((
request
->
hdr
.
dwFlags
&
INTERNET_FLAG_NO_CACHE_WRITE
)
&&
wcscmp
(
request
->
verb
,
szGET
))
{
static
const
WCHAR
cache_control
[]
=
{
'C'
,
'a'
,
'c'
,
'h'
,
'e'
,
'-'
,
'C'
,
'o'
,
'n'
,
't'
,
'r'
,
'o'
,
'l'
,
':'
,
' '
,
'n'
,
'o'
,
'-'
,
'c'
,
'a'
,
'c'
,
'h'
,
'e'
,
'\r'
,
'\n'
,
0
};
HTTP_HttpAddRequestHeadersW
(
request
,
cache_control
,
strlenW
(
cache_control
),
HTTP_ADDREQ_FLAG_ADD_IF_NEW
);
HTTP_HttpAddRequestHeadersW
(
request
,
cache_control
,
l
strlenW
(
cache_control
),
HTTP_ADDREQ_FLAG_ADD_IF_NEW
);
}
/* add the headers the caller supplied */
...
...
@@ -5113,7 +5111,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
if
(
!
new_url
)
break
;
if
(
strcmpW
(
request
->
verb
,
szGET
)
&&
strcmpW
(
request
->
verb
,
szHEAD
)
&&
if
(
wcscmp
(
request
->
verb
,
szGET
)
&&
wcscmp
(
request
->
verb
,
szHEAD
)
&&
request
->
status_code
!=
HTTP_STATUS_REDIRECT_KEEP_VERB
)
{
heap_free
(
request
->
verb
);
...
...
@@ -5307,7 +5305,7 @@ static DWORD HTTP_HttpEndRequestW(http_request_t *request, DWORD dwFlags, DWORD_
if
(
!
new_url
)
break
;
if
(
strcmpW
(
request
->
verb
,
szGET
)
&&
strcmpW
(
request
->
verb
,
szHEAD
)
&&
if
(
wcscmp
(
request
->
verb
,
szGET
)
&&
wcscmp
(
request
->
verb
,
szHEAD
)
&&
request
->
status_code
!=
HTTP_STATUS_REDIRECT_KEEP_VERB
)
{
heap_free
(
request
->
verb
);
...
...
@@ -5532,7 +5530,7 @@ BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest,
if
(
lpBuffersIn
->
lpcszHeader
)
{
if
(
lpBuffersIn
->
dwHeadersLength
==
~
0u
)
size
=
(
strlenW
(
lpBuffersIn
->
lpcszHeader
)
+
1
)
*
sizeof
(
WCHAR
);
size
=
(
l
strlenW
(
lpBuffersIn
->
lpcszHeader
)
+
1
)
*
sizeof
(
WCHAR
);
else
size
=
lpBuffersIn
->
dwHeadersLength
*
sizeof
(
WCHAR
);
...
...
@@ -5630,7 +5628,7 @@ BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders,
{
DWORD
size
;
if
(
dwHeaderLength
==
~
0u
)
size
=
(
strlenW
(
lpszHeaders
)
+
1
)
*
sizeof
(
WCHAR
);
if
(
dwHeaderLength
==
~
0u
)
size
=
(
l
strlenW
(
lpszHeaders
)
+
1
)
*
sizeof
(
WCHAR
);
else
size
=
dwHeaderLength
*
sizeof
(
WCHAR
);
task
->
headers
=
heap_alloc
(
size
);
...
...
@@ -5959,20 +5957,20 @@ static DWORD HTTP_GetResponseHeaders(http_request_t *request, INT *len)
rc
+=
buflen
;
MultiByteToWideChar
(
CP_ACP
,
0
,
bufferA
,
buflen
,
buffer
,
MAX_REPLY_LEN
);
/* check is this a status code line? */
if
(
!
strncmpW
(
buffer
,
g_szHttp1_0
,
4
))
if
(
!
wcsncmp
(
buffer
,
g_szHttp1_0
,
4
))
{
/* split the version from the status code */
status_code
=
strchrW
(
buffer
,
' '
);
status_code
=
wcschr
(
buffer
,
' '
);
if
(
!
status_code
)
goto
lend
;
*
status_code
++=
0
;
/* split the status code from the status text */
status_text
=
strchrW
(
status_code
,
' '
);
status_text
=
wcschr
(
status_code
,
' '
);
if
(
status_text
)
*
status_text
++=
0
;
request
->
status_code
=
atoiW
(
status_code
);
request
->
status_code
=
wcstol
(
status_code
,
NULL
,
10
);
TRACE
(
"version [%s] status code [%s] status text [%s]
\n
"
,
debugstr_w
(
buffer
),
debugstr_w
(
status_code
),
debugstr_w
(
status_text
)
);
...
...
@@ -6065,7 +6063,7 @@ static LPWSTR * HTTP_InterpretHttpHeader(LPCWSTR buffer)
pTokenPair
=
heap_alloc_zero
(
sizeof
(
*
pTokenPair
)
*
3
);
pszColon
=
strchrW
(
buffer
,
':'
);
pszColon
=
wcschr
(
buffer
,
':'
);
/* must have two tokens */
if
(
!
pszColon
)
{
...
...
@@ -6086,7 +6084,7 @@ static LPWSTR * HTTP_InterpretHttpHeader(LPCWSTR buffer)
/* skip colon */
pszColon
++
;
len
=
strlenW
(
pszColon
);
len
=
l
strlenW
(
pszColon
);
pTokenPair
[
1
]
=
heap_alloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
pTokenPair
[
1
])
{
...
...
@@ -6195,8 +6193,8 @@ static DWORD HTTP_ProcessHeader(http_request_t *request, LPCWSTR field, LPCWSTR
LPWSTR
lpsztmp
;
WCHAR
ch
=
0
;
INT
len
=
0
;
INT
origlen
=
strlenW
(
lphttpHdr
->
lpszValue
);
INT
valuelen
=
strlenW
(
value
);
INT
origlen
=
l
strlenW
(
lphttpHdr
->
lpszValue
);
INT
valuelen
=
l
strlenW
(
value
);
if
(
dwModifier
&
HTTP_ADDHDR_FLAG_COALESCE_WITH_COMMA
)
{
...
...
@@ -6254,7 +6252,7 @@ static INT HTTP_GetCustomHeaderIndex(http_request_t *request, LPCWSTR lpszField,
for
(
index
=
0
;
index
<
request
->
nCustHeaders
;
index
++
)
{
if
(
strcmpiW
(
request
->
custHeaders
[
index
].
lpszField
,
lpszField
))
if
(
wcsicmp
(
request
->
custHeaders
[
index
].
lpszField
,
lpszField
))
continue
;
if
(
request_only
&&
!
(
request
->
custHeaders
[
index
].
wFlags
&
HDR_ISREQUEST
))
...
...
dlls/wininet/internet.c
View file @
3c31cc58
...
...
@@ -26,8 +26,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "winsock2.h"
#include "ws2ipdef.h"
...
...
@@ -37,6 +35,7 @@
#include <stdlib.h>
#include <ctype.h>
#include <assert.h>
#include <wchar.h>
#include "windef.h"
#include "winbase.h"
...
...
@@ -58,8 +57,6 @@
#include "internet.h"
#include "resource.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
wininet
);
typedef
struct
...
...
@@ -397,11 +394,11 @@ WCHAR *INTERNET_FindProxyForProtocol(LPCWSTR szProxy, LPCWSTR proto)
{
LPCWSTR
end
,
equal
;
if
(
!
(
end
=
strchrW
(
ptr
,
' '
)))
end
=
ptr
+
strlenW
(
ptr
);
if
((
equal
=
strchrW
(
ptr
,
'='
))
&&
equal
<
end
&&
equal
-
ptr
==
strlenW
(
proto
)
&&
!
strncmpiW
(
proto
,
ptr
,
strlenW
(
proto
)))
if
(
!
(
end
=
wcschr
(
ptr
,
' '
)))
end
=
ptr
+
l
strlenW
(
ptr
);
if
((
equal
=
wcschr
(
ptr
,
'='
))
&&
equal
<
end
&&
equal
-
ptr
==
l
strlenW
(
proto
)
&&
!
wcsnicmp
(
proto
,
ptr
,
l
strlenW
(
proto
)))
{
ret
=
heap_strndupW
(
equal
+
1
,
end
-
equal
-
1
);
TRACE
(
"found proxy for %s: %s
\n
"
,
debugstr_w
(
proto
),
debugstr_w
(
ret
));
...
...
@@ -418,9 +415,9 @@ WCHAR *INTERNET_FindProxyForProtocol(LPCWSTR szProxy, LPCWSTR proto)
{
LPCWSTR
end
;
if
(
!
(
end
=
strchrW
(
ptr
,
' '
)))
end
=
ptr
+
strlenW
(
ptr
);
if
(
!
strchrW
(
ptr
,
'='
))
if
(
!
(
end
=
wcschr
(
ptr
,
' '
)))
end
=
ptr
+
l
strlenW
(
ptr
);
if
(
!
wcschr
(
ptr
,
'='
))
{
ret
=
heap_strndupW
(
ptr
,
end
-
ptr
);
TRACE
(
"found proxy for %s: %s
\n
"
,
debugstr_w
(
proto
),
debugstr_w
(
ret
));
...
...
@@ -510,7 +507,7 @@ static BOOL parse_proxy_url( proxyinfo_t *info, const WCHAR *url )
return
TRUE
;
}
if
(
!
(
info
->
proxy
=
heap_alloc
(
(
uc
.
dwHostNameLength
+
12
)
*
sizeof
(
WCHAR
)
)))
return
FALSE
;
s
printfW
(
info
->
proxy
,
fmt
,
uc
.
dwHostNameLength
,
uc
.
lpszHostName
,
uc
.
nPort
);
s
wprintf
(
info
->
proxy
,
uc
.
dwHostNameLength
+
12
,
fmt
,
uc
.
dwHostNameLength
,
uc
.
lpszHostName
,
uc
.
nPort
);
if
(
!
uc
.
dwUserNameLength
)
info
->
proxyUsername
=
NULL
;
else
if
(
!
(
info
->
proxyUsername
=
heap_strndupW
(
uc
.
lpszUserName
,
uc
.
dwUserNameLength
)))
...
...
@@ -593,13 +590,13 @@ static LONG INTERNET_LoadProxySettings( proxyinfo_t *lpwpi )
RegQueryValueExW
(
key
,
szProxyServer
,
NULL
,
&
type
,
(
BYTE
*
)
szProxy
,
&
len
);
/* find the http proxy, and strip away everything else */
p
=
strstrW
(
szProxy
,
szHttp
);
p
=
wcsstr
(
szProxy
,
szHttp
);
if
(
p
)
{
p
+=
lstrlenW
(
szHttp
);
lstrcpyW
(
szProxy
,
p
);
}
p
=
strchrW
(
szProxy
,
';'
);
p
=
wcschr
(
szProxy
,
';'
);
if
(
p
)
*
p
=
0
;
FreeProxyInfo
(
lpwpi
);
...
...
@@ -826,14 +823,14 @@ static DWORD APPINFO_QueryOption(object_header_t *hdr, DWORD option, void *buffe
bufsize
=
*
size
;
if
(
unicode
)
{
DWORD
len
=
ai
->
agent
?
strlenW
(
ai
->
agent
)
:
0
;
DWORD
len
=
ai
->
agent
?
l
strlenW
(
ai
->
agent
)
:
0
;
*
size
=
(
len
+
1
)
*
sizeof
(
WCHAR
);
if
(
!
buffer
||
bufsize
<
*
size
)
return
ERROR_INSUFFICIENT_BUFFER
;
if
(
ai
->
agent
)
strcpyW
(
buffer
,
ai
->
agent
);
l
strcpyW
(
buffer
,
ai
->
agent
);
else
*
(
WCHAR
*
)
buffer
=
0
;
/* If the buffer is copied, the returned length doesn't include
...
...
@@ -1619,7 +1616,7 @@ static INTERNET_SCHEME GetInternetSchemeW(LPCWSTR lpszScheme, DWORD nMaxCmp)
return
INTERNET_SCHEME_UNKNOWN
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
url_schemes
);
i
++
)
if
(
!
strncmpiW
(
lpszScheme
,
url_schemes
[
i
],
nMaxCmp
))
if
(
!
wcsnicmp
(
lpszScheme
,
url_schemes
[
i
],
nMaxCmp
))
return
INTERNET_SCHEME_FIRST
+
i
;
return
INTERNET_SCHEME_UNKNOWN
;
...
...
@@ -1647,7 +1644,7 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF
LPCWSTR
lpszcp
=
NULL
,
lpszNetLoc
;
TRACE
(
"(%s %u %x %p)
\n
"
,
lpszUrl
?
debugstr_wn
(
lpszUrl
,
dwUrlLength
?
dwUrlLength
:
strlenW
(
lpszUrl
))
:
"(null)"
,
lpszUrl
?
debugstr_wn
(
lpszUrl
,
dwUrlLength
?
dwUrlLength
:
l
strlenW
(
lpszUrl
))
:
"(null)"
,
dwUrlLength
,
dwFlags
,
lpUC
);
if
(
!
lpszUrl
||
!*
lpszUrl
||
!
lpUC
)
...
...
@@ -1655,7 +1652,7 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
if
(
!
dwUrlLength
)
dwUrlLength
=
strlenW
(
lpszUrl
);
if
(
!
dwUrlLength
)
dwUrlLength
=
l
strlenW
(
lpszUrl
);
if
(
dwFlags
&
ICU_DECODE
)
{
...
...
@@ -1694,7 +1691,7 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF
/* Determine if the URI is absolute. */
while
(
lpszap
-
lpszUrl
<
dwUrlLength
)
{
if
(
is
alnumW
(
*
lpszap
)
||
*
lpszap
==
'+'
||
*
lpszap
==
'.'
||
*
lpszap
==
'-'
)
if
(
is
walnum
(
*
lpszap
)
||
*
lpszap
==
'+'
||
*
lpszap
==
'.'
||
*
lpszap
==
'-'
)
{
lpszap
++
;
continue
;
...
...
@@ -1721,9 +1718,9 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF
lpUC
->
nPort
=
INTERNET_INVALID_PORT_NUMBER
;
/* Parse <params> */
lpszParam
=
memchrW
(
lpszap
,
'?'
,
dwUrlLength
-
(
lpszap
-
lpszUrl
));
lpszParam
=
wmemchr
(
lpszap
,
'?'
,
dwUrlLength
-
(
lpszap
-
lpszUrl
));
if
(
!
lpszParam
)
lpszParam
=
memchrW
(
lpszap
,
'#'
,
dwUrlLength
-
(
lpszap
-
lpszUrl
));
lpszParam
=
wmemchr
(
lpszap
,
'#'
,
dwUrlLength
-
(
lpszap
-
lpszUrl
));
if
(
!
set_url_component
(
&
lpUC
->
lpszExtraInfo
,
&
lpUC
->
dwExtraInfoLength
,
lpszParam
,
lpszParam
?
dwUrlLength
-
(
lpszParam
-
lpszUrl
)
:
0
))
...
...
@@ -1743,7 +1740,7 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF
{
lpszcp
+=
2
;
lpszNetLoc
=
memchrW
(
lpszcp
,
'/'
,
dwUrlLength
-
(
lpszcp
-
lpszUrl
));
lpszNetLoc
=
wmemchr
(
lpszcp
,
'/'
,
dwUrlLength
-
(
lpszcp
-
lpszUrl
));
if
(
lpszParam
)
{
if
(
lpszNetLoc
)
...
...
@@ -1763,7 +1760,7 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF
/* [<user>[<:password>]@]<host>[:<port>] */
/* First find the user and password if they exist */
lpszHost
=
memchrW
(
lpszcp
,
'@'
,
dwUrlLength
-
(
lpszcp
-
lpszUrl
));
lpszHost
=
wmemchr
(
lpszcp
,
'@'
,
dwUrlLength
-
(
lpszcp
-
lpszUrl
));
if
(
lpszHost
==
NULL
||
lpszHost
>
lpszNetLoc
)
{
/* username and password not specified. */
...
...
@@ -1829,7 +1826,7 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF
if
(
!
set_url_component
(
&
lpUC
->
lpszHostName
,
&
lpUC
->
dwHostNameLength
,
lpszHost
,
lpszPort
-
lpszHost
))
return
FALSE
;
if
(
lpszPort
!=
lpszNetLoc
)
lpUC
->
nPort
=
atoiW
(
++
lpszPort
);
lpUC
->
nPort
=
wcstol
(
++
lpszPort
,
NULL
,
10
);
else
switch
(
lpUC
->
nScheme
)
{
case
INTERNET_SCHEME_HTTP
:
...
...
@@ -1877,7 +1874,7 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF
/* Leave the parameter list in lpszUrlPath. Strip off any trailing
* newlines if necessary.
*/
LPWSTR
lpsznewline
=
memchrW
(
lpszcp
,
'\n'
,
dwUrlLength
-
(
lpszcp
-
lpszUrl
));
LPWSTR
lpsznewline
=
wmemchr
(
lpszcp
,
'\n'
,
dwUrlLength
-
(
lpszcp
-
lpszUrl
));
if
(
lpsznewline
!=
NULL
)
len
=
lpsznewline
-
lpszcp
;
else
...
...
@@ -3347,7 +3344,7 @@ BOOL WINAPI InternetTimeFromSystemTimeW( const SYSTEMTIME* time, DWORD format, L
return
FALSE
;
}
s
printfW
(
string
,
date
,
s
wprintf
(
string
,
size
,
date
,
WININET_wkday
[
time
->
wDayOfWeek
],
time
->
wDay
,
WININET_month
[
time
->
wMonth
-
1
],
...
...
@@ -3398,15 +3395,13 @@ BOOL WINAPI InternetTimeToSystemTimeW( LPCWSTR string, SYSTEMTIME* time, DWORD r
* a SYSTEMTIME structure.
*/
while
(
*
s
&&
!
is
alphaW
(
*
s
))
s
++
;
while
(
*
s
&&
!
is
walpha
(
*
s
))
s
++
;
if
(
s
[
0
]
==
'\0'
||
s
[
1
]
==
'\0'
||
s
[
2
]
==
'\0'
)
return
TRUE
;
time
->
wDayOfWeek
=
7
;
for
(
i
=
0
;
i
<
7
;
i
++
)
{
if
(
toupperW
(
WININET_wkday
[
i
][
0
]
)
==
toupperW
(
s
[
0
]
)
&&
toupperW
(
WININET_wkday
[
i
][
1
]
)
==
toupperW
(
s
[
1
]
)
&&
toupperW
(
WININET_wkday
[
i
][
2
]
)
==
toupperW
(
s
[
2
]
)
)
if
(
!
wcsnicmp
(
WININET_wkday
[
i
],
s
,
3
))
{
time
->
wDayOfWeek
=
i
;
break
;
...
...
@@ -3414,19 +3409,17 @@ BOOL WINAPI InternetTimeToSystemTimeW( LPCWSTR string, SYSTEMTIME* time, DWORD r
}
if
(
time
->
wDayOfWeek
>
6
)
return
TRUE
;
while
(
*
s
&&
!
is
digitW
(
*
s
))
s
++
;
time
->
wDay
=
strtolW
(
s
,
&
end
,
10
);
while
(
*
s
&&
!
is
wdigit
(
*
s
))
s
++
;
time
->
wDay
=
wcstol
(
s
,
&
end
,
10
);
s
=
end
;
while
(
*
s
&&
!
is
alphaW
(
*
s
))
s
++
;
while
(
*
s
&&
!
is
walpha
(
*
s
))
s
++
;
if
(
s
[
0
]
==
'\0'
||
s
[
1
]
==
'\0'
||
s
[
2
]
==
'\0'
)
return
TRUE
;
time
->
wMonth
=
0
;
for
(
i
=
0
;
i
<
12
;
i
++
)
{
if
(
toupperW
(
WININET_month
[
i
][
0
])
==
toupperW
(
s
[
0
]
)
&&
toupperW
(
WININET_month
[
i
][
1
])
==
toupperW
(
s
[
1
]
)
&&
toupperW
(
WININET_month
[
i
][
2
])
==
toupperW
(
s
[
2
]
)
)
if
(
!
wcsnicmp
(
WININET_month
[
i
],
s
,
3
))
{
time
->
wMonth
=
i
+
1
;
break
;
...
...
@@ -3434,24 +3427,24 @@ BOOL WINAPI InternetTimeToSystemTimeW( LPCWSTR string, SYSTEMTIME* time, DWORD r
}
if
(
time
->
wMonth
==
0
)
return
TRUE
;
while
(
*
s
&&
!
is
digitW
(
*
s
))
s
++
;
while
(
*
s
&&
!
is
wdigit
(
*
s
))
s
++
;
if
(
*
s
==
'\0'
)
return
TRUE
;
time
->
wYear
=
strtolW
(
s
,
&
end
,
10
);
time
->
wYear
=
wcstol
(
s
,
&
end
,
10
);
s
=
end
;
while
(
*
s
&&
!
is
digitW
(
*
s
))
s
++
;
while
(
*
s
&&
!
is
wdigit
(
*
s
))
s
++
;
if
(
*
s
==
'\0'
)
return
TRUE
;
time
->
wHour
=
strtolW
(
s
,
&
end
,
10
);
time
->
wHour
=
wcstol
(
s
,
&
end
,
10
);
s
=
end
;
while
(
*
s
&&
!
is
digitW
(
*
s
))
s
++
;
while
(
*
s
&&
!
is
wdigit
(
*
s
))
s
++
;
if
(
*
s
==
'\0'
)
return
TRUE
;
time
->
wMinute
=
strtolW
(
s
,
&
end
,
10
);
time
->
wMinute
=
wcstol
(
s
,
&
end
,
10
);
s
=
end
;
while
(
*
s
&&
!
is
digitW
(
*
s
))
s
++
;
while
(
*
s
&&
!
is
wdigit
(
*
s
))
s
++
;
if
(
*
s
==
'\0'
)
return
TRUE
;
time
->
wSecond
=
strtolW
(
s
,
&
end
,
10
);
time
->
wSecond
=
wcstol
(
s
,
&
end
,
10
);
s
=
end
;
time
->
wMilliseconds
=
0
;
...
...
@@ -3626,7 +3619,7 @@ static HINTERNET INTERNET_InternetOpenUrlW(appinfo_t *hIC, LPCWSTR lpszUrl,
urlComponents
.
dwPasswordLength
=
1
;
urlComponents
.
dwUrlPathLength
=
1
;
urlComponents
.
dwExtraInfoLength
=
1
;
if
(
!
InternetCrackUrlW
(
lpszUrl
,
strlenW
(
lpszUrl
),
0
,
&
urlComponents
))
if
(
!
InternetCrackUrlW
(
lpszUrl
,
l
strlenW
(
lpszUrl
),
0
,
&
urlComponents
))
return
NULL
;
if
((
urlComponents
.
nScheme
==
INTERNET_SCHEME_HTTP
||
urlComponents
.
nScheme
==
INTERNET_SCHEME_HTTPS
)
&&
...
...
@@ -4174,7 +4167,7 @@ BOOL WINAPI InternetCombineUrlW(LPCWSTR lpszBaseUrl, LPCWSTR lpszRelativeUrl,
#define MAX_WORD_DIGITS 5
#define URL_GET_COMP_LENGTH(url, component) ((url)->dw##component##Length ? \
(url)->dw##component##Length : strlenW((url)->lpsz##component))
(url)->dw##component##Length :
l
strlenW((url)->lpsz##component))
#define URL_GET_COMP_LENGTHA(url, component) ((url)->dw##component##Length ? \
(url)->dw##component##Length : strlen((url)->lpsz##component))
...
...
@@ -4246,7 +4239,7 @@ static BOOL calc_url_length(LPURL_COMPONENTSW lpUrlComponents,
if
(
nScheme
==
INTERNET_SCHEME_DEFAULT
)
nScheme
=
INTERNET_SCHEME_HTTP
;
scheme
=
INTERNET_GetSchemeString
(
nScheme
);
*
lpdwUrlLength
+=
strlenW
(
scheme
);
*
lpdwUrlLength
+=
l
strlenW
(
scheme
);
}
(
*
lpdwUrlLength
)
++
;
/* ':' */
...
...
@@ -4437,6 +4430,7 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags,
{
DWORD
dwLen
;
INTERNET_SCHEME
nScheme
;
WCHAR
*
start
=
lpszUrl
;
static
const
WCHAR
slashSlashW
[]
=
{
'/'
,
'/'
};
static
const
WCHAR
fmtW
[]
=
{
'%'
,
'u'
,
0
};
...
...
@@ -4481,7 +4475,7 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags,
nScheme
=
INTERNET_SCHEME_HTTP
;
scheme
=
INTERNET_GetSchemeString
(
nScheme
);
dwLen
=
strlenW
(
scheme
);
dwLen
=
l
strlenW
(
scheme
);
memcpy
(
lpszUrl
,
scheme
,
dwLen
*
sizeof
(
WCHAR
));
lpszUrl
+=
dwLen
;
}
...
...
@@ -4526,7 +4520,7 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags,
{
*
lpszUrl
=
':'
;
lpszUrl
++
;
lpszUrl
+=
s
printfW
(
lpszUrl
,
fmtW
,
lpUrlComponents
->
nPort
);
lpszUrl
+=
s
wprintf
(
lpszUrl
,
*
lpdwUrlLength
-
(
lpszUrl
-
start
)
,
fmtW
,
lpUrlComponents
->
nPort
);
}
/* add slash between hostname and path if necessary */
...
...
dlls/wininet/internet.h
View file @
3c31cc58
...
...
@@ -23,7 +23,6 @@
#ifndef _WINE_INTERNET_H_
#define _WINE_INTERNET_H_
#include "wine/unicode.h"
#include "wine/heap.h"
#include "wine/list.h"
...
...
@@ -102,7 +101,7 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
if
(
str
)
{
DWORD
size
;
size
=
(
strlenW
(
str
)
+
1
)
*
sizeof
(
WCHAR
);
size
=
(
l
strlenW
(
str
)
+
1
)
*
sizeof
(
WCHAR
);
ret
=
heap_alloc
(
size
);
if
(
ret
)
memcpy
(
ret
,
str
,
size
);
...
...
@@ -209,7 +208,7 @@ static inline substr_t substr(const WCHAR *str, size_t len)
static
inline
substr_t
substrz
(
const
WCHAR
*
str
)
{
return
substr
(
str
,
strlenW
(
str
));
return
substr
(
str
,
l
strlenW
(
str
));
}
static
inline
void
WININET_find_data_WtoA
(
LPWIN32_FIND_DATAW
dataW
,
LPWIN32_FIND_DATAA
dataA
)
...
...
dlls/wininet/netconnection.c
View file @
3c31cc58
...
...
@@ -32,7 +32,6 @@
#include <stdio.h>
#include <assert.h>
#include "wine/library.h"
#include "windef.h"
#include "winbase.h"
#include "wininet.h"
...
...
dlls/wininet/urlcache.c
View file @
3c31cc58
...
...
@@ -45,8 +45,6 @@
#include "shellapi.h"
#include "internet.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
wininet
);
...
...
@@ -486,8 +484,8 @@ static DWORD cache_container_set_size(cache_container *container, HANDLE file, D
urlcache_create_hash_table
(
header
,
NULL
,
&
hashtable_entry
);
/* Last step - create the directories */
strcpyW
(
dir_path
,
container
->
path
);
dir_name
=
dir_path
+
strlenW
(
dir_path
);
l
strcpyW
(
dir_path
,
container
->
path
);
dir_name
=
dir_path
+
l
strlenW
(
dir_path
);
dir_name
[
8
]
=
0
;
GetSystemTimeAsFileTime
(
&
ft
);
...
...
@@ -611,8 +609,8 @@ static DWORD cache_container_open_index(cache_container *container, DWORD blocks
return
ERROR_SUCCESS
;
}
strcpyW
(
index_path
,
container
->
path
);
strcatW
(
index_path
,
index_dat
);
l
strcpyW
(
index_path
,
container
->
path
);
l
strcatW
(
index_path
,
index_dat
);
file
=
CreateFileW
(
index_path
,
GENERIC_READ
|
GENERIC_WRITE
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_ALWAYS
,
0
,
NULL
);
if
(
file
==
INVALID_HANDLE_VALUE
)
{
...
...
@@ -779,8 +777,8 @@ static void cache_containers_init(void)
ERR
(
"Couldn't get path for default container %u
\n
"
,
i
);
continue
;
}
path_len
=
strlenW
(
wszCachePath
);
suffix_len
=
strlenW
(
DefaultContainerData
[
i
].
shpath_suffix
);
path_len
=
l
strlenW
(
wszCachePath
);
suffix_len
=
l
strlenW
(
DefaultContainerData
[
i
].
shpath_suffix
);
if
(
path_len
+
suffix_len
+
2
>
MAX_PATH
)
{
...
...
@@ -791,7 +789,7 @@ static void cache_containers_init(void)
wszCachePath
[
path_len
]
=
'\\'
;
wszCachePath
[
path_len
+
1
]
=
0
;
strcpyW
(
wszMutexName
,
wszCachePath
);
l
strcpyW
(
wszMutexName
,
wszCachePath
);
if
(
suffix_len
)
{
...
...
@@ -984,7 +982,7 @@ static BOOL urlcache_create_file_pathW(
BOOL
trunc_name
)
{
LONG
nRequired
;
int
path_len
=
strlenW
(
pContainer
->
path
);
int
path_len
=
l
strlenW
(
pContainer
->
path
);
int
file_name_len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
szLocalFileName
,
-
1
,
NULL
,
0
);
if
(
Directory
!=
CACHE_CONTAINER_NO_SUBDIR
&&
Directory
>=
pHeader
->
dirs_no
)
{
...
...
@@ -1722,10 +1720,10 @@ static BOOL cache_container_delete_dir(LPCWSTR lpszPath)
SHFILEOPSTRUCTW
shfos
;
int
ret
;
path_len
=
strlenW
(
lpszPath
);
path_len
=
l
strlenW
(
lpszPath
);
if
(
path_len
>=
MAX_PATH
)
return
FALSE
;
strcpyW
(
path
,
lpszPath
);
l
strcpyW
(
path
,
lpszPath
);
path
[
path_len
+
1
]
=
0
;
/* double-NUL-terminate path */
shfos
.
hwnd
=
NULL
;
...
...
@@ -2331,7 +2329,7 @@ static DWORD urlcache_rate_entry(entry_url *url_entry, FILETIME *cur_time)
return
rating
;
}
static
int
dword_cmp
(
const
void
*
p1
,
const
void
*
p2
)
static
int
__cdecl
dword_cmp
(
const
void
*
p1
,
const
void
*
p2
)
{
return
*
(
const
DWORD
*
)
p1
-
*
(
const
DWORD
*
)
p2
;
}
...
...
@@ -2367,7 +2365,7 @@ BOOL WINAPI FreeUrlCacheSpaceW(LPCWSTR cache_path, DWORD size, DWORD filter)
}
if
(
cache_path
)
{
path_len
=
strlenW
(
cache_path
);
path_len
=
l
strlenW
(
cache_path
);
if
(
cache_path
[
path_len
-
1
]
==
'\\'
)
path_len
--
;
}
else
{
...
...
@@ -2379,7 +2377,7 @@ BOOL WINAPI FreeUrlCacheSpaceW(LPCWSTR cache_path, DWORD size, DWORD filter)
{
/* When cache_path==NULL only clean Temporary Internet Files */
if
((
!
path_len
&&
container
->
cache_prefix
[
0
]
==
0
)
||
(
path_len
&&
!
strncmpiW
(
container
->
path
,
cache_path
,
path_len
)
&&
(
path_len
&&
!
wcsnicmp
(
container
->
path
,
cache_path
,
path_len
)
&&
(
container
->
path
[
path_len
]
==
'\0'
||
container
->
path
[
path_len
]
==
'\\'
)))
{
BOOL
ret_del
;
...
...
@@ -2412,7 +2410,7 @@ BOOL WINAPI FreeUrlCacheSpaceW(LPCWSTR cache_path, DWORD size, DWORD filter)
FILETIME
cur_time
;
if
((
path_len
||
container
->
cache_prefix
[
0
]
!=
0
)
&&
(
!
path_len
||
strncmpiW
(
container
->
path
,
cache_path
,
path_len
)
||
(
!
path_len
||
wcsnicmp
(
container
->
path
,
cache_path
,
path_len
)
||
(
container
->
path
[
path_len
]
!=
'\0'
&&
container
->
path
[
path_len
]
!=
'\\'
)))
continue
;
...
...
@@ -2747,7 +2745,7 @@ static BOOL urlcache_entry_create(const char *url, const char *ext, WCHAR *full_
/* Try to generate random name */
GetSystemTimeAsFileTime
(
&
ft
);
strcpyW
(
full_path
+
full_path_len
+
8
,
extW
);
l
strcpyW
(
full_path
+
full_path_len
+
8
,
extW
);
for
(
i
=
0
;
i
<
255
;
i
++
)
{
int
j
;
...
...
@@ -2903,7 +2901,7 @@ static BOOL urlcache_entry_commit(const char *url, const WCHAR *file_name,
if
(
file_name
)
{
BOOL
bFound
=
FALSE
;
if
(
strncmpW
(
file_name
,
container
->
path
,
lstrlenW
(
container
->
path
)))
{
if
(
wcsncmp
(
file_name
,
container
->
path
,
lstrlenW
(
container
->
path
)))
{
ERR
(
"path %s must begin with cache content path %s
\n
"
,
debugstr_w
(
file_name
),
debugstr_w
(
container
->
path
));
cache_container_unlock_index
(
container
,
header
);
SetLastError
(
ERROR_INVALID_PARAMETER
);
...
...
dlls/wininet/utility.c
View file @
3c31cc58
...
...
@@ -46,7 +46,7 @@ time_t ConvertTimeString(LPCWSTR asctime)
WCHAR
tmpChar
[
TIME_STRING_LEN
];
WCHAR
*
tmpChar2
;
struct
tm
t
;
int
timelen
=
strlenW
(
asctime
);
int
timelen
=
l
strlenW
(
asctime
);
if
(
!
timelen
)
return
0
;
...
...
@@ -56,7 +56,7 @@ time_t ConvertTimeString(LPCWSTR asctime)
lstrcpynW
(
tmpChar
,
asctime
,
TIME_STRING_LEN
);
/* Assert that the string is the expected length */
if
(
strlenW
(
asctime
)
>=
TIME_STRING_LEN
)
FIXME
(
"
\n
"
);
if
(
l
strlenW
(
asctime
)
>=
TIME_STRING_LEN
)
FIXME
(
"
\n
"
);
/* Convert a time such as 'Mon, 15 Nov 1999 16:09:35 GMT' into a SYSTEMTIME structure
* We assume the time is in this format
...
...
@@ -71,11 +71,11 @@ time_t ConvertTimeString(LPCWSTR asctime)
tmpChar
[
25
]
=
'\0'
;
memset
(
&
t
,
0
,
sizeof
(
t
)
);
t
.
tm_year
=
atoiW
(
tmpChar
+
12
)
-
1900
;
t
.
tm_mday
=
atoiW
(
tmpChar
+
5
);
t
.
tm_hour
=
atoiW
(
tmpChar
+
17
);
t
.
tm_min
=
atoiW
(
tmpChar
+
2
0
);
t
.
tm_sec
=
atoiW
(
tmpChar
+
23
);
t
.
tm_year
=
wcstol
(
tmpChar
+
12
,
NULL
,
10
)
-
1900
;
t
.
tm_mday
=
wcstol
(
tmpChar
+
5
,
NULL
,
10
);
t
.
tm_hour
=
wcstol
(
tmpChar
+
17
,
NULL
,
10
);
t
.
tm_min
=
wcstol
(
tmpChar
+
20
,
NULL
,
1
0
);
t
.
tm_sec
=
wcstol
(
tmpChar
+
23
,
NULL
,
10
);
/* and month */
tmpChar2
=
tmpChar
+
8
;
...
...
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