kernelbase: Allow ports 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:
Zebediah Figura 2022-02-14 20:37:08 -06:00 committed by Alexandre Julliard
parent 4ff109c3d6
commit 0b9b73d6ef
2 changed files with 6 additions and 16 deletions

View File

@ -77,7 +77,6 @@ struct parsed_url
enum url_scan_type
{
SCHEME,
PORT,
USERPASS,
};
@ -4212,14 +4211,6 @@ static const WCHAR * scan_url(const WCHAR *start, DWORD *size, enum url_scan_typ
}
break;
case PORT:
while (*start >= '0' && *start <= '9')
{
start++;
(*size)++;
}
break;
default:
FIXME("unknown type %d\n", type);
return L"";
@ -4286,10 +4277,9 @@ static LONG parse_url(const WCHAR *url, struct parsed_url *pl)
if (*work == ':')
{
/* parse port */
work++;
pl->port = work;
work = scan_url(pl->port, &pl->port_len, PORT);
pl->port = work + 1;
work = parse_url_element( pl->port, L"/\\?#" );
pl->port_len = work - pl->port;
}
if (*work == '/')
{

View File

@ -630,7 +630,7 @@ static void test_UrlGetPart(void)
{"http://localhost:port/", URL_PART_USERNAME, 0, E_INVALIDARG, .todo_hr = TRUE},
{"http://localhost:port/", URL_PART_PASSWORD, 0, E_INVALIDARG, .todo_hr = TRUE},
{"http://localhost:port/", URL_PART_HOSTNAME, 0, S_OK, "localhost"},
{"http://localhost:port/", URL_PART_PORT, 0, S_OK, "port", .todo_hr = TRUE},
{"http://localhost:port/", URL_PART_PORT, 0, S_OK, "port"},
{"http://:", URL_PART_HOSTNAME, 0, S_FALSE, ""},
{"http://:", URL_PART_PORT, 0, S_FALSE, ""},
@ -651,7 +651,7 @@ static void test_UrlGetPart(void)
{"http://:@", URL_PART_HOSTNAME, 0, S_FALSE, ""},
{"http://host:port:q", URL_PART_HOSTNAME, 0, S_OK, "host"},
{"http://host:port:q", URL_PART_PORT, 0, S_OK, "port:q", .todo_hr = TRUE},
{"http://host:port:q", URL_PART_PORT, 0, S_OK, "port:q"},
{"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"},
@ -678,7 +678,7 @@ static void test_UrlGetPart(void)
{"http:// !\"$%&'()*+,-.;<=>[]^_`{|~}\x01\x7f\xff:pass@host", URL_PART_USERNAME, 0, S_OK, " !\"$%&'()*+,-.;<=>[]^_`{|~}\x01\x7f\xff", .todo_hr = TRUE},
{"http://user: !\"$%&'()*+,-.;<=>[]^_`{|~}\x01\x7f\xff@host", URL_PART_PASSWORD, 0, S_OK, " !\"$%&'()*+,-.;<=>[]^_`{|~}\x01\x7f\xff", .todo_hr = TRUE},
{"http:// !\"$%&'()*+,-.;<=>[]^_`{|~}\x01\x7f\xff", URL_PART_HOSTNAME, 0, S_OK, " !\"$%&'()*+,-.;<=>[]^_`{|~}\x01\x7f\xff", .todo_hr = TRUE},
{"http://host: !\"$%&'()*+,-.;<=>[]^_`{|~}\x01\x7f\xff", URL_PART_PORT, 0, S_OK, " !\"$%&'()*+,-.;<=>[]^_`{|~}\x01\x7f\xff", .todo_hr = TRUE},
{"http://host: !\"$%&'()*+,-.;<=>[]^_`{|~}\x01\x7f\xff", URL_PART_PORT, 0, S_OK, " !\"$%&'()*+,-.;<=>[]^_`{|~}\x01\x7f\xff"},
{"http:///index.html", URL_PART_HOSTNAME, 0, S_FALSE, ""},
{"http:///index.html", URL_PART_HOSTNAME, URL_PARTFLAG_KEEPSCHEME, S_OK, "http:", .todo_hr = TRUE},