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
d6c0e815
Commit
d6c0e815
authored
Dec 31, 2012
by
Andrew Eikum
Committed by
Alexandre Julliard
Jan 02, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Fail on URLs without a scheme.
parent
00b6d8eb
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
19 deletions
+30
-19
internet.c
dlls/wininet/internet.c
+9
-15
internet.c
dlls/wininet/tests/internet.c
+0
-2
url.c
dlls/wininet/tests/url.c
+21
-2
No files found.
dlls/wininet/internet.c
View file @
d6c0e815
...
...
@@ -1647,9 +1647,9 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
*
*/
LPCWSTR
lpszParam
=
NULL
;
BOOL
bIsAbsolute
=
FALSE
;
BOOL
found_colon
=
FALSE
;
LPCWSTR
lpszap
,
lpszUrl
=
lpszUrl_orig
;
LPCWSTR
lpszcp
=
NULL
;
LPCWSTR
lpszcp
=
NULL
,
lpszNetLoc
;
LPWSTR
lpszUrl_decode
=
NULL
;
DWORD
dwUrlLength
=
dwUrlLength_orig
;
...
...
@@ -1699,9 +1699,9 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
lpszap
++
;
continue
;
}
if
(
(
*
lpszap
==
':'
)
&&
(
lpszap
-
lpszUrl
>=
2
)
)
if
(
*
lpszap
==
':'
)
{
bIsAbsolute
=
TRUE
;
found_colon
=
TRUE
;
lpszcp
=
lpszap
;
}
else
...
...
@@ -1712,6 +1712,11 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
break
;
}
if
(
!
found_colon
){
SetLastError
(
ERROR_INTERNET_UNRECOGNIZED_SCHEME
);
return
0
;
}
lpUC
->
nScheme
=
INTERNET_SCHEME_UNKNOWN
;
lpUC
->
nPort
=
INTERNET_INVALID_PORT_NUMBER
;
...
...
@@ -1723,9 +1728,6 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
SetUrlComponentValueW
(
&
lpUC
->
lpszExtraInfo
,
&
lpUC
->
dwExtraInfoLength
,
lpszParam
,
lpszParam
?
dwUrlLength
-
(
lpszParam
-
lpszUrl
)
:
0
);
if
(
bIsAbsolute
)
/* Parse <protocol>:[//<net_loc>] */
{
LPCWSTR
lpszNetLoc
;
/* Get scheme first. */
lpUC
->
nScheme
=
GetInternetSchemeW
(
lpszUrl
,
lpszcp
-
lpszUrl
);
...
...
@@ -1855,14 +1857,6 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
SetUrlComponentValueW
(
&
lpUC
->
lpszPassword
,
&
lpUC
->
dwPasswordLength
,
NULL
,
0
);
SetUrlComponentValueW
(
&
lpUC
->
lpszHostName
,
&
lpUC
->
dwHostNameLength
,
NULL
,
0
);
}
}
else
{
SetUrlComponentValueW
(
&
lpUC
->
lpszScheme
,
&
lpUC
->
dwSchemeLength
,
NULL
,
0
);
SetUrlComponentValueW
(
&
lpUC
->
lpszUserName
,
&
lpUC
->
dwUserNameLength
,
NULL
,
0
);
SetUrlComponentValueW
(
&
lpUC
->
lpszPassword
,
&
lpUC
->
dwPasswordLength
,
NULL
,
0
);
SetUrlComponentValueW
(
&
lpUC
->
lpszHostName
,
&
lpUC
->
dwHostNameLength
,
NULL
,
0
);
}
/* Here lpszcp points to:
*
...
...
dlls/wininet/tests/internet.c
View file @
d6c0e815
...
...
@@ -655,9 +655,7 @@ static void test_null(void)
ok
(
r
==
FALSE
,
"return wrong
\n
"
);
r
=
InternetSetCookieW
(
szServer
,
NULL
,
szServer
);
todo_wine
{
ok
(
GetLastError
()
==
ERROR_INTERNET_UNRECOGNIZED_SCHEME
,
"wrong error
\n
"
);
}
ok
(
r
==
FALSE
,
"return wrong
\n
"
);
sz
=
0
;
...
...
dlls/wininet/tests/url.c
View file @
d6c0e815
...
...
@@ -160,6 +160,9 @@ static const crack_url_test_t crack_url_tests[] = {
{
"file:///C:/Program%20Files/Atmel/./Asdf.xml"
,
0
,
4
,
INTERNET_SCHEME_FILE
,
-
1
,
0
,
-
1
,
0
,
-
1
,
0
,
-
1
,
0
,
7
,
36
,
-
1
,
0
,
"file"
,
""
,
""
,
""
,
"C:
\\
Program Files
\\
Atmel
\\
.
\\
Asdf.xml"
,
""
},
{
"C:
\\
file.txt"
,
0
,
1
,
INTERNET_SCHEME_UNKNOWN
,
-
1
,
0
,
-
1
,
0
,
-
1
,
0
,
-
1
,
0
,
2
,
9
,
-
1
,
0
,
"C"
,
""
,
""
,
""
,
"
\\
file.txt"
,
""
}
};
static
const
WCHAR
*
w_str_of
(
const
char
*
str
)
...
...
@@ -541,6 +544,7 @@ static void InternetCrackUrl_test(void)
SetLastError
(
0xdeadbeef
);
urlComponents
.
dwStructSize
=
0
;
ret
=
InternetCrackUrlA
(
TEST_URL
,
0
,
0
,
&
urlComponents
);
GLE
=
GetLastError
();
ok
(
ret
==
FALSE
,
"Expected InternetCrackUrl to fail
\n
"
);
ok
(
GLE
!=
0xdeadbeef
&&
GLE
!=
ERROR_SUCCESS
,
"Expected GLE to represent a failure
\n
"
);
...
...
@@ -551,8 +555,25 @@ static void InternetCrackUrl_test(void)
SetLastError
(
0xdeadbeef
);
urlComponents
.
dwStructSize
=
sizeof
(
urlComponents
)
+
1
;
ret
=
InternetCrackUrlA
(
TEST_URL
,
0
,
0
,
&
urlComponents
);
GLE
=
GetLastError
();
ok
(
ret
==
FALSE
,
"Expected InternetCrackUrl to fail
\n
"
);
ok
(
GLE
!=
0xdeadbeef
&&
GLE
!=
ERROR_SUCCESS
,
"Expected GLE to represent a failure
\n
"
);
SetLastError
(
0xdeadbeef
);
memset
(
&
urlComponents
,
0
,
sizeof
(
urlComponents
));
urlComponents
.
dwStructSize
=
sizeof
(
urlComponents
);
ret
=
InternetCrackUrlA
(
"file.txt"
,
0
,
0
,
&
urlComponents
);
GLE
=
GetLastError
();
ok
(
ret
==
FALSE
,
"Expected InternetCrackUrl to fail
\n
"
);
ok
(
GLE
==
ERROR_INTERNET_UNRECOGNIZED_SCHEME
,
"Expected GLE to represent a failure
\n
"
);
SetLastError
(
0xdeadbeef
);
memset
(
&
urlComponents
,
0
,
sizeof
(
urlComponents
));
urlComponents
.
dwStructSize
=
sizeof
(
urlComponents
);
ret
=
InternetCrackUrlA
(
"www.winehq.org"
,
0
,
0
,
&
urlComponents
);
GLE
=
GetLastError
();
ok
(
ret
==
FALSE
,
"Expected InternetCrackUrl to fail
\n
"
);
ok
(
GLE
==
ERROR_INTERNET_UNRECOGNIZED_SCHEME
,
"Expected GLE to represent a failure
\n
"
);
}
static
void
InternetCrackUrlW_test
(
void
)
...
...
@@ -690,12 +711,10 @@ static void InternetCrackUrlW_test(void)
comp
.
dwExtraInfoLength
=
sizeof
(
extra
)
/
sizeof
(
extra
[
0
]);
r
=
InternetCrackUrlW
(
url2
,
0
,
0
,
&
comp
);
todo_wine
{
ok
(
!
r
,
"InternetCrackUrl should have failed
\n
"
);
ok
(
GetLastError
()
==
ERROR_INTERNET_UNRECOGNIZED_SCHEME
,
"InternetCrackUrl should have failed with error ERROR_INTERNET_UNRECOGNIZED_SCHEME instead of error %d
\n
"
,
GetLastError
());
}
/* Test to see whether cracking a URL without a filename initializes urlpart */
urlpart
[
0
]
=
0xba
;
...
...
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