aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJay Satiro <raysatiro@yahoo.com>2017-02-21 22:21:17 -0500
committerJay Satiro <raysatiro@yahoo.com>2017-02-21 22:24:40 -0500
commitb259646ea10fc13d6cd97608824d0038f9720996 (patch)
tree8b69c53b5c396dc7b605bf87211e759d348b6a50 /src
parent0e8d3e838eafa75fe1373db757a2940cb33a2ba8 (diff)
url: Improve CURLOPT_PROXY_CAPATH error handling
- Change CURLOPT_PROXY_CAPATH to return CURLE_NOT_BUILT_IN if the option is not supported, which is the same as what we already do for CURLOPT_CAPATH. - Change the curl tool to handle CURLOPT_PROXY_CAPATH error CURLE_NOT_BUILT_IN as a warning instead of as an error, which is the same as what we already do for CURLOPT_CAPATH. - Fix CAPATH docs to show that CURLE_NOT_BUILT_IN is returned when the respective CAPATH option is not supported by the SSL library. Ref: https://github.com/curl/curl/pull/1257
Diffstat (limited to 'src')
-rw-r--r--src/tool_operate.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/tool_operate.c b/src/tool_operate.c
index bc36520d9..c30b32046 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -1014,6 +1014,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
my_setopt_str(curl, CURLOPT_CAINFO, config->cacert);
if(config->proxy_cacert)
my_setopt_str(curl, CURLOPT_PROXY_CAINFO, config->proxy_cacert);
+
if(config->capath) {
result = res_setopt_str(curl, CURLOPT_CAPATH, config->capath);
if(result == CURLE_NOT_BUILT_IN) {
@@ -1024,10 +1025,22 @@ static CURLcode operate_do(struct GlobalConfig *global,
else if(result)
goto show_error;
}
- if(config->proxy_capath)
- my_setopt_str(curl, CURLOPT_PROXY_CAPATH, config->proxy_capath);
- else if(config->capath) /* CURLOPT_PROXY_CAPATH default is capath */
- my_setopt_str(curl, CURLOPT_PROXY_CAPATH, config->capath);
+ /* For the time being if --proxy-capath is not set then we use the
+ --capath value for it, if any. See #1257 */
+ if(config->proxy_capath || config->capath) {
+ result = res_setopt_str(curl, CURLOPT_PROXY_CAPATH,
+ (config->proxy_capath ?
+ config->proxy_capath :
+ config->capath));
+ if(result == CURLE_NOT_BUILT_IN) {
+ if(config->proxy_capath) {
+ warnf(config->global,
+ "ignoring --proxy-capath, not supported by libcurl\n");
+ }
+ }
+ else if(result)
+ goto show_error;
+ }
if(config->crlfile)
my_setopt_str(curl, CURLOPT_CRLFILE, config->crlfile);