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
069df699
Commit
069df699
authored
May 22, 2014
by
Hans Leidekker
Committed by
Alexandre Julliard
May 24, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Only set the scheme if we have a valid URL.
parent
465f85e8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
6 deletions
+48
-6
url.c
dlls/winhttp/tests/url.c
+35
-0
url.c
dlls/winhttp/url.c
+13
-6
No files found.
dlls/winhttp/tests/url.c
View file @
069df699
...
...
@@ -658,6 +658,41 @@ static void WinHttpCrackUrl_test( void )
ok
(
uc
.
dwUrlPathLength
==
5
,
"unexpected length %u
\n
"
,
uc
.
dwUrlPathLength
);
ok
(
!
uc
.
lpszExtraInfo
[
0
],
"unexpected extra info %s
\n
"
,
wine_dbgstr_w
(
uc
.
lpszExtraInfo
)
);
ok
(
uc
.
dwExtraInfoLength
==
0
,
"unexpected length %u
\n
"
,
uc
.
dwExtraInfoLength
);
uc
.
dwStructSize
=
sizeof
(
uc
);
uc
.
lpszScheme
=
scheme
;
uc
.
dwSchemeLength
=
0
;
uc
.
nScheme
=
0
;
uc
.
lpszHostName
=
NULL
;
uc
.
dwHostNameLength
=
0
;
uc
.
nPort
=
0
;
uc
.
lpszUserName
=
NULL
;
uc
.
dwUserNameLength
=
~
0u
;
uc
.
lpszPassword
=
NULL
;
uc
.
dwPasswordLength
=
~
0u
;
uc
.
lpszUrlPath
=
NULL
;
uc
.
dwUrlPathLength
=
0
;
uc
.
lpszExtraInfo
=
NULL
;
uc
.
dwExtraInfoLength
=
0
;
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpCrackUrl
(
url15
,
0
,
0
,
&
uc
);
error
=
GetLastError
();
ok
(
!
ret
,
"WinHttpCrackUrl succeeded
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
ok
(
!
lstrcmpW
(
uc
.
lpszScheme
,
http
),
"unexpected scheme %s
\n
"
,
wine_dbgstr_w
(
uc
.
lpszScheme
)
);
ok
(
!
uc
.
dwSchemeLength
,
"unexpected length %u
\n
"
,
uc
.
dwSchemeLength
);
ok
(
uc
.
nScheme
==
0
,
"unexpected scheme %u
\n
"
,
uc
.
nScheme
);
ok
(
!
uc
.
lpszHostName
,
"unexpected hostname %s
\n
"
,
wine_dbgstr_w
(
uc
.
lpszHostName
)
);
ok
(
uc
.
dwHostNameLength
==
0
,
"unexpected length %u
\n
"
,
uc
.
dwHostNameLength
);
ok
(
uc
.
nPort
==
0
,
"unexpected port %u
\n
"
,
uc
.
nPort
);
ok
(
!
uc
.
lpszUserName
,
"unexpected username
\n
"
);
ok
(
uc
.
dwUserNameLength
==
~
0u
,
"unexpected length %u
\n
"
,
uc
.
dwUserNameLength
);
ok
(
!
uc
.
lpszPassword
,
"unexpected password
\n
"
);
ok
(
uc
.
dwPasswordLength
==
~
0u
,
"unexpected length %u
\n
"
,
uc
.
dwPasswordLength
);
ok
(
!
uc
.
lpszUrlPath
,
"unexpected path %s
\n
"
,
wine_dbgstr_w
(
uc
.
lpszUrlPath
)
);
ok
(
uc
.
dwUrlPathLength
==
0
,
"unexpected length %u
\n
"
,
uc
.
dwUrlPathLength
);
ok
(
!
uc
.
lpszExtraInfo
,
"unexpected extra info %s
\n
"
,
wine_dbgstr_w
(
uc
.
lpszExtraInfo
)
);
ok
(
uc
.
dwExtraInfoLength
==
0
,
"unexpected length %u
\n
"
,
uc
.
dwExtraInfoLength
);
}
START_TEST
(
url
)
...
...
dlls/winhttp/url.c
View file @
069df699
...
...
@@ -36,6 +36,11 @@ static const WCHAR scheme_https[] = {'h','t','t','p','s',0};
static
BOOL
set_component
(
WCHAR
**
str
,
DWORD
*
str_len
,
WCHAR
*
value
,
DWORD
len
,
DWORD
flags
)
{
if
(
*
str
&&
!*
str_len
)
{
set_last_error
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
if
(
!*
str_len
)
return
TRUE
;
if
(
!*
str
)
{
...
...
@@ -174,6 +179,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
{
BOOL
ret
=
FALSE
;
WCHAR
*
p
,
*
q
,
*
r
,
*
url_decoded
=
NULL
,
*
url_escaped
=
NULL
;
INTERNET_SCHEME
scheme
=
0
;
TRACE
(
"%s, %d, %x, %p
\n
"
,
debugstr_w
(
url
),
len
,
flags
,
uc
);
...
...
@@ -207,8 +213,8 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
set_last_error
(
ERROR_WINHTTP_UNRECOGNIZED_SCHEME
);
return
FALSE
;
}
if
(
p
-
url
==
4
&&
!
strncmpiW
(
url
,
scheme_http
,
4
))
uc
->
nS
cheme
=
INTERNET_SCHEME_HTTP
;
else
if
(
p
-
url
==
5
&&
!
strncmpiW
(
url
,
scheme_https
,
5
))
uc
->
nS
cheme
=
INTERNET_SCHEME_HTTPS
;
if
(
p
-
url
==
4
&&
!
strncmpiW
(
url
,
scheme_http
,
4
))
s
cheme
=
INTERNET_SCHEME_HTTP
;
else
if
(
p
-
url
==
5
&&
!
strncmpiW
(
url
,
scheme_https
,
5
))
s
cheme
=
INTERNET_SCHEME_HTTPS
;
else
{
set_last_error
(
ERROR_WINHTTP_UNRECOGNIZED_SCHEME
);
...
...
@@ -252,8 +258,8 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
else
{
if
(
!
(
set_component
(
&
uc
->
lpszHostName
,
&
uc
->
dwHostNameLength
,
p
,
q
-
p
,
flags
)))
goto
exit
;
if
(
uc
->
nS
cheme
==
INTERNET_SCHEME_HTTP
)
uc
->
nPort
=
INTERNET_DEFAULT_HTTP_PORT
;
if
(
uc
->
nS
cheme
==
INTERNET_SCHEME_HTTPS
)
uc
->
nPort
=
INTERNET_DEFAULT_HTTPS_PORT
;
if
(
s
cheme
==
INTERNET_SCHEME_HTTP
)
uc
->
nPort
=
INTERNET_DEFAULT_HTTP_PORT
;
if
(
s
cheme
==
INTERNET_SCHEME_HTTPS
)
uc
->
nPort
=
INTERNET_DEFAULT_HTTPS_PORT
;
}
if
((
r
=
memchrW
(
q
,
'?'
,
len
-
(
q
-
url
)
)))
...
...
@@ -278,8 +284,8 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
else
{
if
(
!
(
set_component
(
&
uc
->
lpszHostName
,
&
uc
->
dwHostNameLength
,
p
,
len
-
(
p
-
url
),
flags
)))
goto
exit
;
if
(
uc
->
nS
cheme
==
INTERNET_SCHEME_HTTP
)
uc
->
nPort
=
INTERNET_DEFAULT_HTTP_PORT
;
if
(
uc
->
nS
cheme
==
INTERNET_SCHEME_HTTPS
)
uc
->
nPort
=
INTERNET_DEFAULT_HTTPS_PORT
;
if
(
s
cheme
==
INTERNET_SCHEME_HTTP
)
uc
->
nPort
=
INTERNET_DEFAULT_HTTP_PORT
;
if
(
s
cheme
==
INTERNET_SCHEME_HTTPS
)
uc
->
nPort
=
INTERNET_DEFAULT_HTTPS_PORT
;
}
if
(
!
(
set_component
(
&
uc
->
lpszUrlPath
,
&
uc
->
dwUrlPathLength
,
(
WCHAR
*
)
url
+
len
,
0
,
flags
)))
goto
exit
;
if
(
!
(
set_component
(
&
uc
->
lpszExtraInfo
,
&
uc
->
dwExtraInfoLength
,
(
WCHAR
*
)
url
+
len
,
0
,
flags
)))
goto
exit
;
...
...
@@ -295,6 +301,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
debugstr_wn
(
uc
->
lpszExtraInfo
,
uc
->
dwExtraInfoLength
));
exit:
if
(
ret
)
uc
->
nScheme
=
scheme
;
heap_free
(
url_decoded
);
heap_free
(
url_escaped
);
return
ret
;
...
...
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