kernelbase: Allow hostnames to contain any characters in UrlGetPart().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ef64aea701
commit
4ff109c3d6
|
@ -77,7 +77,6 @@ struct parsed_url
|
|||
enum url_scan_type
|
||||
{
|
||||
SCHEME,
|
||||
HOST,
|
||||
PORT,
|
||||
USERPASS,
|
||||
};
|
||||
|
@ -4221,14 +4220,6 @@ static const WCHAR * scan_url(const WCHAR *start, DWORD *size, enum url_scan_typ
|
|||
}
|
||||
break;
|
||||
|
||||
case HOST:
|
||||
while (isalnum(*start) || *start == '-' || *start == '.' || *start == ' ' || *start == '*')
|
||||
{
|
||||
start++;
|
||||
(*size)++;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
FIXME("unknown type %d\n", type);
|
||||
return L"";
|
||||
|
@ -4237,6 +4228,15 @@ static const WCHAR * scan_url(const WCHAR *start, DWORD *size, enum url_scan_typ
|
|||
return start;
|
||||
}
|
||||
|
||||
static const WCHAR *parse_url_element( const WCHAR *url, const WCHAR *separators )
|
||||
{
|
||||
const WCHAR *p;
|
||||
|
||||
if ((p = wcspbrk( url, separators )))
|
||||
return p;
|
||||
return url + wcslen( url );
|
||||
}
|
||||
|
||||
static LONG parse_url(const WCHAR *url, struct parsed_url *pl)
|
||||
{
|
||||
const WCHAR *work;
|
||||
|
@ -4280,10 +4280,10 @@ static LONG parse_url(const WCHAR *url, struct parsed_url *pl)
|
|||
}
|
||||
else goto ErrorExit;
|
||||
|
||||
/* now start parsing hostname or hostnumber */
|
||||
work++;
|
||||
pl->hostname = work;
|
||||
work = scan_url(pl->hostname, &pl->hostname_len, HOST);
|
||||
pl->hostname = work + 1;
|
||||
work = parse_url_element( pl->hostname, L":/\\?#" );
|
||||
pl->hostname_len = work - pl->hostname;
|
||||
|
||||
if (*work == ':')
|
||||
{
|
||||
/* parse port */
|
||||
|
|
|
@ -655,7 +655,7 @@ static void test_UrlGetPart(void)
|
|||
{"http://user:pass:q@host", URL_PART_USERNAME, 0, S_OK, "user", .todo_hr = TRUE},
|
||||
{"http://user:pass:q@host", URL_PART_PASSWORD, 0, S_OK, "pass:q", .todo_hr = TRUE},
|
||||
{"http://user@host@q", URL_PART_USERNAME, 0, S_OK, "user"},
|
||||
{"http://user@host@q", URL_PART_HOSTNAME, 0, S_OK, "host@q", .todo_result = TRUE},
|
||||
{"http://user@host@q", URL_PART_HOSTNAME, 0, S_OK, "host@q"},
|
||||
|
||||
{"http:localhost/index.html", URL_PART_HOSTNAME, 0, E_FAIL, .todo_hr = TRUE},
|
||||
{"http:/localhost/index.html", URL_PART_HOSTNAME, 0, E_FAIL, .todo_hr = TRUE},
|
||||
|
|
Loading…
Reference in New Issue