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
70843e4f
Commit
70843e4f
authored
Sep 22, 2010
by
Thomas Mullaly
Committed by
Alexandre Julliard
Sep 28, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
urlmon: Finished validation for the remaining components of a IUriBuilder.
parent
7e292893
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
143 additions
and
2 deletions
+143
-2
uri.c
dlls/urlmon/tests/uri.c
+27
-0
uri.c
dlls/urlmon/uri.c
+116
-2
No files found.
dlls/urlmon/tests/uri.c
View file @
70843e4f
...
...
@@ -5361,6 +5361,33 @@ static const uri_builder_test uri_builder_tests[] = {
{
URL_SCHEME_HTTP
,
S_OK
},
{
URLZONE_INVALID
,
E_NOTIMPL
}
}
},
{
"http://google.com/"
,
0
,
S_OK
,
FALSE
,
{
{
TRUE
,
"/path?query"
,
NULL
,
Uri_PROPERTY_PATH
,
S_OK
,
FALSE
}
},
{
FALSE
},
0
,
INET_E_INVALID_URL
,
FALSE
,
0
,
INET_E_INVALID_URL
,
FALSE
,
0
,
0
,
0
,
INET_E_INVALID_URL
,
FALSE
},
{
"http://google.com/"
,
0
,
S_OK
,
FALSE
,
{
{
TRUE
,
"/path#test"
,
NULL
,
Uri_PROPERTY_PATH
,
S_OK
,
FALSE
}
},
{
FALSE
},
0
,
INET_E_INVALID_URL
,
FALSE
,
0
,
INET_E_INVALID_URL
,
FALSE
,
0
,
0
,
0
,
INET_E_INVALID_URL
,
FALSE
},
{
"http://google.com/"
,
0
,
S_OK
,
FALSE
,
{
{
TRUE
,
"?path#test"
,
NULL
,
Uri_PROPERTY_QUERY
,
S_OK
,
FALSE
}
},
{
FALSE
},
0
,
INET_E_INVALID_URL
,
FALSE
,
0
,
INET_E_INVALID_URL
,
FALSE
,
0
,
0
,
0
,
INET_E_INVALID_URL
,
FALSE
}
};
...
...
dlls/urlmon/uri.c
View file @
70843e4f
...
...
@@ -3713,6 +3713,106 @@ static void setup_port(const UriBuilder *builder, parse_data *data, DWORD flags)
TRACE
(
"(%p %p %x): Using %u as port for IUri.
\n
"
,
builder
,
data
,
flags
,
data
->
port_value
);
}
static
HRESULT
validate_path
(
const
UriBuilder
*
builder
,
parse_data
*
data
,
DWORD
flags
)
{
const
WCHAR
*
ptr
=
NULL
;
const
WCHAR
**
pptr
;
DWORD
expected_len
;
if
(
builder
->
path
)
{
ptr
=
builder
->
path
;
expected_len
=
builder
->
path_len
;
}
else
if
(
!
(
builder
->
modified_props
&
Uri_HAS_PATH
)
&&
builder
->
uri
&&
builder
->
uri
->
path_start
>
-
1
)
{
ptr
=
builder
->
uri
->
canon_uri
+
builder
->
uri
->
path_start
;
expected_len
=
builder
->
uri
->
path_len
;
}
if
(
ptr
)
{
BOOL
valid
=
FALSE
;
const
WCHAR
*
component
=
ptr
;
pptr
=
&
ptr
;
/* How the path is validated depends on what type of
* URI it is.
*/
valid
=
data
->
is_opaque
?
parse_path_opaque
(
pptr
,
data
,
flags
)
:
parse_path_hierarchical
(
pptr
,
data
,
flags
);
if
(
!
valid
||
expected_len
!=
data
->
path_len
)
{
TRACE
(
"(%p %p %x): Invalid path componet %s.
\n
"
,
builder
,
data
,
flags
,
debugstr_wn
(
component
,
expected_len
));
return
INET_E_INVALID_URL
;
}
TRACE
(
"(%p %p %x): Valid path component %s len=%d.
\n
"
,
builder
,
data
,
flags
,
debugstr_wn
(
data
->
path
,
data
->
path_len
),
data
->
path_len
);
}
return
S_OK
;
}
static
HRESULT
validate_query
(
const
UriBuilder
*
builder
,
parse_data
*
data
,
DWORD
flags
)
{
const
WCHAR
*
ptr
=
NULL
;
const
WCHAR
**
pptr
;
DWORD
expected_len
;
if
(
builder
->
query
)
{
ptr
=
builder
->
query
;
expected_len
=
builder
->
query_len
;
}
else
if
(
!
(
builder
->
modified_props
&
Uri_HAS_QUERY
)
&&
builder
->
uri
&&
builder
->
uri
->
query_start
>
-
1
)
{
ptr
=
builder
->
uri
->
canon_uri
+
builder
->
uri
->
query_start
;
expected_len
=
builder
->
uri
->
query_len
;
}
if
(
ptr
)
{
const
WCHAR
*
component
=
ptr
;
pptr
=
&
ptr
;
if
(
parse_query
(
pptr
,
data
,
flags
)
&&
expected_len
==
data
->
query_len
)
TRACE
(
"(%p %p %x): Valid query component %s len=%d.
\n
"
,
builder
,
data
,
flags
,
debugstr_wn
(
data
->
query
,
data
->
query_len
),
data
->
query_len
);
else
{
TRACE
(
"(%p %p %x): Invalid query component %s.
\n
"
,
builder
,
data
,
flags
,
debugstr_wn
(
component
,
expected_len
));
return
INET_E_INVALID_URL
;
}
}
return
S_OK
;
}
static
HRESULT
validate_fragment
(
const
UriBuilder
*
builder
,
parse_data
*
data
,
DWORD
flags
)
{
const
WCHAR
*
ptr
=
NULL
;
const
WCHAR
**
pptr
;
DWORD
expected_len
;
if
(
builder
->
fragment
)
{
ptr
=
builder
->
fragment
;
expected_len
=
builder
->
fragment_len
;
}
else
if
(
!
(
builder
->
modified_props
&
Uri_HAS_FRAGMENT
)
&&
builder
->
uri
&&
builder
->
uri
->
fragment_start
>
-
1
)
{
ptr
=
builder
->
uri
->
canon_uri
+
builder
->
uri
->
fragment_start
;
expected_len
=
builder
->
uri
->
fragment_len
;
}
if
(
ptr
)
{
const
WCHAR
*
component
=
ptr
;
pptr
=
&
ptr
;
if
(
parse_query
(
pptr
,
data
,
flags
)
&&
expected_len
==
data
->
fragment_len
)
TRACE
(
"(%p %p %x): Valid fragment component %s len=%d.
\n
"
,
builder
,
data
,
flags
,
debugstr_wn
(
data
->
fragment
,
data
->
fragment_len
),
data
->
fragment_len
);
else
{
TRACE
(
"(%p %p %x): Invalid fragment component %s.
\n
"
,
builder
,
data
,
flags
,
debugstr_wn
(
component
,
expected_len
));
return
INET_E_INVALID_URL
;
}
}
return
S_OK
;
}
static
HRESULT
validate_components
(
const
UriBuilder
*
builder
,
parse_data
*
data
,
DWORD
flags
)
{
HRESULT
hr
;
...
...
@@ -3747,7 +3847,21 @@ static HRESULT validate_components(const UriBuilder *builder, parse_data *data,
setup_port
(
builder
,
data
,
flags
);
return
E_NOTIMPL
;
hr
=
validate_path
(
builder
,
data
,
flags
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
validate_query
(
builder
,
data
,
flags
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
validate_fragment
(
builder
,
data
,
flags
);
if
(
FAILED
(
hr
))
return
hr
;
TRACE
(
"(%p %p %x): Finished validating builder components.
\n
"
,
builder
,
data
,
flags
);
return
S_OK
;
}
static
HRESULT
build_uri
(
const
UriBuilder
*
builder
,
IUri
**
uri
,
DWORD
create_flags
,
...
...
@@ -3790,7 +3904,7 @@ static HRESULT build_uri(const UriBuilder *builder, IUri **uri, DWORD create_fla
return
hr
;
}
return
S_OK
;
return
E_NOTIMPL
;
}
#define URI_THIS(iface) DEFINE_THIS(Uri, IUri, iface)
...
...
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