aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/cookie.c4
-rw-r--r--lib/easy.c2
-rw-r--r--lib/http.c4
-rw-r--r--lib/share.c6
-rw-r--r--lib/transfer.c4
-rw-r--r--lib/url.c18
6 files changed, 23 insertions, 15 deletions
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 <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 */
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,11 +244,11 @@ 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 */
free(data->state.connects);
@@ -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 );