Closed ltrk2 closed 6 months ago
Currently, parse_url doesn't support cases such as these at all (ie. all fields come back empty):
parse_url
print parse_url("mailto:John.Doe@example.com");
print parse_url("news:comp.infosystems.www.servers.unix");
print parse_url("tel:+1-816-555-1212");
print parse_url("urn:oasis:names:specification:docbook:dtd:xml:4.1.2");
I'd consider the following cases bugs:
print parse_url("https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top");
{"Scheme":"https","Host":"john.doe@www.example.com","Port":"123","Path":"/forum/questions/","Username":"","Password":"","Query Parameters":{"order":"newest","tag":"networking"},"Fragment":"top"}
{"Scheme":"https","Host":"www.example.com","Port":"123","Path":"/forum/questions/","Username":"john.doe","Password":"","Query Parameters":{"order":"newest","tag":"networking"},"Fragment":"top"}
print parse_url("ldap://[2001:db8::7]/c=GB?objectClass?one");
{"Scheme":"ldap","Host":"[2001:db8:","Port":"7]","Path":"/c=GB","Username":"","Password":"","Query Parameters":{},"Fragment":""}
{"Scheme":"ldap","Host":"2001:db8::7","Port":"","Path":"/c=GB","Username":"","Password":"","Query Parameters":{"objectClass":"","one":""},"Fragment":""}
The examples above were taken from https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Example_URIs.
Is parse_url meant to be compliant with RFC 3986? If not, would it be possible to clarify what cases are meant to be supported?
Currently,
parse_url
doesn't support cases such as these at all (ie. all fields come back empty):print parse_url("mailto:John.Doe@example.com");
print parse_url("news:comp.infosystems.www.servers.unix");
print parse_url("tel:+1-816-555-1212");
print parse_url("urn:oasis:names:specification:docbook:dtd:xml:4.1.2");
I'd consider the following cases bugs:
print parse_url("https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top");
Actual{"Scheme":"https","Host":"john.doe@www.example.com","Port":"123","Path":"/forum/questions/","Username":"","Password":"","Query Parameters":{"order":"newest","tag":"networking"},"Fragment":"top"}
Expected{"Scheme":"https","Host":"www.example.com","Port":"123","Path":"/forum/questions/","Username":"john.doe","Password":"","Query Parameters":{"order":"newest","tag":"networking"},"Fragment":"top"}
print parse_url("ldap://[2001:db8::7]/c=GB?objectClass?one");
Actual{"Scheme":"ldap","Host":"[2001:db8:","Port":"7]","Path":"/c=GB","Username":"","Password":"","Query Parameters":{},"Fragment":""}
Expected{"Scheme":"ldap","Host":"2001:db8::7","Port":"","Path":"/c=GB","Username":"","Password":"","Query Parameters":{"objectClass":"","one":""},"Fragment":""}
The examples above were taken from https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Example_URIs.
Is
parse_url
meant to be compliant with RFC 3986? If not, would it be possible to clarify what cases are meant to be supported?