]> granicus.if.org Git - curl/commitdiff
Dan Fandrich added the --disable-cookies option to configure to build
authorDaniel Stenberg <daniel@haxx.se>
Sun, 5 Dec 2004 23:59:32 +0000 (23:59 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 5 Dec 2004 23:59:32 +0000 (23:59 +0000)
libcurl without cookie support. This is mainly useful if you want to build a
minimalistic libcurl with no cookies support at all. Like for embedded
systems or similar.

CHANGES
RELEASE-NOTES
configure.ac
lib/cookie.c
lib/easy.c
lib/http.c
lib/share.c
lib/transfer.c
lib/url.c

diff --git a/CHANGES b/CHANGES
index 879f4d9fd17df4c9e78d152027f335cb66144cb2..1b9f35120d3fbcfd7ea6046c484db48c09d358cf 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -7,6 +7,11 @@
                                   Changelog
 
 Daniel (6 December 2004)
+- Dan Fandrich added the --disable-cookies option to configure to build
+  libcurl without cookie support. This is mainly useful if you want to build a
+  minimalistic libcurl with no cookies support at all. Like for embedded
+  systems or similar.
+
 - Richard Atterer fixed libcurl's way of dealing with the EPSV
   response. Previously, libcurl would re-resolve the host name with the new
   port number and attempt to connect to that, while it should use the IP from
index dd909bc44d9ca2d09ef0a29ddf660bfec6e46c4d..79d741d0163ee50058c4c8c0745c141389af6036 100644 (file)
@@ -10,6 +10,8 @@ Curl and libcurl 7.12.3
 
 This release includes the following changes:
 
+ o new configure options: --disable-cookies, --disable-crypto-auth and
+   --disable-verbose
  o persistent ftp request improvements
  o CURLOPT_IOCTLFUNCTION and CURLOPT_IOCTLDATA added. If your app uses HTTP
    Digest, NTLM or Negotiate authentication, you will most likely want to use
index 39264c7f88032734186c33598ae165c5cf9864a1..7e2373c599f5cf7ecf4e17c76f9a5a52dbed203b 100644 (file)
@@ -1509,6 +1509,25 @@ AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
        AC_MSG_RESULT(yes)
 )
 
+dnl ************************************************************
+dnl disable cookies support
+dnl
+AC_MSG_CHECKING([whether to enable support for cookies])
+AC_ARG_ENABLE(cookies,
+AC_HELP_STRING([--enable-cookies],[Enable cookies support])
+AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
+[ case "$enableval" in
+  no)
+       AC_MSG_RESULT(no)
+       AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
+       AC_SUBST(CURL_DISABLE_COOKIES)
+       ;;
+  *)   AC_MSG_RESULT(yes)
+       ;;
+  esac ],
+       AC_MSG_RESULT(yes)
+)
+
 AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
 
 AC_CONFIG_FILES([Makefile \
index f1750f6d85cb8149c848f8fb24cd6f5c0d514711..ba4d295abe80a9b24db3e37fdf10c6c5ecbef573 100644 (file)
@@ -80,7 +80,7 @@ Example set of cookies:
 
 #include "setup.h"
 
-#ifndef CURL_DISABLE_HTTP
+#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
 
 #include <stdlib.h>
 #include <string.h>
@@ -878,4 +878,4 @@ int Curl_cookie_output(struct CookieInfo *c, char *dumphere)
   return 0;
 }
 
-#endif /* CURL_DISABLE_HTTP */
+#endif /* CURL_DISABLE_HTTP || CURL_DISABLE_COOKIES */
index 34d76caab8db24fc36303d4cba2a4b8add2d2494..69ec6279fd9238551215bdba5d824cbc54e578d7 100644 (file)
@@ -464,7 +464,7 @@ CURL *curl_easy_duphandle(CURL *incurl)
     outcurl->progress.flags    = data->progress.flags;
     outcurl->progress.callback = data->progress.callback;
 
-#ifndef CURL_DISABLE_HTTP
+#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
     if(data->cookies) {
       /* If cookies are enabled in the parent handle, we enable them
          in the clone as well! */
index d7a43ab308478129f9328a32a44d98ba978c19d0..8303c5301022d9341af88ca506ee34feb58fba2a 100644 (file)
@@ -1449,6 +1449,7 @@ CURLcode Curl_http(struct connectdata *conn)
   ptr = checkheaders(data, "Host:");
   if(ptr && (!data->state.this_is_a_follow ||
              curl_strequal(data->state.first_host, conn->host.name))) {
+#if !defined(CURL_DISABLE_COOKIES)
     /* If we have a given custom Host: header, we extract the host name in
        order to possibly use it for cookie reasons later on. We only allow the
        custom Host: header if this is NOT a redirect, as setting Host: in the
@@ -1472,6 +1473,7 @@ CURLcode Curl_http(struct connectdata *conn)
       memcpy(conn->allocptr.cookiehost, start, len);
       conn->allocptr.cookiehost[len]=0;
     }
+#endif
 
     conn->allocptr.host = NULL;
   }
@@ -1708,6 +1710,7 @@ CURLcode Curl_http(struct connectdata *conn)
     if(result)
       return result;
 
+#if !defined(CURL_DISABLE_COOKIES)
     if(data->cookies || addcookies) {
       struct Cookie *co=NULL; /* no cookies from start */
       int count=0;
@@ -1757,6 +1760,7 @@ CURLcode Curl_http(struct connectdata *conn)
       if(result)
         return result;
     }
+#endif
 
     if(data->set.timecondition) {
       struct tm *thistime;
index 5c01845df671d5e561323de0947dedddd020edd9..de13b60211afa5efe3ebdedb900cf2e01a7d3bc1 100644 (file)
@@ -77,7 +77,7 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
       }
       break;
 
-#ifndef CURL_DISABLE_HTTP
+#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
     case CURL_LOCK_DATA_COOKIE:
       if (!share->cookies) {
         share->cookies = Curl_cookie_init(NULL, NULL, NULL, TRUE );
@@ -108,7 +108,7 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
         }
         break;
 
-#ifndef CURL_DISABLE_HTTP
+#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
       case CURL_LOCK_DATA_COOKIE:
         if (share->cookies) {
           Curl_cookie_cleanup(share->cookies);
@@ -171,7 +171,7 @@ curl_share_cleanup(CURLSH *sh)
   if(share->hostcache)
     Curl_hash_destroy(share->hostcache);
 
-#ifndef CURL_DISABLE_HTTP
+#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
   if(share->cookies)
     Curl_cookie_cleanup(share->cookies);
 #endif   /* CURL_DISABLE_HTTP */
index aeb8307169167764eb05aef0bad93b871a0a125c..f297654c943bc8b777137ce3fcee73394ded101e 100644 (file)
@@ -858,6 +858,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
                 /* we asked for a resume and we got it */
                 k->content_range = TRUE;
             }
+#if !defined(CURL_DISABLE_COOKIES)
             else if(data->cookies &&
                     checkprefix("Set-Cookie:", k->p)) {
               Curl_share_lock(data, CURL_LOCK_DATA_COOKIE,
@@ -871,6 +872,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
                               conn->path);
               Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);
             }
+#endif
             else if(checkprefix("Last-Modified:", k->p) &&
                     (data->set.timecondition || data->set.get_filetime) ) {
               time_t secs=time(NULL);
@@ -1614,7 +1616,7 @@ CURLcode Curl_pretransfer(struct SessionHandle *data)
   data->state.authhost.want = data->set.httpauth;
   data->state.authproxy.want = data->set.proxyauth;
 
-#ifndef CURL_DISABLE_HTTP
+#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
   /* If there was a list of cookie files to read and we haven't done it before,
      do it now! */
   if(data->change.cookielist) {
index cfc791104219ae1e05efc450dc9a0ef5b2c63df8..74e65d16474da9a87675e012252ff9cbae4359bb 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -214,9 +214,6 @@ CURLcode Curl_close(struct SessionHandle *data)
   Curl_SSL_Close_All(data);
 #endif
 
-  if(data->change.cookielist) /* clean up list if any */
-    curl_slist_free_all(data->change.cookielist);
-
   Curl_safefree(data->state.first_host);
   Curl_safefree(data->state.scratch);
 
@@ -231,7 +228,10 @@ CURLcode Curl_close(struct SessionHandle *data)
 
   Curl_safefree(data->state.headerbuff);
 
-#ifndef CURL_DISABLE_HTTP
+#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
+  if(data->change.cookielist) /* clean up list if any */
+    curl_slist_free_all(data->change.cookielist);
+
   Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);
   if(data->set.cookiejar) {
     /* we have a "destination" for all the cookies to get dumped to */
@@ -244,10 +244,10 @@ CURLcode Curl_close(struct SessionHandle *data)
     Curl_cookie_cleanup(data->cookies);
   }
   Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);
+#endif
 
-#ifndef CURL_DISABLE_CRYPTO_AUTH
+#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH)
   Curl_digest_cleanup(data);
-#endif
 #endif
 
   /* free the connection cache */
@@ -719,6 +719,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
     data->set.http200aliases = va_arg(param, struct curl_slist *);
     break;
 
+#if !defined(CURL_DISABLE_COOKIES)
   case CURLOPT_COOKIE:
     /*
      * Cookie string to send to the remote server in the request.
@@ -776,6 +777,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
      */
     data->set.cookiesession = (bool)va_arg(param, long);
     break;
+#endif
 
   case CURLOPT_HTTPGET:
     /*
@@ -1310,7 +1312,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
 
           data->hostcache = data->share->hostcache;
         }
-#ifndef CURL_DISABLE_HTTP
+#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
         if(data->share->cookies) {
           /* use shared cookie list, first free own one if any */
           if (data->cookies)
@@ -1321,7 +1323,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
         Curl_share_unlock(data, CURL_LOCK_DATA_SHARE);
 
       }
-#ifndef CURL_DISABLE_HTTP
+#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
       /* check cookie list is set */
       if(!data->cookies)
         data->cookies = Curl_cookie_init(data, NULL, NULL, TRUE );