Skip to content

Commit

Permalink
Honor Host header when connecting to IPs (#96)
Browse files Browse the repository at this point in the history
* Honor Host header when connecting to IPs

Fixes #36

* Add Host header test to Travis

* Use dnsutils in travis
  • Loading branch information
moorereason authored and davecheney committed Sep 30, 2016
1 parent 5ef3031 commit 0204a19
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ os:
- linux
- osx

addons:
apt:
packages:
- dnsutils

sudo: false

install:
Expand Down Expand Up @@ -37,3 +42,4 @@ script:
- ./httpstat golang.org:80/dl
- ./httpstat golang.org:443/dl
- ./httpstat https://http2.akamai.com/
- ./httpstat -H Host:\ www.google.com https://$(dig +short www.google.com | head -1):443/
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ func visit(url *url.URL) {

switch url.Scheme {
case "https":
host, _, err := net.SplitHostPort(url.Host)
host, _, err := net.SplitHostPort(req.Host)
if err != nil {
host = url.Host
host = req.Host
}

tr.TLSClientConfig = &tls.Config{
Expand Down

0 comments on commit 0204a19

Please sign in to comment.