Commit 48e155ba authored by Thomas Mullaly's avatar Thomas Mullaly Committed by Alexandre Julliard

urlmon: Added parser for IPvFuture addresses.

parent 738d60c7
......@@ -1516,6 +1516,35 @@ static const uri_properties uri_tests[] = {
{URL_SCHEME_HTTP,S_OK,FALSE},
{URLZONE_INVALID,E_NOTIMPL,FALSE}
}
},
{ "http://[v2.34]/", 0, S_OK, FALSE,
Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|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,
TRUE,
{
{"http://[v2.34]/",S_OK,TRUE},
{"[v2.34]",S_OK,TRUE},
{"http://[v2.34]/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"[v2.34]",S_OK,TRUE},
{"",S_FALSE,FALSE},
{"/",S_OK,TRUE},
{"/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"http://[v2.34]/",S_OK,FALSE},
{"http",S_OK,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE}
},
{
{Uri_HOST_UNKNOWN,S_OK,TRUE},
{80,S_OK,TRUE},
{URL_SCHEME_HTTP,S_OK,FALSE},
{URLZONE_INVALID,E_NOTIMPL,FALSE}
}
}
};
......
......@@ -878,6 +878,49 @@ static BOOL parse_ipv6address(const WCHAR **ptr, parse_data *data, DWORD flags)
return TRUE;
}
/* IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) */
static BOOL parse_ipvfuture(const WCHAR **ptr, parse_data *data, DWORD flags) {
const WCHAR *start = *ptr;
/* IPvFuture has to start with a 'v' or 'V'. */
if(**ptr != 'v' && **ptr != 'V')
return FALSE;
/* Following the v their must be atleast 1 hexdigit. */
++(*ptr);
if(!is_hexdigit(**ptr)) {
*ptr = start;
return FALSE;
}
++(*ptr);
while(is_hexdigit(**ptr))
++(*ptr);
/* End of the hexdigit sequence must be a '.' */
if(**ptr != '.') {
*ptr = start;
return FALSE;
}
++(*ptr);
if(!is_unreserved(**ptr) && !is_subdelim(**ptr) && **ptr != ':') {
*ptr = start;
return FALSE;
}
++(*ptr);
while(is_unreserved(**ptr) || is_subdelim(**ptr) || **ptr == ':')
++(*ptr);
data->host_type = Uri_HOST_UNKNOWN;
TRACE("(%p %p %x): Parsed IPvFuture address %s len=%d\n", ptr, data, flags,
debugstr_wn(start, *ptr-start), *ptr-start);
return TRUE;
}
/* IP-literal = "[" ( IPv6address / IPvFuture ) "]" */
static BOOL parse_ip_literal(const WCHAR **ptr, parse_data *data, DWORD flags) {
data->host = *ptr;
......@@ -889,11 +932,11 @@ static BOOL parse_ip_literal(const WCHAR **ptr, parse_data *data, DWORD flags) {
++(*ptr);
if(!parse_ipv6address(ptr, data, flags)) {
WARN("(%p %p %x): IPvFuture addresses are not supported yet.\n",
ptr, data, flags);
*ptr = data->host;
data->host = NULL;
return FALSE;
if(!parse_ipvfuture(ptr, data, flags)) {
*ptr = data->host;
data->host = NULL;
return FALSE;
}
}
if(**ptr != ']') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment