Skip to content

HTTPClientSession::proxyConnect forces DNS lookup of host names #173

@aleks-f

Description

@aleks-f

From https://sourceforge.net/p/poco/bugs/611/

From latest stable code base, 1.4.6p1 at time of writing, the file HTTPClientSession.cpp has a function proxyConnect. This function creates an HTTPClientSession with the proxy details and then proceeds to generate a proxy request using the end target details. It does this by constructing a SocketAddress with the host and port, this has the side effect of performing a DNS lookup if the host is not already an IP address only to then obtain a string representation of the SocketAddress. This results in failures on systems that cannot resolve hostnames, this may well be the reason such a system is proxying in the first place. This will occur if the client is requesting an SSL tunnel through the proxy using the CONNECT HTTP method and generally results in a CONNECT request of the form
CONNECT a.b.c.d:p HTTP/1.1
Host: actualhost.com
Proxy-Connection: Keep-Alive
When really it should produce a request of the form
CONNECT actualhost.com:p HTTP/1.1
Host: actualhost.com
Proxy-Connection: Keep-Alive
Allowing the proxy to perform the DNS lookup rather than the client which may not be able to do so.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions