Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Net::HTTPClientSession HTTP CONNECT support is not RFC-compliant #70
HTTPClientSession::proxyConnect() sends a CONNECT message to the proxy and then returns the initialised socket. However, the CONNECT message it sends to the server contains the IP address and port of the intended remote server, not the hostname and port as RFC seems to require:
Some Wireshark output of the relevant request, cropped to the relevant bit: https://gist.github.com/4567639
The cause is the line in HTTPClientSession::proxyConnect()
SocketAddress targetAddress(getHost(), getPort());
which does a DNS lookup on the hostname.
I have locally patched to this to some ugly slow std::stringsteam code:
std::string domain = getHost(); std::stringstream ss; ss << getPort(); std::string port(ss.str()); domain = (domain.append(":")).append(port); HTTPRequest proxyRequest(HTTPRequest::HTTP_CONNECT, domain, HTTPMessage::HTTP_1_1);
, but my upstream proxy(which I think is Squid) accepts either form so this isn't that important really.