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
c5fa3ec2
Commit
c5fa3ec2
authored
Jan 05, 2009
by
Hans Leidekker
Committed by
Alexandre Julliard
Jan 05, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Set last error for invalid URLs passed to WinHttpCrackUrl.
parent
d1d0e335
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
5 deletions
+24
-5
url.c
dlls/winhttp/tests/url.c
+13
-0
url.c
dlls/winhttp/url.c
+11
-5
No files found.
dlls/winhttp/tests/url.c
View file @
c5fa3ec2
...
...
@@ -557,6 +557,19 @@ static void WinHttpCrackUrl_test( void )
ok
(
ret
,
"WinHttpCrackUrl failed
\n
"
);
ok
(
uc
.
nPort
==
443
,
"unexpected port: %u
\n
"
,
uc
.
nPort
);
reset_url_components
(
&
uc
);
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpCrackUrl
(
empty
,
0
,
0
,
&
uc
);
error
=
GetLastError
();
ok
(
!
ret
,
"WinHttpCrackUrl succeeded
\n
"
);
ok
(
error
==
ERROR_WINHTTP_UNRECOGNIZED_SCHEME
,
"got %u, expected ERROR_WINHTTP_UNRECOGNIZED_SCHEME
\n
"
,
error
);
reset_url_components
(
&
uc
);
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpCrackUrl
(
http
,
0
,
0
,
&
uc
);
error
=
GetLastError
();
ok
(
!
ret
,
"WinHttpCrackUrl succeeded
\n
"
);
ok
(
error
==
ERROR_WINHTTP_UNRECOGNIZED_SCHEME
,
"got %u, expected ERROR_WINHTTP_UNRECOGNIZED_SCHEME
\n
"
,
error
);
}
START_TEST
(
url
)
...
...
dlls/winhttp/url.c
View file @
c5fa3ec2
...
...
@@ -82,7 +82,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
if
(
flags
&
ICU_ESCAPE
)
FIXME
(
"flag ICU_ESCAPE not supported
\n
"
);
if
(
!
url
||
!
u
rl
[
0
]
||
!
u
c
||
uc
->
dwStructSize
!=
sizeof
(
URL_COMPONENTS
))
if
(
!
url
||
!
uc
||
uc
->
dwStructSize
!=
sizeof
(
URL_COMPONENTS
))
{
set_last_error
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
...
...
@@ -114,12 +114,18 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
}
HeapFree
(
GetProcessHeap
(),
0
,
url_tmp
);
}
if
(
!
(
p
=
strchrW
(
url
,
':'
)))
return
FALSE
;
if
(
!
(
p
=
strchrW
(
url
,
':'
)))
{
set_last_error
(
ERROR_WINHTTP_UNRECOGNIZED_SCHEME
);
return
FALSE
;
}
if
(
p
-
url
==
4
&&
!
strncmpiW
(
url
,
scheme_http
,
4
))
uc
->
nScheme
=
INTERNET_SCHEME_HTTP
;
else
if
(
p
-
url
==
5
&&
!
strncmpiW
(
url
,
scheme_https
,
5
))
uc
->
nScheme
=
INTERNET_SCHEME_HTTPS
;
else
goto
exit
;
else
{
set_last_error
(
ERROR_WINHTTP_UNRECOGNIZED_SCHEME
);
goto
exit
;
}
if
(
!
(
set_component
(
&
uc
->
lpszScheme
,
&
uc
->
dwSchemeLength
,
(
WCHAR
*
)
url
,
p
-
url
,
flags
)))
goto
exit
;
p
++
;
/* skip ':' */
...
...
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