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
b3ad7469
Commit
b3ad7469
authored
Aug 01, 2010
by
Thomas Mullaly
Committed by
Alexandre Julliard
Aug 17, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
urlmon: Added support for pre-processing URI strings.
parent
3c59b9c6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
165 additions
and
3 deletions
+165
-3
uri.c
dlls/urlmon/tests/uri.c
+120
-1
uri.c
dlls/urlmon/uri.c
+45
-2
No files found.
dlls/urlmon/tests/uri.c
View file @
b3ad7469
...
...
@@ -3430,6 +3430,123 @@ static const uri_properties uri_tests[] = {
{
URL_SCHEME_HTTP
,
S_OK
,
FALSE
},
{
URLZONE_INVALID
,
E_NOTIMPL
,
FALSE
},
}
},
/* Leading/Trailing whitespace is removed. */
{
" http://google.com/ "
,
0
,
S_OK
,
FALSE
,
Uri_HAS_ABSOLUTE_URI
|
Uri_HAS_AUTHORITY
|
Uri_HAS_DISPLAY_URI
|
Uri_HAS_DOMAIN
|
Uri_HAS_HOST
|
Uri_HAS_PATH
|
Uri_HAS_PATH_AND_QUERY
|
Uri_HAS_RAW_URI
|
Uri_HAS_SCHEME_NAME
|
Uri_HAS_HOST_TYPE
|
Uri_HAS_PORT
|
Uri_HAS_SCHEME
,
FALSE
,
{
{
"http://google.com/"
,
S_OK
,
FALSE
},
{
"google.com"
,
S_OK
,
FALSE
},
{
"http://google.com/"
,
S_OK
,
FALSE
},
{
"google.com"
,
S_OK
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
},
{
"google.com"
,
S_OK
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
},
{
"/"
,
S_OK
,
FALSE
},
{
"/"
,
S_OK
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
},
{
"http://google.com/"
,
S_OK
,
FALSE
},
{
"http"
,
S_OK
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
}
},
{
{
Uri_HOST_DNS
,
S_OK
,
FALSE
},
{
80
,
S_OK
,
FALSE
},
{
URL_SCHEME_HTTP
,
S_OK
,
FALSE
},
{
URLZONE_INVALID
,
E_NOTIMPL
,
FALSE
}
}
},
{
"
\t\t\r\n
http
\n
://g
\n
oogle.co
\r
m/
\n\n\n
"
,
0
,
S_OK
,
FALSE
,
Uri_HAS_ABSOLUTE_URI
|
Uri_HAS_AUTHORITY
|
Uri_HAS_DISPLAY_URI
|
Uri_HAS_DOMAIN
|
Uri_HAS_HOST
|
Uri_HAS_PATH
|
Uri_HAS_PATH_AND_QUERY
|
Uri_HAS_RAW_URI
|
Uri_HAS_SCHEME_NAME
|
Uri_HAS_HOST_TYPE
|
Uri_HAS_PORT
|
Uri_HAS_SCHEME
,
FALSE
,
{
{
"http://google.com/"
,
S_OK
,
FALSE
},
{
"google.com"
,
S_OK
,
FALSE
},
{
"http://google.com/"
,
S_OK
,
FALSE
},
{
"google.com"
,
S_OK
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
},
{
"google.com"
,
S_OK
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
},
{
"/"
,
S_OK
,
FALSE
},
{
"/"
,
S_OK
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
},
{
"http://google.com/"
,
S_OK
,
FALSE
},
{
"http"
,
S_OK
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
}
},
{
{
Uri_HOST_DNS
,
S_OK
,
FALSE
},
{
80
,
S_OK
,
FALSE
},
{
URL_SCHEME_HTTP
,
S_OK
,
FALSE
},
{
URLZONE_INVALID
,
E_NOTIMPL
,
FALSE
}
}
},
{
"http://g
\n
oogle.co
\r
m/
\n\n\n
"
,
Uri_CREATE_NO_PRE_PROCESS_HTML_URI
,
S_OK
,
FALSE
,
Uri_HAS_ABSOLUTE_URI
|
Uri_HAS_AUTHORITY
|
Uri_HAS_DISPLAY_URI
|
Uri_HAS_DOMAIN
|
Uri_HAS_HOST
|
Uri_HAS_PATH
|
Uri_HAS_PATH_AND_QUERY
|
Uri_HAS_RAW_URI
|
Uri_HAS_SCHEME_NAME
|
Uri_HAS_HOST_TYPE
|
Uri_HAS_PORT
|
Uri_HAS_SCHEME
,
FALSE
,
{
{
"http://g%0aoogle.co%0dm/%0A%0A%0A"
,
S_OK
,
FALSE
},
{
"g%0aoogle.co%0dm"
,
S_OK
,
FALSE
},
{
"http://g%0aoogle.co%0dm/%0A%0A%0A"
,
S_OK
,
FALSE
},
{
"g%0aoogle.co%0dm"
,
S_OK
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
},
{
"g%0aoogle.co%0dm"
,
S_OK
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
},
{
"/%0A%0A%0A"
,
S_OK
,
FALSE
},
{
"/%0A%0A%0A"
,
S_OK
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
},
{
"http://g
\n
oogle.co
\r
m/
\n\n\n
"
,
S_OK
,
FALSE
},
{
"http"
,
S_OK
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
}
},
{
{
Uri_HOST_DNS
,
S_OK
,
FALSE
},
{
80
,
S_OK
,
FALSE
},
{
URL_SCHEME_HTTP
,
S_OK
,
FALSE
},
{
URLZONE_INVALID
,
E_NOTIMPL
,
FALSE
}
}
},
{
"zip://g
\n
oogle.co
\r
m/
\n\n\n
"
,
Uri_CREATE_NO_PRE_PROCESS_HTML_URI
,
S_OK
,
FALSE
,
Uri_HAS_ABSOLUTE_URI
|
Uri_HAS_AUTHORITY
|
Uri_HAS_DISPLAY_URI
|
Uri_HAS_DOMAIN
|
Uri_HAS_HOST
|
Uri_HAS_PATH
|
Uri_HAS_PATH_AND_QUERY
|
Uri_HAS_RAW_URI
|
Uri_HAS_SCHEME_NAME
|
Uri_HAS_HOST_TYPE
|
Uri_HAS_SCHEME
,
FALSE
,
{
{
"zip://g
\n
oogle.co
\r
m/
\n\n\n
"
,
S_OK
,
FALSE
},
{
"g
\n
oogle.co
\r
m"
,
S_OK
,
FALSE
},
{
"zip://g
\n
oogle.co
\r
m/
\n\n\n
"
,
S_OK
,
FALSE
},
{
"g
\n
oogle.co
\r
m"
,
S_OK
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
},
{
"g
\n
oogle.co
\r
m"
,
S_OK
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
},
{
"/
\n\n\n
"
,
S_OK
,
FALSE
},
{
"/
\n\n\n
"
,
S_OK
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
},
{
"zip://g
\n
oogle.co
\r
m/
\n\n\n
"
,
S_OK
,
FALSE
},
{
"zip"
,
S_OK
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
},
{
""
,
S_FALSE
,
FALSE
}
},
{
{
Uri_HOST_DNS
,
S_OK
,
FALSE
},
{
0
,
S_FALSE
,
FALSE
},
{
URL_SCHEME_UNKNOWN
,
S_OK
,
FALSE
},
{
URLZONE_INVALID
,
E_NOTIMPL
,
FALSE
}
}
}
};
...
...
@@ -3486,7 +3603,9 @@ static const invalid_uri invalid_uri_tests[] = {
/* Known scheme types can't have invalid % encoded data in query string. */
{
"http://google.com/?query=te%xx"
,
0
,
FALSE
},
/* Invalid % encoded data in fragment of know scheme type. */
{
"ftp://google.com/#Test%xx"
,
0
,
FALSE
}
{
"ftp://google.com/#Test%xx"
,
0
,
FALSE
},
{
" http://google.com/"
,
Uri_CREATE_NO_PRE_PROCESS_HTML_URI
,
FALSE
},
{
"
\n\n
http://google.com/"
,
Uri_CREATE_NO_PRE_PROCESS_HTML_URI
,
FALSE
}
};
typedef
struct
_uri_equality
{
...
...
dlls/urlmon/uri.c
View file @
b3ad7469
...
...
@@ -626,6 +626,45 @@ static void compute_elision_location(const ipv6_address *address, const USHORT v
*
count
=
max_len
;
}
/* Removes all the leading and trailing white spaces or
* control characters from the URI and removes all control
* characters inside of the URI string.
*/
static
BSTR
pre_process_uri
(
LPCWSTR
uri
)
{
BSTR
ret
;
DWORD
len
;
const
WCHAR
*
start
,
*
end
;
WCHAR
*
buf
,
*
ptr
;
len
=
lstrlenW
(
uri
);
start
=
uri
;
/* Skip leading controls and whitespace. */
while
(
iscntrlW
(
*
start
)
||
isspaceW
(
*
start
))
++
start
;
end
=
uri
+
len
-
1
;
if
(
start
==
end
)
/* URI consisted only of control/whitespace. */
ret
=
SysAllocStringLen
(
NULL
,
0
);
else
{
while
(
iscntrlW
(
*
end
)
||
isspaceW
(
*
end
))
--
end
;
buf
=
heap_alloc
(((
end
+
1
)
-
start
)
*
sizeof
(
WCHAR
));
if
(
!
buf
)
return
NULL
;
for
(
ptr
=
buf
;
start
<
end
+
1
;
++
start
)
{
if
(
!
iscntrlW
(
*
start
))
*
ptr
++
=
*
start
;
}
ret
=
SysAllocStringLen
(
buf
,
ptr
-
buf
);
heap_free
(
buf
);
}
return
ret
;
}
/* Converts the specified IPv4 address into an uint value.
*
* This function assumes that the IPv4 address has already been validated.
...
...
@@ -3729,8 +3768,12 @@ HRESULT WINAPI CreateUri(LPCWSTR pwzURI, DWORD dwFlags, DWORD_PTR dwReserved, IU
ret
->
lpIUriVtbl
=
&
UriVtbl
;
ret
->
ref
=
1
;
/* Create a copy of pwzURI and store it as the raw_uri. */
ret
->
raw_uri
=
SysAllocString
(
pwzURI
);
/* Pre process the URI, unless told otherwise. */
if
(
!
(
dwFlags
&
Uri_CREATE_NO_PRE_PROCESS_HTML_URI
))
ret
->
raw_uri
=
pre_process_uri
(
pwzURI
);
else
ret
->
raw_uri
=
SysAllocString
(
pwzURI
);
if
(
!
ret
->
raw_uri
)
{
heap_free
(
ret
);
return
E_OUTOFMEMORY
;
...
...
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