curl-library
Re: [PATCH] CURLOPT_PROXYHEADER: send/replace proxy headers only
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
http://curl.haxx.se/mail/lib-2014-01/0079.html . I have created a bug
report regarding this issue, available at
https://sourceforge.net/p/curl/bugs/1326/ . The link to the patch file
is http://curl.haxx.se/mail/lib-2014-01/att-0079/0001-Http-Proxy-Option-to-set-header-for-http-proxy.patch
Comments:
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
version.
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
'is_connect'.
Thanks
Maciej
> 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: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
- text/x-diff attachment: http-header-curl-tool-option.patch