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

Honor Host header when connecting to IPs #96

Merged
merged 3 commits into from
Sep 30, 2016

Conversation

moorereason
Copy link
Contributor

Fixes #36

@davecheney
Copy link
Owner

I wonder if this is a bridge too far, the feature is quite esoteric, and its usage is even more so. I'm leaning towards saying No to this one.

@moorereason moorereason changed the title Add -R option to force resolve Honor Host header when connecting to IPs Sep 29, 2016
@moorereason
Copy link
Contributor Author

Let's try this again after getting some sleep. 😉

@theckman
Copy link
Contributor

theckman commented Sep 29, 2016

@davecheney at work I'm often doing testing against singular IPs, while passing in a Host header:

curl -IH 'Host: blah.work.tld' http://<TEST_IP>/

I'd replace my usage with httpstat if it supported it.

@@ -23,6 +23,7 @@ script:
- ./httpstat -X DELETE http://httpbin.org/delete
- ./httpstat https://www.google.com/
- ./httpstat https://www.google.com:443/
- ./httpstat -H "Host: www.google.com" https://$(dig +short www.google.com):443/
Copy link
Contributor

@theckman theckman Sep 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this a bit more resistant to failure? If Google ever adds multiple A records this test will fail. How do you feel about dig +short www.google.com | head -n 1?

Copy link
Contributor Author

@moorereason moorereason Sep 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, but it turns how that I can't use dig in Travis anyway. If anyone has any better ideas, let me know. Pushed a hard-coded test for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, nevermind...

$ {:"./httpstat -H \"Host"=>"www.google.com\" https://$(dig +short www.google.com):443/"}
/home/travis/build.sh: line 45: dig: command not found
/home/travis/build.sh: line 45: dig: command not found
/home/travis/build.sh: line 45: www.google.com" https://:443/}: No such file or directory

😂

@theckman
Copy link
Contributor

@moorereason maybe we can add this to the top of the .travis.yml file:

addons:
  apt:
    packages:
    - dnsutils

You should then have dig.

Copy link
Contributor

@theckman theckman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd prefer to use dig over the hard-coded IPv4 address. However, I don't feel strongly enough to block it (easy enough to open a separate PR to enhance the Travis testing).

@moorereason
Copy link
Contributor Author

@theckman, thanks for the addons info. Fixed. 👍

@davecheney davecheney merged commit 0204a19 into davecheney:master Sep 30, 2016
@moorereason moorereason deleted the iss36 branch October 1, 2016 05:40
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

Successfully merging this pull request may close these issues.

None yet

3 participants