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: Thu, 26 Nov 2015 00:09:14 +0800

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
-------------------------------------------------------------------
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 2015-11-25