curl / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Ray Satiro via curl-library <curl-library_at_cool.haxx.se>
Date: Fri, 8 Dec 2017 01:39:05 -0500

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:8080http://localhost:8080/|
>
> WIP at https://github.com/curl/curl/pull/2156
> <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"
http://httpbin.org

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