Skip to content
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

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

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

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

karlr42 opened this issue Jan 18, 2013 · 3 comments
Milestone

Comments

@karlr42
Copy link
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
Copy link
Member

aleks-f commented Jan 25, 2013

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

@aleks-f
Copy link
Member

aleks-f commented Mar 24, 2013

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

@aleks-f
Copy link
Member

aleks-f commented Mar 31, 2013

no feedback, closing

@aleks-f aleks-f closed this as completed Mar 31, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants