Net::HTTPClientSession HTTP CONNECT support is not RFC-compliant #70

Closed
karlr42 opened this Issue Jan 18, 2013 · 3 comments

Comments

Projects
None yet
2 participants
@karlr42
Contributor

karlr42 commented Jan 18, 2013

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:

The Request-URI portion of the Request-Line is always
an 'authority' as defined by URI Generic Syntax [2], which is to say
the host name and port number destination of the requested connection
separated by a colon:"

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.

@aleks-f

This comment has been minimized.

Show comment Hide comment
@aleks-f

aleks-f Jan 25, 2013

Owner

I'm not geting it - SocketAddress::toString() does the same thing ...

Owner

aleks-f commented Jan 25, 2013

I'm not geting it - SocketAddress::toString() does the same thing ...

@aleks-f

This comment has been minimized.

Show comment Hide comment
@aleks-f

aleks-f Mar 24, 2013

Owner

Any comments on this? I'm about to close it before the 1.5.2 release ...

Owner

aleks-f commented Mar 24, 2013

Any comments on this? I'm about to close it before the 1.5.2 release ...

@aleks-f

This comment has been minimized.

Show comment Hide comment
@aleks-f

aleks-f Mar 31, 2013

Owner

no feedback, closing

Owner

aleks-f commented Mar 31, 2013

no feedback, closing

@aleks-f aleks-f closed this Mar 31, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment