netty5/handler-proxy/src/test/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
..
HttpProxyHandlerTest.java HttpProxyHandler generates invalid CONNECT url and Host header when address is resolved 2018-03-27 09:43:11 +02:00
HttpProxyServer.java Wrap operations requiring SocketPermission with doPrivileged blocks 2017-01-19 21:12:52 +01:00
ProxyHandlerTest.java Wrap operations requiring SocketPermission with doPrivileged blocks 2017-01-19 21:12:52 +01:00
ProxyServer.java Add proxy support for client socket connections 2014-10-14 12:29:08 +09:00
Socks4ProxyServer.java Wrap operations requiring SocketPermission with doPrivileged blocks 2017-01-19 21:12:52 +01:00
Socks5ProxyServer.java Wrap operations requiring SocketPermission with doPrivileged blocks 2017-01-19 21:12:52 +01:00
TestMode.java Add proxy support for client socket connections 2014-10-14 12:29:08 +09:00
UnresponsiveHandler.java Add proxy support for client socket connections 2014-10-14 12:29:08 +09:00