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
004e1be6
Commit
004e1be6
authored
Jul 29, 2010
by
Thomas Mullaly
Committed by
Alexandre Julliard
Aug 16, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
urlmon: Implemented canonicalization for URI fragments.
parent
27ec56ea
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
304 additions
and
0 deletions
+304
-0
uri.c
dlls/urlmon/tests/uri.c
+240
-0
uri.c
dlls/urlmon/uri.c
+64
-0
No files found.
dlls/urlmon/tests/uri.c
View file @
004e1be6
This diff is collapsed.
Click to expand it.
dlls/urlmon/uri.c
View file @
004e1be6
...
...
@@ -65,6 +65,9 @@ typedef struct {
INT
query_start
;
DWORD
query_len
;
INT
fragment_start
;
DWORD
fragment_len
;
}
Uri
;
typedef
struct
{
...
...
@@ -2749,6 +2752,56 @@ static BOOL canonicalize_query(const parse_data *data, Uri *uri, DWORD flags, BO
return
TRUE
;
}
static
BOOL
canonicalize_fragment
(
const
parse_data
*
data
,
Uri
*
uri
,
DWORD
flags
,
BOOL
computeOnly
)
{
const
WCHAR
*
ptr
,
*
end
;
const
BOOL
known_scheme
=
data
->
scheme_type
!=
URL_SCHEME_UNKNOWN
;
if
(
!
data
->
fragment
)
{
uri
->
fragment_start
=
-
1
;
uri
->
fragment_len
=
0
;
return
TRUE
;
}
uri
->
fragment_start
=
uri
->
canon_len
;
end
=
data
->
fragment
+
data
->
fragment_len
;
for
(
ptr
=
data
->
fragment
;
ptr
<
end
;
++
ptr
)
{
if
(
*
ptr
==
'%'
)
{
if
(
known_scheme
&&
!
(
flags
&
Uri_CREATE_NO_DECODE_EXTRA_INFO
))
{
WCHAR
val
=
decode_pct_val
(
ptr
);
if
(
is_unreserved
(
val
))
{
if
(
!
computeOnly
)
uri
->
canon_uri
[
uri
->
canon_len
]
=
val
;
++
uri
->
canon_len
;
ptr
+=
2
;
continue
;
}
}
}
else
if
(
known_scheme
&&
!
is_unreserved
(
*
ptr
)
&&
!
is_reserved
(
*
ptr
))
{
if
(
!
(
flags
&
Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
)
&&
!
(
flags
&
Uri_CREATE_NO_DECODE_EXTRA_INFO
))
{
if
(
!
computeOnly
)
pct_encode_val
(
*
ptr
,
uri
->
canon_uri
+
uri
->
canon_len
);
uri
->
canon_len
+=
3
;
continue
;
}
}
if
(
!
computeOnly
)
uri
->
canon_uri
[
uri
->
canon_len
]
=
*
ptr
;
++
uri
->
canon_len
;
}
uri
->
fragment_len
=
uri
->
canon_len
-
uri
->
fragment_start
;
if
(
!
computeOnly
)
TRACE
(
"(%p %p %x %d): Canonicalized fragment %s len=%d
\n
"
,
data
,
uri
,
flags
,
computeOnly
,
debugstr_wn
(
uri
->
canon_uri
+
uri
->
fragment_start
,
uri
->
fragment_len
),
uri
->
fragment_len
);
return
TRUE
;
}
/* Canonicalizes the scheme information specified in the parse_data using the specified flags. */
static
BOOL
canonicalize_scheme
(
const
parse_data
*
data
,
Uri
*
uri
,
DWORD
flags
,
BOOL
computeOnly
)
{
uri
->
scheme_start
=
-
1
;
...
...
@@ -2816,6 +2869,11 @@ static int compute_canonicalized_length(const parse_data *data, DWORD flags) {
return
-
1
;
}
if
(
!
canonicalize_fragment
(
data
,
&
uri
,
flags
,
TRUE
))
{
ERR
(
"(%p %x): Failed to compute fragment length.
\n
"
,
data
,
flags
);
return
-
1
;
}
TRACE
(
"(%p %x): Finished computing canonicalized URI length. length=%d
\n
"
,
data
,
flags
,
uri
.
canon_len
);
return
uri
.
canon_len
;
...
...
@@ -2869,6 +2927,12 @@ static HRESULT canonicalize_uri(const parse_data *data, Uri *uri, DWORD flags) {
return
E_INVALIDARG
;
}
if
(
!
canonicalize_fragment
(
data
,
uri
,
flags
,
FALSE
))
{
ERR
(
"(%p %p %x): Unable to canonicalize fragment of the URI.
\n
"
,
data
,
uri
,
flags
);
return
E_INVALIDARG
;
}
/* There's a possibility we didn't use all the space we allocated
* earlier.
*/
...
...
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