-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Host Parsing of IPv6-URI with port #3
Comments
Even further, if you have an "Non-Domain-Name IPv6 Host URI with Port" thats last segment is fully numeric it gets mistakenly interpreted its last segment as port. var_dump(new \Zend\Uri\Uri('http://2001:0db8:0000:85a3:0000:0000:ac1f:8001/foo'));
/*
object(Zend\Uri\Uri)#3 (8) {
["scheme":protected]=>
string(4) "http"
["host":protected]=>
--> string(34) "2001:0db8:0000:85a3:0000:0000:ac1f"// missing :8001
["port":protected]=>
--> int(8001) // no port given
["path":protected]=>
string(4) "/foo"
["validHostTypes":protected]=>
int(31)
(...)
}
*/ This - I would call it bug - also happens using the stdlib function var_dump(parse_url('http://2001:0db8:0000:85a3:0000:0000:ac1f:8001/foo'));
/*
array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
--> string(34) "2001:0db8:0000:85a3:0000:0000:ac1f" // missing :8001
["port"]=>
--> int(8001) // no port given
["path"]=>
string(4) "/foo"
}
*/ Originally posted by @kronthto at zendframework/zend-uri#12 (comment) |
|
Hi,
As you probably know IPv6 addresses with ports are wrapped in square brackets (because the colon sign also appears in the IP address itself).
These brackets are not treated (removed) in any way currently, what leads to an behaviour I didn't expect.
I'd expect
getHost()
to return only the IP address, without brackets, as the port is stored seperately and obtainable viagetPort()
.Consider this example:
Is this intended behaviour, though, or just not yet adjusted to IPv6?
Originally posted by @kronthto at zendframework/zend-uri#12
The text was updated successfully, but these errors were encountered: