cURL / Mailing Lists / curl-library / Single Mail


Re: [PATCH] CURLOPT_PROXYHEADER: send/replace proxy headers only

From: Maciej Puzio <>
Date: Thu, 23 Jan 2014 13:01:37 -0600

Vijay Panghal's patch implements a feature that I need for my project,
so I am very glad that work is being done on it. I tested the patch
and have a few comments. Just in case this email won't be assigned to
a proper thread, I am replying to message . I have created a bug
report regarding this issue, available at . The link to the patch file


1. The patch includes modifications to curl library, but not to the
command line curl tool. I attach the patch that adds --proxy-header
command line option.

2. I tested curl 7.34.0 with both patches applied, and I am happy to
report that the feature worked as I expected. My tests involved curl
tool, I did not use libcurl directly from within my program.

3. When --proxy-header option is absent, but --header is present, curl
sends headers specified in --header to both proxy and the origin
server (i.e. final destination of the request). In my opinion this is
an incorrect and potentially dangerous behavior (please see my bug
report for details). However, Vijay Panghal comments in his code that
this is done for backward compatibility, and my testing confirms that
without --proxy-header the behavior of curl matches the previous

4. Option --proxy-header is only used for CONNECT requests, i.e. when
https URL is requested, or when --proxytunnel option is explicitly
used. When proxying with GET/POST (typical for unencrypted requests),
--proxy-header is ignored. While this is technically correct (only one
set of headers is sent in such a case), this behavior may be confusing
to the user. I suggest issuing a warning when --proxy-header is used
for a request that is not tunneled.

5. A very minor issue that I noticed in the code: in file lib/http.c
the second (newly added) argument to function Curl_add_custom_headers
is named 'is_proxy', while in file lib/http.h it is named


> Bump!
> I missed the 7.34 feature train for this patch. I would like to push it for
> 7.35. Let me know if you guys have any comments.
> Regards
> Vijay

List admin:

Received on 2014-01-23