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
2fccd2cb
Commit
2fccd2cb
authored
Jun 04, 2022
by
Hans Leidekker
Committed by
Alexandre Julliard
Jun 14, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Fix default port corner cases in WinHttpCrackUrl().
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
parent
eda3732a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
5 deletions
+22
-5
url.c
dlls/winhttp/tests/url.c
+8
-1
url.c
dlls/winhttp/url.c
+14
-4
No files found.
dlls/winhttp/tests/url.c
View file @
2fccd2cb
...
...
@@ -61,6 +61,7 @@ static const WCHAR url18[] = L"http://%0D%1F%20%0A%7F%0D%0A";
static
const
WCHAR
url19
[]
=
L"http://?text=
\xfb00
"
;
static
const
WCHAR
url20
[]
=
L"http:///text=
\xfb00
"
;
static
const
WCHAR
url21
[]
=
L"https://nba2k19-ws.2ksports.com:19133/nba/v4/Accounts/get_account?x=3789526775265663876"
;
static
const
WCHAR
url22
[]
=
L"http://winehq.org:/"
;
static
const
WCHAR
url_k1
[]
=
L"http://username:password@www.winehq.org/site/about"
;
static
const
WCHAR
url_k2
[]
=
L"http://www.winehq.org"
;
...
...
@@ -807,7 +808,13 @@ static void WinHttpCrackUrl_test( void )
uc
.
nPort
=
1
;
ret
=
WinHttpCrackUrl
(
url17
,
0
,
0
,
&
uc
);
ok
(
ret
,
"got %lu
\n
"
,
GetLastError
()
);
todo_wine
ok
(
uc
.
nPort
==
80
,
"got %u
\n
"
,
uc
.
nPort
);
ok
(
uc
.
nPort
==
80
,
"got %u
\n
"
,
uc
.
nPort
);
reset_url_components
(
&
uc
);
uc
.
nPort
=
1
;
ret
=
WinHttpCrackUrl
(
url22
,
0
,
0
,
&
uc
);
ok
(
ret
,
"got %lu
\n
"
,
GetLastError
()
);
ok
(
uc
.
nPort
==
80
,
"got %u
\n
"
,
uc
.
nPort
);
memset
(
&
uc
,
0
,
sizeof
(
uc
)
);
uc
.
dwStructSize
=
sizeof
(
uc
);
...
...
dlls/winhttp/url.c
View file @
2fccd2cb
...
...
@@ -280,13 +280,18 @@ BOOL WINAPI WinHttpCrackUrl( const WCHAR *url, DWORD len, DWORD flags, URL_COMPO
{
if
((
err
=
set_component
(
&
hostname
,
p
,
r
-
p
,
flags
,
&
overflow
)))
goto
exit
;
r
++
;
if
((
err
=
parse_port
(
r
,
q
-
r
,
&
uc
->
nPort
)))
goto
exit
;
if
(
!
(
q
-
r
))
{
if
(
scheme_number
==
INTERNET_SCHEME_HTTP
)
uc
->
nPort
=
INTERNET_DEFAULT_HTTP_PORT
;
else
if
(
scheme_number
==
INTERNET_SCHEME_HTTPS
)
uc
->
nPort
=
INTERNET_DEFAULT_HTTPS_PORT
;
}
else
if
((
err
=
parse_port
(
r
,
q
-
r
,
&
uc
->
nPort
)))
goto
exit
;
}
else
{
if
((
err
=
set_component
(
&
hostname
,
p
,
q
-
p
,
flags
,
&
overflow
)))
goto
exit
;
if
(
scheme_number
==
INTERNET_SCHEME_HTTP
)
uc
->
nPort
=
INTERNET_DEFAULT_HTTP_PORT
;
if
(
scheme_number
==
INTERNET_SCHEME_HTTPS
)
uc
->
nPort
=
INTERNET_DEFAULT_HTTPS_PORT
;
else
if
(
scheme_number
==
INTERNET_SCHEME_HTTPS
)
uc
->
nPort
=
INTERNET_DEFAULT_HTTPS_PORT
;
}
if
((
r
=
wmemchr
(
q
,
'?'
,
len
-
(
q
-
url
)
)))
...
...
@@ -310,13 +315,18 @@ BOOL WINAPI WinHttpCrackUrl( const WCHAR *url, DWORD len, DWORD flags, URL_COMPO
{
if
((
err
=
set_component
(
&
hostname
,
p
,
r
-
p
,
flags
,
&
overflow
)))
goto
exit
;
r
++
;
if
((
err
=
parse_port
(
r
,
len
-
(
r
-
url
),
&
uc
->
nPort
)))
goto
exit
;
if
(
!*
r
)
{
if
(
scheme_number
==
INTERNET_SCHEME_HTTP
)
uc
->
nPort
=
INTERNET_DEFAULT_HTTP_PORT
;
else
if
(
scheme_number
==
INTERNET_SCHEME_HTTPS
)
uc
->
nPort
=
INTERNET_DEFAULT_HTTPS_PORT
;
}
else
if
((
err
=
parse_port
(
r
,
len
-
(
r
-
url
),
&
uc
->
nPort
)))
goto
exit
;
}
else
{
if
((
err
=
set_component
(
&
hostname
,
p
,
len
-
(
p
-
url
),
flags
,
&
overflow
)))
goto
exit
;
if
(
scheme_number
==
INTERNET_SCHEME_HTTP
)
uc
->
nPort
=
INTERNET_DEFAULT_HTTP_PORT
;
if
(
scheme_number
==
INTERNET_SCHEME_HTTPS
)
uc
->
nPort
=
INTERNET_DEFAULT_HTTPS_PORT
;
else
if
(
scheme_number
==
INTERNET_SCHEME_HTTPS
)
uc
->
nPort
=
INTERNET_DEFAULT_HTTPS_PORT
;
}
if
((
err
=
set_component
(
&
path
,
(
WCHAR
*
)
url
+
len
,
0
,
flags
,
&
overflow
)))
goto
exit
;
if
((
err
=
set_component
(
&
extra
,
(
WCHAR
*
)
url
+
len
,
0
,
flags
,
&
overflow
)))
goto
exit
;
...
...
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