-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fixes #5079 - :authority header for IPv6 address not having square br… #5128
Conversation
…ackets. On the client: * Origin.Address.host is passed through HostPort.normalizeHost(), so that if it is IPv6 is bracketed. Now the ipv6 address passed to an `HttClient` request is bracketed. * HttpRequest was de-bracketing the host, but now it does not anymore. On the server: * Request.getLocalAddr(), getLocalName(), getRemoteAddr(), getRemoteHost(), getServerName(), when dealing with an IPv6 address, return it bracketed. The reason to return bracketed IPv6 also from *Addr() methods is that if it is used with InetAddress/InetSocketAddress it still works, but often it is interpreted as a URI host so brackets are necessary. * DoSFilter was blindly bracketing - now it does not. Added a number of test cases, and fixed those that expected non-bracketed IPv6. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Some test failures in ...
|
…ackets. Fixed Jenkins failures by disabling tests that require IPv6 if it is not available. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other than a niggle LGTM
* @return the host itself | ||
* @deprecated no replacement, do not use it | ||
*/ | ||
@Deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the impl at least call HostPort.normalize so that it works if somebody does call it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, perhaps add some apidoc text telling developers what the options are now that it's deprecated ...
/**
* @deprecated use {@link HostPort#normalize(String)} instead.
*/
@Deprecated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, the method should not be used. It's protected
so only subclasses could use it, but they should not - there is no need to normalize the host anymore.
I initially followed @gregw suggestion to call HostPort.normalizeHost()
, but actually this method was doing exactly the opposite. So either restore the old behavior, or keep this new one that does nothing.
…ackets. Updates after review. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
…ackets. Reverted code changes to HttpClient.normalizeHost(). Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
…ackets.
On the client:
so that if it is IPv6 is bracketed.
Now the ipv6 address passed to an
HttClient
request is bracketed.On the server:
getRemoteHost(), getServerName(), when dealing with an IPv6 address,
return it bracketed.
The reason to return bracketed IPv6 also from *Addr() methods is that
if it is used with InetAddress/InetSocketAddress it still works, but
often it is interpreted as a URI host so brackets are necessary.
Added a number of test cases, and fixed those that expected
non-bracketed IPv6.
Signed-off-by: Simone Bordet simone.bordet@gmail.com