From c177c65bd50b6016571f919913af9d2da9e1ad34 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Mon, 5 May 2014 14:16:43 +0200
Subject: [PATCH] curl: warn on cookie use when built with disabled cookies

---
 src/tool_operate.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/tool_operate.c b/src/tool_operate.c
index 99ec59a..82f4fd2 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -1069,26 +1069,26 @@ static CURLcode operate_do(struct GlobalConfig *global,
         my_setopt_slist(curl, CURLOPT_QUOTE, config->quote);
         my_setopt_slist(curl, CURLOPT_POSTQUOTE, config->postquote);
         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");
 #endif
 
         my_setopt_enum(curl, CURLOPT_SSLVERSION, config->ssl_version);
         my_setopt_enum(curl, CURLOPT_TIMECONDITION, (long)config->timecond);
         my_setopt(curl, CURLOPT_TIMEVALUE, (long)config->condtime);
-- 
2.0.0.rc0

