Feature request: behavior similar curl --resolve #45

Open
noteed opened this Issue Sep 30, 2013 · 3 comments

Comments

Projects
None yet
2 participants
@noteed
Contributor

noteed commented Sep 30, 2013

Using http-stream's setHostname makes it possible for instance to test a Nginx virtual server served from 127.0.0.1. This is similar to curl -H 'Host: hostname' 127.0.0.1.

But to work with HTTPS, it is better to use curl --resolve 'hostname:80:127.0.0.1' hostname so that certificates can be checked for the correct hostname, instead of 127.0.0.1.

It would be great to have somthing similar to --resolve in http-streams.

@afcowie

This comment has been minimized.

Show comment Hide comment
@afcowie

afcowie Nov 10, 2013

Owner

I'm sorry, I don't really understand what you're trying to do. You can use hostnames when calling openConnectionSSL.

AfC

Owner

afcowie commented Nov 10, 2013

I'm sorry, I don't really understand what you're trying to do. You can use hostnames when calling openConnectionSSL.

AfC

@noteed

This comment has been minimized.

Show comment Hide comment
@noteed

noteed Nov 10, 2013

Contributor

Say you have two development sites hosted as Nginx virtual servers locally, on 127.0.0.1. If you curl http://127.0.0.1, you will get one or the other site, depending on which one is considered the default one by Nginx.

You can make sure to get the one you want by setting the Host header with -H 'Host: hostname'. In that case Nginx will choose the correct virtual server.

But now if you use https instead of http, this will fail as the certificate for that hostname is for a real IP, not 127.0.0.1. Curl provides the --resolve option for that use case.

Contributor

noteed commented Nov 10, 2013

Say you have two development sites hosted as Nginx virtual servers locally, on 127.0.0.1. If you curl http://127.0.0.1, you will get one or the other site, depending on which one is considered the default one by Nginx.

You can make sure to get the one you want by setting the Host header with -H 'Host: hostname'. In that case Nginx will choose the correct virtual server.

But now if you use https instead of http, this will fail as the certificate for that hostname is for a real IP, not 127.0.0.1. Curl provides the --resolve option for that use case.

@noteed

This comment has been minimized.

Show comment Hide comment
@noteed

noteed Nov 10, 2013

Contributor
Contributor

noteed commented Nov 10, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment