cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: How to skip the proxy response message?

From: Desmond O. Chang <dochang_at_gmail.com>
Date: Fri, 08 Jan 2016 04:37:20 +0800

"Desmond O. Chang" <dochang_at_gmail.com> writes:

> Daniel Stenberg <daniel_at_haxx.se> writes:
>
>> On Fri, 20 Nov 2015, Desmond O. Chang wrote:
>>
>>> I need to access a REST API and parse the response behind a proxy. It's hard
>>> to detect the header part in the response.
>>
>> ...
>>
>>> I think it would be better to make curl hide the proxy response, rather than
>>> hacking the parse script.
>>>
>>> Is there any way to do that? Or, is it possible to add an option for that
>>> purpose?
>>
>> It is not possible today, but yeah providing an option to allow that would
>> probably make a lot of sense.
>>
>> How do you envision such an option to be used?
>
> I suggest a new option `--include-remote-only`, which must be used with
> `--include` together. When this option is on, curl ignores the response from
> proxy and only displays the response message from the "actual remote" server.
>
> The command line would be like this:
>
> curl --silent --include --include-remote-only https://httpbin.org/get
>
> With or without a proxy, the response would be the same:
>
> ```
> HTTP/1.1 200 OK
> Content-Type: application/json
> {headers}...
>
> {body}...
> ```
>
> I wrote a patch on [Github][1]. Please check it.
>
> [1]: https://github.com/dochang/curl/tree/include-remote-only

According to the discussion at [1][]. I rename the option to
`--ignore-proxy-headers`. A new [branch][2] was created on Github. Please
check it.

The expected command line usage would be:

    curl --silent --include --ignore-proxy-headers https://httpbin.org/get

If this patch is OK, I will create a PR.

[1]: https://github.com/bagder/curl/commit/2612238088079215c258b5cd58f166956dd4fa66
[2]: https://github.com/dochang/curl/tree/ignore-proxy-headers

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2016-01-07