Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Correct Host header for proxy tunnel CONNECT #374

Merged
merged 1 commit into from

2 participants

@youurayy

As per RFC 2817, section 5.2 Requesting a Tunnel with CONNECT, there is a Host header to be set. The examples in the RFC use the same example host/port which is confusing, but logically, it makes no sense to use the same hostname in CONNECT statement and in the Host header. The Host header is meant to be set to the actual host to be proxied/tunelled to, and it looks like at least some of the proxies out there work that way.

I believe this also closes #367.

Notes:

  1. it would probably be ideal if the tunnel options were overridable from the main api, e.g. via opts = { tunnelOptions: { .. } }

  2. it would probably be better if the Host header for the tunnel was set after the logic for resolving the target hostname/port/protocol, which is below the tunnel config code, but it contains a few references to self.tunnel, so I'm not sure on that.

@youurayy

The change in test-tunnel.js is to support Squid 3.

@mikeal mikeal merged commit 82d3cb1 into from
@cybdoom cybdoom referenced this pull request from a commit in cybdoom/EbayAmazonApiServer
@cybdoom cybdoom