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
e3057aea
Commit
e3057aea
authored
Nov 20, 2019
by
Hans Leidekker
Committed by
Alexandre Julliard
Nov 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Build with msvcrt.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5a212dff
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
99 additions
and
109 deletions
+99
-109
Makefile.in
dlls/winhttp/Makefile.in
+2
-0
cookie.c
dlls/winhttp/cookie.c
+18
-18
handle.c
dlls/winhttp/handle.c
+1
-2
main.c
dlls/winhttp/main.c
+2
-3
net.c
dlls/winhttp/net.c
+7
-8
request.c
dlls/winhttp/request.c
+0
-0
session.c
dlls/winhttp/session.c
+44
-46
url.c
dlls/winhttp/url.c
+23
-25
winhttp_private.h
dlls/winhttp/winhttp_private.h
+2
-7
No files found.
dlls/winhttp/Makefile.in
View file @
e3057aea
...
...
@@ -3,6 +3,8 @@ IMPORTLIB = winhttp
IMPORTS
=
uuid jsproxy user32 advapi32 ws2_32
DELAYIMPORTS
=
oleaut32 ole32 crypt32 secur32 iphlpapi dhcpcsvc
EXTRADLLFLAGS
=
-mno-cygwin
C_SRCS
=
\
cookie.c
\
handle.c
\
...
...
dlls/winhttp/cookie.c
View file @
e3057aea
...
...
@@ -16,12 +16,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "ws2tcpip.h"
#include <stdarg.h>
#include <wchar.h>
#include "windef.h"
#include "winbase.h"
#include "ws2tcpip.h"
#include "winhttp.h"
#include "wine/debug.h"
...
...
@@ -69,7 +69,7 @@ static struct cookie *find_cookie( struct domain *domain, const WCHAR *path, con
LIST_FOR_EACH
(
item
,
&
domain
->
cookies
)
{
cookie
=
LIST_ENTRY
(
item
,
struct
cookie
,
entry
);
if
(
!
strcmpW
(
cookie
->
path
,
path
)
&&
!
strcmpW
(
cookie
->
name
,
name
))
if
(
!
wcscmp
(
cookie
->
path
,
path
)
&&
!
wcscmp
(
cookie
->
name
,
name
))
{
TRACE
(
"found %s=%s
\n
"
,
debugstr_w
(
cookie
->
name
),
debugstr_w
(
cookie
->
value
));
return
cookie
;
...
...
@@ -82,8 +82,8 @@ static BOOL domain_match( const WCHAR *name, struct domain *domain, BOOL partial
{
TRACE
(
"comparing %s with %s
\n
"
,
debugstr_w
(
name
),
debugstr_w
(
domain
->
name
));
if
(
partial
&&
!
strstrW
(
name
,
domain
->
name
))
return
FALSE
;
else
if
(
!
partial
&&
strcmpW
(
name
,
domain
->
name
))
return
FALSE
;
if
(
partial
&&
!
wcsstr
(
name
,
domain
->
name
))
return
FALSE
;
else
if
(
!
partial
&&
wcscmp
(
name
,
domain
->
name
))
return
FALSE
;
return
TRUE
;
}
...
...
@@ -165,7 +165,7 @@ static struct cookie *parse_cookie( const WCHAR *string )
const
WCHAR
*
p
;
int
len
;
if
(
!
(
p
=
strchrW
(
string
,
'='
)))
p
=
string
+
strlenW
(
string
);
if
(
!
(
p
=
wcschr
(
string
,
'='
)))
p
=
string
+
l
strlenW
(
string
);
len
=
p
-
string
;
while
(
len
&&
string
[
len
-
1
]
==
' '
)
len
--
;
if
(
!
len
)
return
NULL
;
...
...
@@ -184,7 +184,7 @@ static struct cookie *parse_cookie( const WCHAR *string )
if
(
*
p
++
==
'='
)
{
while
(
*
p
==
' '
)
p
++
;
len
=
strlenW
(
p
);
len
=
l
strlenW
(
p
);
while
(
len
&&
p
[
len
-
1
]
==
' '
)
len
--
;
if
(
!
(
cookie
->
value
=
heap_alloc
(
(
len
+
1
)
*
sizeof
(
WCHAR
)
)))
...
...
@@ -272,9 +272,9 @@ BOOL set_cookies( struct request *request, const WCHAR *cookies )
struct
cookie
*
cookie
;
int
len
,
used
;
len
=
strlenW
(
cookies
);
len
=
l
strlenW
(
cookies
);
if
(
!
(
buffer
=
heap_alloc
(
(
len
+
1
)
*
sizeof
(
WCHAR
)
)))
return
FALSE
;
strcpyW
(
buffer
,
cookies
);
l
strcpyW
(
buffer
,
cookies
);
p
=
buffer
;
while
(
*
p
&&
*
p
!=
';'
)
p
++
;
...
...
@@ -284,15 +284,15 @@ BOOL set_cookies( struct request *request, const WCHAR *cookies )
heap_free
(
buffer
);
return
FALSE
;
}
len
=
strlenW
(
p
);
len
=
l
strlenW
(
p
);
while
(
len
&&
(
attr
=
parse_attr
(
p
,
&
used
)))
{
if
(
!
strcmpiW
(
attr
->
name
,
domainW
))
if
(
!
wcsicmp
(
attr
->
name
,
domainW
))
{
domain
=
attr
;
cookie_domain
=
attr
->
value
;
}
else
if
(
!
strcmpiW
(
attr
->
name
,
pathW
))
else
if
(
!
wcsicmp
(
attr
->
name
,
pathW
))
{
path
=
attr
;
cookie_path
=
attr
->
value
;
...
...
@@ -308,7 +308,7 @@ BOOL set_cookies( struct request *request, const WCHAR *cookies )
if
(
!
cookie_domain
&&
!
(
cookie_domain
=
strdupW
(
request
->
connect
->
servername
)))
goto
end
;
if
(
!
cookie_path
&&
!
(
cookie_path
=
strdupW
(
request
->
path
)))
goto
end
;
if
((
p
=
strrchrW
(
cookie_path
,
'/'
))
&&
p
!=
cookie_path
)
*
p
=
0
;
if
((
p
=
wcsrchr
(
cookie_path
,
'/'
))
&&
p
!=
cookie_path
)
*
p
=
0
;
ret
=
add_cookie
(
session
,
cookie
,
cookie_domain
,
cookie_path
);
end:
...
...
@@ -342,14 +342,14 @@ BOOL add_cookie_headers( struct request *request )
TRACE
(
"comparing path %s with %s
\n
"
,
debugstr_w
(
request
->
path
),
debugstr_w
(
cookie
->
path
));
if
(
strstrW
(
request
->
path
,
cookie
->
path
)
==
request
->
path
)
if
(
wcsstr
(
request
->
path
,
cookie
->
path
)
==
request
->
path
)
{
static
const
WCHAR
cookieW
[]
=
{
'C'
,
'o'
,
'o'
,
'k'
,
'i'
,
'e'
,
':'
,
' '
};
int
len
,
len_cookie
=
ARRAY_SIZE
(
cookieW
),
len_name
=
strlenW
(
cookie
->
name
);
int
len
,
len_cookie
=
ARRAY_SIZE
(
cookieW
),
len_name
=
l
strlenW
(
cookie
->
name
);
WCHAR
*
header
;
len
=
len_cookie
+
len_name
;
if
(
cookie
->
value
)
len
+=
strlenW
(
cookie
->
value
)
+
1
;
if
(
cookie
->
value
)
len
+=
l
strlenW
(
cookie
->
value
)
+
1
;
if
(
!
(
header
=
heap_alloc
(
(
len
+
1
)
*
sizeof
(
WCHAR
)
)))
{
LeaveCriticalSection
(
&
session
->
cs
);
...
...
@@ -357,11 +357,11 @@ BOOL add_cookie_headers( struct request *request )
}
memcpy
(
header
,
cookieW
,
len_cookie
*
sizeof
(
WCHAR
)
);
strcpyW
(
header
+
len_cookie
,
cookie
->
name
);
l
strcpyW
(
header
+
len_cookie
,
cookie
->
name
);
if
(
cookie
->
value
)
{
header
[
len_cookie
+
len_name
]
=
'='
;
strcpyW
(
header
+
len_cookie
+
len_name
+
1
,
cookie
->
value
);
l
strcpyW
(
header
+
len_cookie
+
len_name
+
1
,
cookie
->
value
);
}
TRACE
(
"%s
\n
"
,
debugstr_w
(
header
));
...
...
dlls/winhttp/handle.c
View file @
e3057aea
...
...
@@ -18,12 +18,11 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "ws2tcpip.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "ws2tcpip.h"
#include "winhttp.h"
#include "wine/debug.h"
...
...
dlls/winhttp/main.c
View file @
e3057aea
...
...
@@ -16,13 +16,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include "config.h"
#include "ws2tcpip.h"
#include <stdarg.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "ws2tcpip.h"
#include "objbase.h"
#include "rpcproxy.h"
#include "httprequest.h"
...
...
dlls/winhttp/net.c
View file @
e3057aea
...
...
@@ -17,20 +17,17 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#define NONAMELESSUNION
#include "ws2tcpip.h"
#include <stdarg.h>
#include <stdio.h>
#include <assert.h>
#include <stdarg.h>
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "ws2tcpip.h"
#include "winhttp.h"
#include "schannel.h"
#include "wine/debug.h"
#include "wine/library.h"
#include "winhttp_private.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
winhttp
);
...
...
@@ -207,7 +204,9 @@ struct netconn *netconn_create( struct hostdata *host, const struct sockaddr_sto
addr_len
=
sizeof
(
struct
sockaddr_in6
);
break
;
default:
assert
(
0
);
ERR
(
"unhandled family %u
\n
"
,
conn
->
sockaddr
.
ss_family
);
heap_free
(
conn
);
return
NULL
;
}
if
(
timeout
>
0
)
set_blocking
(
conn
,
FALSE
);
...
...
@@ -374,7 +373,7 @@ BOOL netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD securi
heap_free
(
read_buf
);
if
(
status
!=
SEC_E_OK
||
res
!=
ERROR_SUCCESS
)
{
WARN
(
"Failed to initialize security context
failed
: %08x
\n
"
,
status
);
WARN
(
"Failed to initialize security context: %08x
\n
"
,
status
);
heap_free
(
conn
->
ssl_buf
);
conn
->
ssl_buf
=
NULL
;
DeleteSecurityContext
(
&
ctx
);
...
...
dlls/winhttp/request.c
View file @
e3057aea
This diff is collapsed.
Click to expand it.
dlls/winhttp/session.c
View file @
e3057aea
...
...
@@ -16,9 +16,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdarg.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
...
...
@@ -379,7 +377,7 @@ static BOOL domain_matches(LPCWSTR server, LPCWSTR domain)
static
const
WCHAR
localW
[]
=
{
'<'
,
'l'
,
'o'
,
'c'
,
'a'
,
'l'
,
'>'
,
0
};
BOOL
ret
=
FALSE
;
if
(
!
strcmpiW
(
domain
,
localW
)
&&
!
strchrW
(
server
,
'.'
))
if
(
!
wcsicmp
(
domain
,
localW
)
&&
!
wcschr
(
server
,
'.'
))
ret
=
TRUE
;
else
if
(
*
domain
==
'*'
)
{
...
...
@@ -391,12 +389,12 @@ static BOOL domain_matches(LPCWSTR server, LPCWSTR 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
)
{
int
len
=
strlenW
(
dot
+
1
);
int
len
=
l
strlenW
(
dot
+
1
);
if
(
len
>
strlenW
(
domain
+
2
))
if
(
len
>
l
strlenW
(
domain
+
2
))
{
LPCWSTR
ptr
;
...
...
@@ -404,8 +402,8 @@ static BOOL domain_matches(LPCWSTR server, LPCWSTR domain)
* could be a subdomain. Compare the last portion of the
* server's domain.
*/
ptr
=
dot
+
len
+
1
-
strlenW
(
domain
+
2
);
if
(
!
strcmpiW
(
ptr
,
domain
+
2
))
ptr
=
dot
+
len
+
1
-
l
strlenW
(
domain
+
2
);
if
(
!
wcsicmp
(
ptr
,
domain
+
2
))
{
/* This is only a match if the preceding character is
* a '.', i.e. that it is a matching domain. E.g.
...
...
@@ -416,12 +414,12 @@ static BOOL domain_matches(LPCWSTR server, LPCWSTR domain)
}
}
else
ret
=
!
strcmpiW
(
dot
+
1
,
domain
+
2
);
ret
=
!
wcsicmp
(
dot
+
1
,
domain
+
2
);
}
}
}
else
ret
=
!
strcmpiW
(
server
,
domain
);
ret
=
!
wcsicmp
(
server
,
domain
);
return
ret
;
}
...
...
@@ -438,9 +436,9 @@ static BOOL should_bypass_proxy(struct session *session, LPCWSTR server)
do
{
LPCWSTR
tmp
=
ptr
;
ptr
=
strchrW
(
ptr
,
';'
);
ptr
=
wcschr
(
ptr
,
';'
);
if
(
!
ptr
)
ptr
=
strchrW
(
tmp
,
' '
);
ptr
=
wcschr
(
tmp
,
' '
);
if
(
ptr
)
{
if
(
ptr
-
tmp
<
MAX_HOST_NAME_LENGTH
)
...
...
@@ -468,9 +466,9 @@ BOOL set_server_for_hostname( struct connect *connect, const WCHAR *server, INTE
{
LPCWSTR
colon
;
if
((
colon
=
strchrW
(
session
->
proxy_server
,
':'
)))
if
((
colon
=
wcschr
(
session
->
proxy_server
,
':'
)))
{
if
(
!
connect
->
servername
||
strncmpiW
(
connect
->
servername
,
if
(
!
connect
->
servername
||
wcsnicmp
(
connect
->
servername
,
session
->
proxy_server
,
colon
-
session
->
proxy_server
-
1
))
{
heap_free
(
connect
->
servername
);
...
...
@@ -485,14 +483,14 @@ BOOL set_server_for_hostname( struct connect *connect, const WCHAR *server, INTE
(
colon
-
session
->
proxy_server
)
*
sizeof
(
WCHAR
)
);
connect
->
servername
[
colon
-
session
->
proxy_server
]
=
0
;
if
(
*
(
colon
+
1
))
connect
->
serverport
=
atoiW
(
colon
+
1
);
connect
->
serverport
=
wcstol
(
colon
+
1
,
NULL
,
10
);
else
connect
->
serverport
=
INTERNET_DEFAULT_PORT
;
}
}
else
{
if
(
!
connect
->
servername
||
strcmpiW
(
connect
->
servername
,
if
(
!
connect
->
servername
||
wcsicmp
(
connect
->
servername
,
session
->
proxy_server
))
{
heap_free
(
connect
->
servername
);
...
...
@@ -635,7 +633,7 @@ static void request_destroy( struct object_header *hdr )
static
void
str_to_buffer
(
WCHAR
*
buffer
,
const
WCHAR
*
str
,
LPDWORD
buflen
)
{
int
len
=
0
;
if
(
str
)
len
=
strlenW
(
str
);
if
(
str
)
len
=
l
strlenW
(
str
);
if
(
buffer
&&
*
buflen
>
len
)
{
if
(
str
)
memcpy
(
buffer
,
str
,
len
*
sizeof
(
WCHAR
)
);
...
...
@@ -1075,13 +1073,13 @@ static BOOL add_accept_types_header( struct request *request, const WCHAR **type
static
WCHAR
*
get_request_path
(
const
WCHAR
*
object
)
{
int
len
=
object
?
strlenW
(
object
)
:
0
;
int
len
=
object
?
l
strlenW
(
object
)
:
0
;
WCHAR
*
p
,
*
ret
;
if
(
!
object
||
object
[
0
]
!=
'/'
)
len
++
;
if
(
!
(
p
=
ret
=
heap_alloc
(
(
len
+
1
)
*
sizeof
(
WCHAR
)
)))
return
NULL
;
if
(
!
object
||
object
[
0
]
!=
'/'
)
*
p
++
=
'/'
;
if
(
object
)
strcpyW
(
p
,
object
);
if
(
object
)
l
strcpyW
(
p
,
object
);
ret
[
len
]
=
0
;
return
ret
;
}
...
...
@@ -1421,12 +1419,12 @@ static WCHAR *build_wpad_url( const char *hostname, const struct addrinfo *ai )
if
(
!
reverse_lookup
(
ai
,
name
,
sizeof
(
name
)
))
hostname
=
name
;
len
=
strlenW
(
httpW
)
+
strlen
(
hostname
)
+
strlenW
(
wpadW
);
len
=
lstrlenW
(
httpW
)
+
strlen
(
hostname
)
+
l
strlenW
(
wpadW
);
if
(
!
(
ret
=
p
=
GlobalAlloc
(
0
,
(
len
+
1
)
*
sizeof
(
WCHAR
)
)))
return
NULL
;
strcpyW
(
p
,
httpW
);
p
+=
strlenW
(
httpW
);
l
strcpyW
(
p
,
httpW
);
p
+=
l
strlenW
(
httpW
);
while
(
*
hostname
)
{
*
p
++
=
*
hostname
++
;
}
strcpyW
(
p
,
wpadW
);
l
strcpyW
(
p
,
wpadW
);
return
ret
;
}
...
...
@@ -2007,9 +2005,9 @@ BOOL WINAPI WinHttpSetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
if
(
info
->
dwAccessType
==
WINHTTP_ACCESS_TYPE_NAMED_PROXY
)
{
size
+=
strlenW
(
info
->
lpszProxy
);
size
+=
l
strlenW
(
info
->
lpszProxy
);
if
(
info
->
lpszProxyBypass
)
size
+=
strlenW
(
info
->
lpszProxyBypass
);
size
+=
l
strlenW
(
info
->
lpszProxyBypass
);
}
buf
=
heap_alloc
(
size
);
if
(
buf
)
...
...
@@ -2025,14 +2023,14 @@ BOOL WINAPI WinHttpSetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
BYTE
*
dst
;
hdr
->
flags
=
PROXY_TYPE_PROXY
;
*
len
++
=
strlenW
(
info
->
lpszProxy
);
*
len
++
=
l
strlenW
(
info
->
lpszProxy
);
for
(
dst
=
(
BYTE
*
)
len
,
src
=
info
->
lpszProxy
;
*
src
;
src
++
,
dst
++
)
*
dst
=
*
src
;
len
=
(
DWORD
*
)
dst
;
if
(
info
->
lpszProxyBypass
)
{
*
len
++
=
strlenW
(
info
->
lpszProxyBypass
);
*
len
++
=
l
strlenW
(
info
->
lpszProxyBypass
);
for
(
dst
=
(
BYTE
*
)
len
,
src
=
info
->
lpszProxyBypass
;
*
src
;
src
++
,
dst
++
)
*
dst
=
*
src
;
...
...
@@ -2176,7 +2174,7 @@ BOOL WINAPI WinHttpTimeFromSystemTime( const SYSTEMTIME *time, LPWSTR string )
return
FALSE
;
}
s
printfW
(
string
,
format
,
s
wprintf
(
string
,
WINHTTP_TIME_FORMAT_BUFSIZE
/
sizeof
(
WCHAR
)
,
format
,
wkday
[
time
->
wDayOfWeek
],
time
->
wDay
,
month
[
time
->
wMonth
-
1
],
...
...
@@ -2215,15 +2213,15 @@ BOOL WINAPI WinHttpTimeToSystemTime( LPCWSTR string, SYSTEMTIME *time )
SetLastError
(
ERROR_SUCCESS
);
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
(
to
upperW
(
wkday
[
i
][
0
]
)
==
toupperW
(
s
[
0
]
)
&&
to
upperW
(
wkday
[
i
][
1
]
)
==
toupperW
(
s
[
1
]
)
&&
to
upperW
(
wkday
[
i
][
2
]
)
==
toupperW
(
s
[
2
]
)
)
if
(
to
wupper
(
wkday
[
i
][
0
]
)
==
towupper
(
s
[
0
]
)
&&
to
wupper
(
wkday
[
i
][
1
]
)
==
towupper
(
s
[
1
]
)
&&
to
wupper
(
wkday
[
i
][
2
]
)
==
towupper
(
s
[
2
]
)
)
{
time
->
wDayOfWeek
=
i
;
break
;
...
...
@@ -2231,19 +2229,19 @@ BOOL WINAPI WinHttpTimeToSystemTime( LPCWSTR string, SYSTEMTIME *time )
}
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
(
to
upperW
(
month
[
i
][
0
])
==
toupperW
(
s
[
0
]
)
&&
to
upperW
(
month
[
i
][
1
])
==
toupperW
(
s
[
1
]
)
&&
to
upperW
(
month
[
i
][
2
])
==
toupperW
(
s
[
2
]
)
)
if
(
to
wupper
(
month
[
i
][
0
])
==
towupper
(
s
[
0
]
)
&&
to
wupper
(
month
[
i
][
1
])
==
towupper
(
s
[
1
]
)
&&
to
wupper
(
month
[
i
][
2
])
==
towupper
(
s
[
2
]
)
)
{
time
->
wMonth
=
i
+
1
;
break
;
...
...
@@ -2251,24 +2249,24 @@ BOOL WINAPI WinHttpTimeToSystemTime( LPCWSTR string, SYSTEMTIME *time )
}
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
);
time
->
wMilliseconds
=
0
;
return
TRUE
;
...
...
dlls/winhttp/url.c
View file @
e3057aea
...
...
@@ -16,12 +16,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "ws2tcpip.h"
#include <stdarg.h>
#include <wchar.h>
#include "windef.h"
#include "winbase.h"
#include "ws2tcpip.h"
#include "winreg.h"
#include "winhttp.h"
#include "shlwapi.h"
...
...
@@ -74,12 +72,12 @@ static WCHAR *decode_url( LPCWSTR url, DWORD *len )
q
=
ret
;
while
(
*
len
>
0
)
{
if
(
p
[
0
]
==
'%'
&&
is
xdigitW
(
p
[
1
]
)
&&
isxdigitW
(
p
[
2
]
))
if
(
p
[
0
]
==
'%'
&&
is
wxdigit
(
p
[
1
]
)
&&
iswxdigit
(
p
[
2
]
))
{
hex
[
0
]
=
p
[
1
];
hex
[
1
]
=
p
[
2
];
hex
[
2
]
=
0
;
*
q
++
=
strtolW
(
hex
,
NULL
,
16
);
*
q
++
=
wcstol
(
hex
,
NULL
,
16
);
p
+=
3
;
*
len
-=
3
;
}
...
...
@@ -139,7 +137,7 @@ static DWORD escape_url( const WCHAR *url, DWORD *len, WCHAR **ret )
const
WCHAR
*
p
;
DWORD
len_base
,
len_path
;
if
((
p
=
strrchrW
(
url
,
'/'
)))
if
((
p
=
wcsrchr
(
url
,
'/'
)))
{
len_base
=
p
-
url
;
if
(
!
escape_string
(
p
,
*
len
-
len_base
,
NULL
,
&
len_path
))
return
ERROR_INVALID_PARAMETER
;
...
...
@@ -164,7 +162,7 @@ static DWORD parse_port( const WCHAR *str, DWORD len, INTERNET_PORT *ret )
{
const
WCHAR
*
p
=
str
;
DWORD
port
=
0
;
while
(
len
&&
is
digitW
(
*
p
))
while
(
len
&&
is
wdigit
(
*
p
))
{
if
((
port
=
port
*
10
+
*
p
-
'0'
)
>
65535
)
return
ERROR_WINHTTP_INVALID_URL
;
p
++
;
len
--
;
...
...
@@ -191,7 +189,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
if
(
!
len
)
len
=
strlenW
(
url
);
if
(
!
len
)
len
=
l
strlenW
(
url
);
if
(
flags
&
ICU_ESCAPE
)
{
...
...
@@ -211,13 +209,13 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
}
url
=
url_decoded
;
}
if
(
!
(
p
=
strchrW
(
url
,
':'
)))
if
(
!
(
p
=
wcschr
(
url
,
':'
)))
{
SetLastError
(
ERROR_WINHTTP_UNRECOGNIZED_SCHEME
);
return
FALSE
;
}
if
(
p
-
url
==
4
&&
!
strncmpiW
(
url
,
scheme_http
,
4
))
scheme_number
=
INTERNET_SCHEME_HTTP
;
else
if
(
p
-
url
==
5
&&
!
strncmpiW
(
url
,
scheme_https
,
5
))
scheme_number
=
INTERNET_SCHEME_HTTPS
;
if
(
p
-
url
==
4
&&
!
wcsnicmp
(
url
,
scheme_http
,
4
))
scheme_number
=
INTERNET_SCHEME_HTTP
;
else
if
(
p
-
url
==
5
&&
!
wcsnicmp
(
url
,
scheme_https
,
5
))
scheme_number
=
INTERNET_SCHEME_HTTPS
;
else
{
err
=
ERROR_WINHTTP_UNRECOGNIZED_SCHEME
;
...
...
@@ -248,10 +246,10 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
password
.
str
=
&
uc
->
lpszPassword
;
password
.
len
=
&
uc
->
dwPasswordLength
;
if
((
q
=
memchrW
(
p
,
'@'
,
len
-
(
p
-
url
)
))
&&
!
(
memchrW
(
p
,
'/'
,
q
-
p
)))
if
((
q
=
wmemchr
(
p
,
'@'
,
len
-
(
p
-
url
)
))
&&
!
(
wmemchr
(
p
,
'/'
,
q
-
p
)))
{
if
((
r
=
memchrW
(
p
,
':'
,
q
-
p
)))
if
((
r
=
wmemchr
(
p
,
':'
,
q
-
p
)))
{
if
((
err
=
set_component
(
&
username
,
p
,
r
-
p
,
flags
,
&
overflow
)))
goto
exit
;
r
++
;
...
...
@@ -279,9 +277,9 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
extra
.
str
=
&
uc
->
lpszExtraInfo
;
extra
.
len
=
&
uc
->
dwExtraInfoLength
;
if
((
q
=
memchrW
(
p
,
'/'
,
len
-
(
p
-
url
)
)))
if
((
q
=
wmemchr
(
p
,
'/'
,
len
-
(
p
-
url
)
)))
{
if
((
r
=
memchrW
(
p
,
':'
,
q
-
p
)))
if
((
r
=
wmemchr
(
p
,
':'
,
q
-
p
)))
{
if
((
err
=
set_component
(
&
hostname
,
p
,
r
-
p
,
flags
,
&
overflow
)))
goto
exit
;
r
++
;
...
...
@@ -294,7 +292,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
if
(
scheme_number
==
INTERNET_SCHEME_HTTPS
)
uc
->
nPort
=
INTERNET_DEFAULT_HTTPS_PORT
;
}
if
((
r
=
memchrW
(
q
,
'?'
,
len
-
(
q
-
url
)
)))
if
((
r
=
wmemchr
(
q
,
'?'
,
len
-
(
q
-
url
)
)))
{
if
(
*
extra
.
len
)
{
...
...
@@ -311,7 +309,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
}
else
{
if
((
r
=
memchrW
(
p
,
':'
,
len
-
(
p
-
url
)
)))
if
((
r
=
wmemchr
(
p
,
':'
,
len
-
(
p
-
url
)
)))
{
if
((
err
=
set_component
(
&
hostname
,
p
,
r
-
p
,
flags
,
&
overflow
)))
goto
exit
;
r
++
;
...
...
@@ -345,8 +343,8 @@ exit:
static
INTERNET_SCHEME
get_scheme
(
const
WCHAR
*
scheme
,
DWORD
len
)
{
if
(
!
strncmpW
(
scheme
,
scheme_http
,
len
))
return
INTERNET_SCHEME_HTTP
;
if
(
!
strncmpW
(
scheme
,
scheme_https
,
len
))
return
INTERNET_SCHEME_HTTPS
;
if
(
!
wcsncmp
(
scheme
,
scheme_http
,
len
))
return
INTERNET_SCHEME_HTTP
;
if
(
!
wcsncmp
(
scheme
,
scheme_https
,
len
))
return
INTERNET_SCHEME_HTTPS
;
return
0
;
}
...
...
@@ -369,7 +367,7 @@ static DWORD get_comp_length( DWORD len, DWORD flags, WCHAR *comp )
DWORD
ret
;
unsigned
int
i
;
ret
=
len
?
len
:
strlenW
(
comp
);
ret
=
len
?
len
:
l
strlenW
(
comp
);
if
(
!
(
flags
&
ICU_ESCAPE
))
return
ret
;
for
(
i
=
0
;
i
<
len
;
i
++
)
if
(
need_escape
(
comp
[
i
]
))
ret
+=
2
;
return
ret
;
...
...
@@ -391,7 +389,7 @@ static BOOL get_url_length( URL_COMPONENTS *uc, DWORD flags, DWORD *len )
{
scheme
=
uc
->
nScheme
;
if
(
!
scheme
)
scheme
=
INTERNET_SCHEME_HTTP
;
*
len
+=
strlenW
(
get_scheme_string
(
scheme
)
);
*
len
+=
l
strlenW
(
get_scheme_string
(
scheme
)
);
}
*
len
+=
3
;
/* "://" */
...
...
@@ -421,7 +419,7 @@ static BOOL get_url_length( URL_COMPONENTS *uc, DWORD flags, DWORD *len )
{
WCHAR
port
[
sizeof
(
"65535"
)];
*
len
+=
s
printfW
(
port
,
formatW
,
uc
->
nPort
);
*
len
+=
s
wprintf
(
port
,
ARRAY_SIZE
(
port
)
,
formatW
,
uc
->
nPort
);
*
len
+=
1
;
/* ":" */
}
if
(
uc
->
lpszUrlPath
&&
*
uc
->
lpszUrlPath
!=
'/'
)
*
len
+=
1
;
/* '/' */
...
...
@@ -480,7 +478,7 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
if
(
!
scheme
)
scheme
=
INTERNET_SCHEME_HTTP
;
schemeW
=
get_scheme_string
(
scheme
);
len
=
strlenW
(
schemeW
);
len
=
l
strlenW
(
schemeW
);
memcpy
(
url
,
schemeW
,
len
*
sizeof
(
WCHAR
)
);
url
+=
len
;
}
...
...
@@ -513,7 +511,7 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
if
(
!
uses_default_port
(
scheme
,
uc
->
nPort
))
{
*
url
++
=
':'
;
url
+=
s
printfW
(
url
,
formatW
,
uc
->
nPort
);
url
+=
s
wprintf
(
url
,
sizeof
(
"65535"
)
,
formatW
,
uc
->
nPort
);
}
/* add slash between hostname and path if necessary */
...
...
dlls/winhttp/winhttp_private.h
View file @
e3057aea
...
...
@@ -19,13 +19,8 @@
#ifndef _WINE_WINHTTP_PRIVATE_H_
#define _WINE_WINHTTP_PRIVATE_H_
#ifndef __WINE_CONFIG_H
# error You must include config.h to use this header
#endif
#include "wine/heap.h"
#include "wine/list.h"
#include "wine/unicode.h"
#include "ole2.h"
#include "sspi.h"
...
...
@@ -304,8 +299,8 @@ static inline WCHAR *strdupW( const WCHAR *src )
WCHAR
*
dst
;
if
(
!
src
)
return
NULL
;
dst
=
heap_alloc
(
(
strlenW
(
src
)
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
dst
)
strcpyW
(
dst
,
src
);
dst
=
heap_alloc
(
(
l
strlenW
(
src
)
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
dst
)
l
strcpyW
(
dst
,
src
);
return
dst
;
}
...
...
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