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

Add equivalent cURL --resolve flag #99

Open
theladyjaye opened this issue Oct 26, 2012 · 15 comments
Open

Add equivalent cURL --resolve flag #99

theladyjaye opened this issue Oct 26, 2012 · 15 comments
Labels
blocked by upstream The issue is in a dependency. We are waiting for the upstream library to lay the groundwork. enhancement New feature or enhancement

Comments

@theladyjaye
Copy link

Per cURL --help:

--resolve HOST:PORT:ADDRESS Force resolve of HOST:PORT to ADDRESS

(bypasses hosts file)

example usage:

http --resolve "www.foo.com:127.0.0.1" GET www.foo.com/whatever

OR

http --resolve "www.foo.com:8080:127.0.0.1" GET www.foo.com:8080/whatever

@jkbrzt
Copy link
Member

jkbrzt commented Apr 11, 2013

I think you can achieve the same thing by explicitly setting the Host header:

http 127.0.0.1/whatever Host:www.foo.com

@jkbrzt jkbrzt closed this as completed Apr 11, 2013
@CMCDragonkai
Copy link

The above trick doesn't work for HTTPS sites. We need a full resolve option similar to curl.

@MadMub
Copy link

MadMub commented Mar 31, 2017

I'm using httpie to test that I setup my DNS round-robin correctly. +1 for feature

@aztlan2k
Copy link

Just curious... This has been open for over a year now (since it was reopened)... any chance it's getting looked at? Seems like a useful feature to have.

@sigmavirus24
Copy link

The underlying software that HTTPie uses does not allow people to specify their own IP addresses for a specific host. It's unlikely it will be added there. So, @aztlan2k it's not likely this is being worked on. Sorry. :/

@ghost
Copy link

ghost commented Feb 28, 2018

Hi! I've submitted some code and would appreciate any comments.

@ghost
Copy link

ghost commented Mar 1, 2018

Just re-submitted via another PR. Would you mind to check?

@pcgeek86
Copy link

Any chance of getting this merged? @jakubroztocil

@gregfr
Copy link

gregfr commented Jul 18, 2019

That would be great to prepare site migration and avoid problems!

@dimisjim
Copy link

dimisjim commented Nov 12, 2019

This can be achieved via dig +short <host> A. It's a DNS thing, not really HTTP

@lapo-luchini
Copy link

dig is used to query the DNS, the proposed --resove is used to force resolution of an address during an HTTP fetch (probably to a value the DNS server doesn't yet have but will have in the future, after this testing is done).
It's rather an alternative to editing /etc/hosts than it is to using dig (or drill, or similar).

@tn-osimis
Copy link

In case anybody is confused as to why this is needed "for HTTPS", it's specifically when TLS SNI (Server Name Indication) is used in place of the HTTP Host header to disambiguate connections (e.g. hostname-based L7 routing in reverse-proxies, or "virtual server" use-cases in general), which is extremely common.

In that context, resolving the IP beforehand isn't sufficient as it won't constitute a virtual server name expected by the actual server.

If an equivalent to --resolve isn't desirable for any reason, forcing the SNI value (e.g. --sni) would be an acceptable alternative IMO since we can already do the equivalent for plain HTTP (i.e. set the Host header value explicitly).

@segevfiner
Copy link

This can also be useful for absolute redirects (That include a full URL with a host name)

@Almad
Copy link

Almad commented Feb 3, 2021

Looking into it, there are basically two options how to fix this:

The strong preference would be for the first solution. Custom wrapping and monkeypatching often leads to unintended consequences as the Python interpreter and surrounding libraries develop and often leads to "hidden" bugs.

Help with getting the patch rolling for the urllib3 would be very welcome! Otherwise, we may look into it in the future, but other features have higher priority.

@Almad Almad added the blocked by upstream The issue is in a dependency. We are waiting for the upstream library to lay the groundwork. label Feb 3, 2021
@hussam-qasem
Copy link

Greetings! I just realized this thread is over 10 years old.
Is the status (blocked by upstream) still current?
Thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked by upstream The issue is in a dependency. We are waiting for the upstream library to lay the groundwork. enhancement New feature or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.