diff options
author | Daniel Stenberg <daniel@haxx.se> | 2014-05-05 14:16:43 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2014-05-06 08:34:16 +0200 |
commit | 47d760714f2f44b7edc8f1ef4d5518286e402af9 (patch) | |
tree | 5842cc5569c37977b454a365678f4e1303f47001 /src | |
parent | 5fe879555d766ccf28b0b62d4a945636b3cca388 (diff) |
curl: bail on cookie use when built with disabled cookies
Diffstat (limited to 'src')
-rw-r--r-- | src/tool_operate.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/tool_operate.c b/src/tool_operate.c index 99ec59abe..d37d88993 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -1071,21 +1071,23 @@ static CURLcode operate_do(struct GlobalConfig *global, my_setopt_slist(curl, CURLOPT_PREQUOTE, config->prequote); #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES) - { - /* TODO: Make this a run-time check instead of compile-time one. */ + if(config->cookie) + my_setopt_str(curl, CURLOPT_COOKIE, config->cookie); - if(config->cookie) - my_setopt_str(curl, CURLOPT_COOKIE, config->cookie); + if(config->cookiefile) + my_setopt_str(curl, CURLOPT_COOKIEFILE, config->cookiefile); - if(config->cookiefile) - my_setopt_str(curl, CURLOPT_COOKIEFILE, config->cookiefile); + /* new in libcurl 7.9 */ + if(config->cookiejar) + my_setopt_str(curl, CURLOPT_COOKIEJAR, config->cookiejar); - /* new in libcurl 7.9 */ - if(config->cookiejar) - my_setopt_str(curl, CURLOPT_COOKIEJAR, config->cookiejar); - - /* new in libcurl 7.9.7 */ - my_setopt(curl, CURLOPT_COOKIESESSION, config->cookiesession?1L:0L); + /* new in libcurl 7.9.7 */ + my_setopt(curl, CURLOPT_COOKIESESSION, config->cookiesession?1L:0L); +#else + if(config->cookie || config->cookiefile || config->cookiejar) { + warnf(config, "cookie option(s) used even though cookie support " + "is disabled!\n"); + return CURLE_NOT_BUILT_IN; } #endif |