curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Force cURL to use GET on proxy for HTTPs requests

From: Benjamin Morel via curl-library <curl-library_at_cool.haxx.se>
Date: Sat, 9 Dec 2017 01:00:31 +0100

>
> In my last e-mail I said the request target needs to end in a / but I
> meant if there's no path component. In other words https://google.com/ or
> https://google.com/foo are ok

Yes, that was clear!

Also note the URL should have the host you want in the host header so the
> host:port would need to match request target.

Not sure why, but last time I tried it, it failed to use the proxy's cache,
and using localhost I got it working. I think I had mistakenly used https
instead of http in the main URL.

The command you are using likely does not do what you intended

You're right, although it does work with TrafficServer as a proxy: this one
seems to ignore the Host header when requesting a full URL. Not sure about
others (and the spec).

Thanks again for your help, and I hope your PR on GitHub will be merged
soon!

Benjamin

On 8 December 2017 at 07:39, Ray Satiro via curl-library <
curl-library_at_cool.haxx.se> wrote:

> On 12/6/2017 5:37 AM, Benjamin Morel via curl-library wrote:
>
> you can cheat by using --request-target (libcurl: CURLOPT_REQUEST_TARGET)
>> to specify an https url:
>
>
> Clever. I didn't know about --request-target. Got it to work with:
>
> curl -v --request-target "https://example.com/path/to/resource" -x localhost:8080 http://localhost:8080/
>
> WIP at https://github.com/curl/curl/pull/2156
>
>
> Awesome, thanks! Can't wait.
>
>
> In my last e-mail I said the request target needs to end in a / but I
> meant if there's no path component. In other words https://google.com/ or
> https://google.com/foo are ok
>
> Also note the URL should have the host you want in the host header so the
> host:port would need to match request target. For example
> request-target: https://google.com/foo
> url: http://google.com
>
> request-target: https://google.com/
> url: http://google.com
>
> The command you are using likely does not do what you intended:
>
> > GET https://example.com/path/to/resource HTTP/1.1
> > Host: localhost:8080
> > User-Agent: curl/7.56.0-DEV
> > Accept: */*
> > Proxy-Connection: Keep-Alive
>
> So you would want the URL to be http://example.com. Try this example:
>
> curl -v -x localhost:8080 --request-target "https://httpbin.org/headers"
> <https://httpbin.org/headers> http://httpbin.org
>
>
> -------------------------------------------------------------------
> Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
> Etiquette: https://curl.haxx.se/mail/etiquette.html
>

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-12-09