diff --git a/CHANGES b/CHANGES index 879f4d9fd..1b9f35120 100644 --- 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 diff --git a/RELEASE-NOTES b/RELEASE-NOTES index dd909bc44..79d741d01 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 diff --git a/configure.ac b/configure.ac index 39264c7f8..7e2373c59 100644 --- a/configure.ac +++ b/configure.ac @@ -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 \ diff --git a/lib/cookie.c b/lib/cookie.c index f1750f6d8..ba4d295ab 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -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 #include @@ -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 */ diff --git a/lib/easy.c b/lib/easy.c index 34d76caab..69ec6279f 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -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! */ diff --git a/lib/http.c b/lib/http.c index d7a43ab30..8303c5301 100644 --- a/lib/http.c +++ b/lib/http.c @@ -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; diff --git a/lib/share.c b/lib/share.c index 5c01845df..de13b6021 100644 --- a/lib/share.c +++ b/lib/share.c @@ -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 */ diff --git a/lib/transfer.c b/lib/transfer.c index aeb830716..f297654c9 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -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) { diff --git a/lib/url.c b/lib/url.c index cfc791104..74e65d164 100644 --- 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); - -#ifndef CURL_DISABLE_CRYPTO_AUTH - Curl_digest_cleanup(data); #endif + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH) + Curl_digest_cleanup(data); #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 );