1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 07:38:49 -05:00

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.
This commit is contained in:
Daniel Stenberg 2004-12-05 23:59:32 +00:00
parent 35944744f8
commit ac269a8f68
9 changed files with 50 additions and 16 deletions

View File

@ -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

View 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

View 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 \

View 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 */

View 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! */

View 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;

View 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 */

View 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) {

View File

@ -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 );