netty5/handler-proxy/src/main/java/io/netty/handler/proxy
Stephane Landelle d60cd0231d HttpProxyHandler generates invalid CONNECT url and Host header when address is resolved
Motivation:

HttpProxyHandler uses `NetUtil#toSocketAddressString` to compute
CONNECT url and Host header.

The url is correct when the address is unresolved, as
`NetUtil#toSocketAddressString` will then use
`getHoststring`/`getHostname`. If the address is already resolved, the
url will be based on the IP instead of the hostname.

There’s an additional minor issue with the Host header: default port
443 should be omitted.

Modifications:

* Introduce NetUtil#getHostname
* Introduce HttpUtil#formatHostnameForHttp to format an
InetSocketAddress to
HTTP format
* Change url computation to favor hostname instead of IP
* Introduce HttpProxyHandler ignoreDefaultPortsInConnectHostHeader
parameter to ignore 80 and 443 ports in Host header

Result:

HttpProxyHandler performs properly when connecting to a resolved address
2018-03-27 09:43:11 +02:00
..
HttpProxyHandler.java HttpProxyHandler generates invalid CONNECT url and Host header when address is resolved 2018-03-27 09:43:11 +02:00
package-info.java Add proxy support for client socket connections 2014-10-14 12:29:08 +09:00
ProxyConnectException.java Add proxy support for client socket connections 2014-10-14 12:29:08 +09:00
ProxyConnectionEvent.java Small performance improvements 2014-11-20 00:10:06 -05:00
ProxyHandler.java Notify connect promise of ProxyHandler after codecs are removed 2017-04-27 14:54:56 +02:00
Socks4ProxyHandler.java Cleanup : String.length() == 0 replaced with String.isEmpty, removed unnecessary assert, class cast 2017-02-14 15:36:42 +01:00
Socks5ProxyHandler.java Cleanup : String.length() == 0 replaced with String.isEmpty, removed unnecessary assert, class cast 2017-02-14 15:36:42 +01:00