Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
4876375a
Commit
4876375a
authored
Dec 31, 2008
by
Paul TBBle Hampson
Committed by
Alexandre Julliard
Dec 31, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Correctly parse specified ports in WinHttpCrackUrl.
parent
f093f9e8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
12 deletions
+35
-12
url.c
dlls/winhttp/tests/url.c
+9
-9
url.c
dlls/winhttp/url.c
+26
-3
No files found.
dlls/winhttp/tests/url.c
View file @
4876375a
...
@@ -361,7 +361,7 @@ static void WinHttpCrackUrl_test( void )
...
@@ -361,7 +361,7 @@ static void WinHttpCrackUrl_test( void )
ok
(
uc
.
dwPasswordLength
==
8
,
"unexpected password length
\n
"
);
ok
(
uc
.
dwPasswordLength
==
8
,
"unexpected password length
\n
"
);
ok
(
!
memcmp
(
uc
.
lpszHostName
,
winehq
,
sizeof
(
winehq
)
),
"unexpected hostname
\n
"
);
ok
(
!
memcmp
(
uc
.
lpszHostName
,
winehq
,
sizeof
(
winehq
)
),
"unexpected hostname
\n
"
);
ok
(
uc
.
dwHostNameLength
==
14
,
"unexpected hostname length
\n
"
);
ok
(
uc
.
dwHostNameLength
==
14
,
"unexpected hostname length
\n
"
);
todo_wine
ok
(
uc
.
nPort
==
80
,
"unexpected port: %u
\n
"
,
uc
.
nPort
);
ok
(
uc
.
nPort
==
80
,
"unexpected port: %u
\n
"
,
uc
.
nPort
);
ok
(
!
memcmp
(
uc
.
lpszUrlPath
,
about
,
sizeof
(
about
)
),
"unexpected path
\n
"
);
ok
(
!
memcmp
(
uc
.
lpszUrlPath
,
about
,
sizeof
(
about
)
),
"unexpected path
\n
"
);
ok
(
uc
.
dwUrlPathLength
==
11
,
"unexpected path length
\n
"
);
ok
(
uc
.
dwUrlPathLength
==
11
,
"unexpected path length
\n
"
);
ok
(
!
memcmp
(
uc
.
lpszExtraInfo
,
query
,
sizeof
(
query
)
),
"unexpected extra info
\n
"
);
ok
(
!
memcmp
(
uc
.
lpszExtraInfo
,
query
,
sizeof
(
query
)
),
"unexpected extra info
\n
"
);
...
@@ -392,7 +392,7 @@ static void WinHttpCrackUrl_test( void )
...
@@ -392,7 +392,7 @@ static void WinHttpCrackUrl_test( void )
ok
(
uc
.
dwPasswordLength
==
8
,
"unexpected password length
\n
"
);
ok
(
uc
.
dwPasswordLength
==
8
,
"unexpected password length
\n
"
);
ok
(
uc
.
lpszHostName
==
url_k1
+
25
,
"unexpected hostname
\n
"
);
ok
(
uc
.
lpszHostName
==
url_k1
+
25
,
"unexpected hostname
\n
"
);
ok
(
uc
.
dwHostNameLength
==
14
,
"unexpected hostname length
\n
"
);
ok
(
uc
.
dwHostNameLength
==
14
,
"unexpected hostname length
\n
"
);
todo_wine
ok
(
uc
.
nPort
==
80
,
"unexpected port: %u
\n
"
,
uc
.
nPort
);
ok
(
uc
.
nPort
==
80
,
"unexpected port: %u
\n
"
,
uc
.
nPort
);
ok
(
uc
.
lpszUrlPath
==
url_k1
+
39
,
"unexpected path
\n
"
);
ok
(
uc
.
lpszUrlPath
==
url_k1
+
39
,
"unexpected path
\n
"
);
ok
(
uc
.
dwUrlPathLength
==
11
,
"unexpected path length
\n
"
);
ok
(
uc
.
dwUrlPathLength
==
11
,
"unexpected path length
\n
"
);
ok
(
uc
.
lpszExtraInfo
==
url_k1
+
50
,
"unexpected extra info
\n
"
);
ok
(
uc
.
lpszExtraInfo
==
url_k1
+
50
,
"unexpected extra info
\n
"
);
...
@@ -411,7 +411,7 @@ static void WinHttpCrackUrl_test( void )
...
@@ -411,7 +411,7 @@ static void WinHttpCrackUrl_test( void )
ok
(
uc
.
dwPasswordLength
==
0
,
"unexpected password length
\n
"
);
ok
(
uc
.
dwPasswordLength
==
0
,
"unexpected password length
\n
"
);
ok
(
uc
.
lpszHostName
==
url_k2
+
7
,
"unexpected hostname
\n
"
);
ok
(
uc
.
lpszHostName
==
url_k2
+
7
,
"unexpected hostname
\n
"
);
ok
(
uc
.
dwHostNameLength
==
14
,
"unexpected hostname length
\n
"
);
ok
(
uc
.
dwHostNameLength
==
14
,
"unexpected hostname length
\n
"
);
todo_wine
ok
(
uc
.
nPort
==
80
,
"unexpected port: %u
\n
"
,
uc
.
nPort
);
ok
(
uc
.
nPort
==
80
,
"unexpected port: %u
\n
"
,
uc
.
nPort
);
ok
(
uc
.
lpszUrlPath
==
url_k2
+
21
,
"unexpected path
\n
"
);
ok
(
uc
.
lpszUrlPath
==
url_k2
+
21
,
"unexpected path
\n
"
);
ok
(
uc
.
dwUrlPathLength
==
0
,
"unexpected path length
\n
"
);
ok
(
uc
.
dwUrlPathLength
==
0
,
"unexpected path length
\n
"
);
ok
(
uc
.
lpszExtraInfo
==
url_k2
+
21
,
"unexpected extra info
\n
"
);
ok
(
uc
.
lpszExtraInfo
==
url_k2
+
21
,
"unexpected extra info
\n
"
);
...
@@ -430,7 +430,7 @@ static void WinHttpCrackUrl_test( void )
...
@@ -430,7 +430,7 @@ static void WinHttpCrackUrl_test( void )
ok
(
uc
.
dwPasswordLength
==
0
,
"unexpected password length
\n
"
);
ok
(
uc
.
dwPasswordLength
==
0
,
"unexpected password length
\n
"
);
ok
(
uc
.
lpszHostName
==
url_k3
+
8
,
"unexpected hostname
\n
"
);
ok
(
uc
.
lpszHostName
==
url_k3
+
8
,
"unexpected hostname
\n
"
);
ok
(
uc
.
dwHostNameLength
==
14
,
"unexpected hostname length
\n
"
);
ok
(
uc
.
dwHostNameLength
==
14
,
"unexpected hostname length
\n
"
);
todo_wine
ok
(
uc
.
nPort
==
443
,
"unexpected port: %u
\n
"
,
uc
.
nPort
);
ok
(
uc
.
nPort
==
443
,
"unexpected port: %u
\n
"
,
uc
.
nPort
);
ok
(
uc
.
lpszUrlPath
==
url_k3
+
22
,
"unexpected path
\n
"
);
ok
(
uc
.
lpszUrlPath
==
url_k3
+
22
,
"unexpected path
\n
"
);
ok
(
uc
.
dwUrlPathLength
==
5
,
"unexpected path length
\n
"
);
ok
(
uc
.
dwUrlPathLength
==
5
,
"unexpected path length
\n
"
);
ok
(
uc
.
lpszExtraInfo
==
url_k3
+
27
,
"unexpected extra info
\n
"
);
ok
(
uc
.
lpszExtraInfo
==
url_k3
+
27
,
"unexpected extra info
\n
"
);
...
@@ -537,9 +537,9 @@ static void WinHttpCrackUrl_test( void )
...
@@ -537,9 +537,9 @@ static void WinHttpCrackUrl_test( void )
ret
=
WinHttpCrackUrl
(
url7
,
0
,
0
,
&
uc
);
ret
=
WinHttpCrackUrl
(
url7
,
0
,
0
,
&
uc
);
ok
(
ret
,
"WinHttpCrackUrl failed
\n
"
);
ok
(
ret
,
"WinHttpCrackUrl failed
\n
"
);
todo_wine
ok
(
!
memcmp
(
uc
.
lpszHostName
,
winehq
,
sizeof
(
winehq
)
),
"unexpected host name: %s
\n
"
,
debugstr_w
(
uc
.
lpszHostName
)
);
ok
(
!
memcmp
(
uc
.
lpszHostName
,
winehq
,
sizeof
(
winehq
)
),
"unexpected host name: %s
\n
"
,
debugstr_w
(
uc
.
lpszHostName
)
);
todo_wine
ok
(
uc
.
dwHostNameLength
==
14
,
"unexpected host name length: %d
\n
"
,
uc
.
dwHostNameLength
);
ok
(
uc
.
dwHostNameLength
==
14
,
"unexpected host name length: %d
\n
"
,
uc
.
dwHostNameLength
);
todo_wine
ok
(
uc
.
nPort
==
42
,
"unexpected port: %u
\n
"
,
uc
.
nPort
);
ok
(
uc
.
nPort
==
42
,
"unexpected port: %u
\n
"
,
uc
.
nPort
);
/* decoding without buffers */
/* decoding without buffers */
reset_url_components
(
&
uc
);
reset_url_components
(
&
uc
);
...
@@ -550,12 +550,12 @@ static void WinHttpCrackUrl_test( void )
...
@@ -550,12 +550,12 @@ static void WinHttpCrackUrl_test( void )
reset_url_components
(
&
uc
);
reset_url_components
(
&
uc
);
ret
=
WinHttpCrackUrl
(
url10
,
0
,
0
,
&
uc
);
ret
=
WinHttpCrackUrl
(
url10
,
0
,
0
,
&
uc
);
ok
(
ret
,
"WinHttpCrackUrl failed
\n
"
);
ok
(
ret
,
"WinHttpCrackUrl failed
\n
"
);
todo_wine
ok
(
uc
.
nPort
==
80
,
"unexpected port: %u
\n
"
,
uc
.
nPort
);
ok
(
uc
.
nPort
==
80
,
"unexpected port: %u
\n
"
,
uc
.
nPort
);
reset_url_components
(
&
uc
);
reset_url_components
(
&
uc
);
ret
=
WinHttpCrackUrl
(
url11
,
0
,
0
,
&
uc
);
ret
=
WinHttpCrackUrl
(
url11
,
0
,
0
,
&
uc
);
ok
(
ret
,
"WinHttpCrackUrl failed
\n
"
);
ok
(
ret
,
"WinHttpCrackUrl failed
\n
"
);
todo_wine
ok
(
uc
.
nPort
==
443
,
"unexpected port: %u
\n
"
,
uc
.
nPort
);
ok
(
uc
.
nPort
==
443
,
"unexpected port: %u
\n
"
,
uc
.
nPort
);
}
}
...
...
dlls/winhttp/url.c
View file @
4876375a
...
@@ -149,7 +149,18 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
...
@@ -149,7 +149,18 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
}
}
if
((
q
=
memchrW
(
p
,
'/'
,
len
-
(
p
-
url
)
)))
if
((
q
=
memchrW
(
p
,
'/'
,
len
-
(
p
-
url
)
)))
{
{
if
(
!
(
set_component
(
&
uc
->
lpszHostName
,
&
uc
->
dwHostNameLength
,
p
,
q
-
p
,
flags
)))
goto
exit
;
if
((
r
=
memchrW
(
p
,
':'
,
q
-
p
)))
{
if
(
!
(
set_component
(
&
uc
->
lpszHostName
,
&
uc
->
dwHostNameLength
,
p
,
r
-
p
,
flags
)))
goto
exit
;
r
++
;
uc
->
nPort
=
atoiW
(
r
);
}
else
{
if
(
!
(
set_component
(
&
uc
->
lpszHostName
,
&
uc
->
dwHostNameLength
,
p
,
q
-
p
,
flags
)))
goto
exit
;
if
(
uc
->
nScheme
==
INTERNET_SCHEME_HTTP
)
uc
->
nPort
=
INTERNET_DEFAULT_HTTP_PORT
;
if
(
uc
->
nScheme
==
INTERNET_SCHEME_HTTPS
)
uc
->
nPort
=
INTERNET_DEFAULT_HTTPS_PORT
;
}
if
((
r
=
memchrW
(
q
,
'?'
,
len
-
(
q
-
url
)
)))
if
((
r
=
memchrW
(
q
,
'?'
,
len
-
(
q
-
url
)
)))
{
{
...
@@ -164,16 +175,28 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
...
@@ -164,16 +175,28 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
}
}
else
else
{
{
if
(
!
(
set_component
(
&
uc
->
lpszHostName
,
&
uc
->
dwHostNameLength
,
p
,
len
-
(
p
-
url
),
flags
)))
goto
exit
;
if
((
r
=
memchrW
(
p
,
':'
,
len
-
(
p
-
url
)
)))
{
if
(
!
(
set_component
(
&
uc
->
lpszHostName
,
&
uc
->
dwHostNameLength
,
p
,
r
-
p
,
flags
)))
goto
exit
;
r
++
;
uc
->
nPort
=
atoiW
(
r
);
}
else
{
if
(
!
(
set_component
(
&
uc
->
lpszHostName
,
&
uc
->
dwHostNameLength
,
p
,
len
-
(
p
-
url
),
flags
)))
goto
exit
;
if
(
uc
->
nScheme
==
INTERNET_SCHEME_HTTP
)
uc
->
nPort
=
INTERNET_DEFAULT_HTTP_PORT
;
if
(
uc
->
nScheme
==
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
->
lpszUrlPath
,
&
uc
->
dwUrlPathLength
,
(
WCHAR
*
)
url
+
len
,
0
,
flags
)))
goto
exit
;
if
(
!
(
set_component
(
&
uc
->
lpszExtraInfo
,
&
uc
->
dwExtraInfoLength
,
(
WCHAR
*
)
url
+
len
,
0
,
flags
)))
goto
exit
;
if
(
!
(
set_component
(
&
uc
->
lpszExtraInfo
,
&
uc
->
dwExtraInfoLength
,
(
WCHAR
*
)
url
+
len
,
0
,
flags
)))
goto
exit
;
}
}
ret
=
TRUE
;
ret
=
TRUE
;
TRACE
(
"scheme(%s) host(%s) path(%s) extra(%s)
\n
"
,
TRACE
(
"scheme(%s) host(%s) p
ort(%d) p
ath(%s) extra(%s)
\n
"
,
debugstr_wn
(
uc
->
lpszScheme
,
uc
->
dwSchemeLength
),
debugstr_wn
(
uc
->
lpszScheme
,
uc
->
dwSchemeLength
),
debugstr_wn
(
uc
->
lpszHostName
,
uc
->
dwHostNameLength
),
debugstr_wn
(
uc
->
lpszHostName
,
uc
->
dwHostNameLength
),
uc
->
nPort
,
debugstr_wn
(
uc
->
lpszUrlPath
,
uc
->
dwUrlPathLength
),
debugstr_wn
(
uc
->
lpszUrlPath
,
uc
->
dwUrlPathLength
),
debugstr_wn
(
uc
->
lpszExtraInfo
,
uc
->
dwExtraInfoLength
));
debugstr_wn
(
uc
->
lpszExtraInfo
,
uc
->
dwExtraInfoLength
));
...
...
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