aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-06-09 08:23:55 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-06-09 08:23:55 +0000
commit90037b85d1a6c46979729d0735eef094516dc31f (patch)
treec47c68d433b7c8af0f6ad63e2979ccfd6354539c
parent6ec145d4b451d51310f887ef01bb40b48004d131 (diff)
Alexander Krasnostavsky's fix to make libcurl build fine with configure
--disable-http, which thus builds a libcurl without HTTP support.
-rw-r--r--lib/easy.c2
-rw-r--r--lib/ftp.c4
-rw-r--r--lib/share.c8
-rw-r--r--lib/transfer.c14
-rw-r--r--lib/url.c480
5 files changed, 274 insertions, 234 deletions
diff --git a/lib/easy.c b/lib/easy.c
index 6257b7452..b007b97ed 100644
--- a/lib/easy.c
+++ b/lib/easy.c
@@ -459,6 +459,7 @@ CURL *curl_easy_duphandle(CURL *incurl)
outcurl->progress.flags = data->progress.flags;
outcurl->progress.callback = data->progress.callback;
+#ifndef CURL_DISABLE_HTTP
if(data->cookies) {
/* If cookies are enabled in the parent handle, we enable them
in the clone as well! */
@@ -470,6 +471,7 @@ CURL *curl_easy_duphandle(CURL *incurl)
break;
}
}
+#endif /* CURL_DISABLE_HTTP */
/* duplicate all values in 'change' */
if(data->change.url) {
diff --git a/lib/ftp.c b/lib/ftp.c
index 7a7b82040..0304e5fa8 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -491,6 +491,7 @@ CURLcode Curl_ftp_connect(struct connectdata *conn)
ftp->passwd = conn->passwd;
ftp->response_time = 3600; /* set default response time-out */
+#ifndef CURL_DISABLE_HTTP
if (conn->bits.tunnel_proxy) {
/* We want "seamless" FTP operations through HTTP proxy tunnel */
result = Curl_ConnectHTTPProxyTunnel(conn, FIRSTSOCKET,
@@ -498,6 +499,7 @@ CURLcode Curl_ftp_connect(struct connectdata *conn)
if(CURLE_OK != result)
return result;
}
+#endif /* CURL_DISABLE_HTTP */
if(conn->protocol & PROT_FTPS) {
/* FTPS is simply ftp with SSL for the control channel */
@@ -1711,6 +1713,7 @@ CURLcode ftp_use_pasv(struct connectdata *conn,
/* this just dumps information about this second connection */
ftp_pasv_verbose(conn, conninfo, newhostp, connectport);
+#ifndef CURL_DISABLE_HTTP
if(conn->bits.tunnel_proxy) {
/* We want "seamless" FTP operations through HTTP proxy tunnel */
result = Curl_ConnectHTTPProxyTunnel(conn, SECONDARYSOCKET,
@@ -1718,6 +1721,7 @@ CURLcode ftp_use_pasv(struct connectdata *conn,
if(CURLE_OK != result)
return result;
}
+#endif /* CURL_DISABLE_HTTP */
return CURLE_OK;
}
diff --git a/lib/share.c b/lib/share.c
index d1292c4ae..ad68496f6 100644
--- a/lib/share.c
+++ b/lib/share.c
@@ -76,7 +76,8 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
return CURLSHE_NOMEM;
}
break;
-
+
+#ifndef CURL_DISABLE_HTTP
case CURL_LOCK_DATA_COOKIE:
if (!share->cookies) {
share->cookies = Curl_cookie_init(NULL, NULL, NULL, TRUE );
@@ -84,6 +85,7 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
return CURLSHE_NOMEM;
}
break;
+#endif /* CURL_DISABLE_HTTP */
case CURL_LOCK_DATA_SSL_SESSION: /* not supported (yet) */
case CURL_LOCK_DATA_CONNECT: /* not supported (yet) */
@@ -106,12 +108,14 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
}
break;
+#ifndef CURL_DISABLE_HTTP
case CURL_LOCK_DATA_COOKIE:
if (share->cookies) {
Curl_cookie_cleanup(share->cookies);
share->cookies = NULL;
}
break;
+#endif /* CURL_DISABLE_HTTP */
case CURL_LOCK_DATA_SSL_SESSION:
break;
@@ -165,8 +169,10 @@ curl_share_cleanup(CURLSH *sh)
if(share->hostcache)
Curl_hash_destroy(share->hostcache);
+#ifndef CURL_DISABLE_HTTP
if(share->cookies)
Curl_cookie_cleanup(share->cookies);
+#endif /* CURL_DISABLE_HTTP */
share->unlockfunc(NULL, CURL_LOCK_DATA_SHARE, share->clientdata);
free (share);
diff --git a/lib/transfer.c b/lib/transfer.c
index 3bbd41e9b..0a4e62543 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -187,6 +187,7 @@ checkhttpprefix(struct SessionHandle *data,
return FALSE;
}
+
/*
* Curl_readwrite() is the low-level function to be called when data is to
* be read and written to/from the connection.
@@ -442,6 +443,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
FD_ZERO(&k->wkeepfd);
}
+#ifndef CURL_DISABLE_HTTP
/*
* When all the headers have been parsed, see if we should give
* up and return an error.
@@ -451,6 +453,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
k->httpcode);
return CURLE_HTTP_RETURNED_ERROR;
}
+#endif /* CURL_DISABLE_HTTP */
/* now, only output this if the header AND body are requested:
*/
@@ -488,7 +491,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
return CURLE_HTTP_RANGE_ERROR;
}
}
-
+#ifndef CURL_DISABLE_HTTP
if(!stop_reading) {
/* Curl_http_auth_act() checks what authentication methods
* that are available and decides which one (if any) to
@@ -498,6 +501,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
if(result)
return result;
}
+#endif /* CURL_DISABLE_HTTP */
if(!k->header) {
/*
@@ -696,6 +700,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
data->info.contenttype[len] = 0; /* zero terminate */
}
}
+#ifndef CURL_DISABLE_HTTP
else if((k->httpversion == 10) &&
conn->bits.httpproxy &&
Curl_compareheader(k->p,
@@ -864,6 +869,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
}
#endif
}
+#endif /* CURL_DISABLE_HTTP */
/*
* End of header-checks. Write them to the client.
@@ -970,6 +976,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
Curl_debug(data, CURLINFO_DATA_IN, k->str, nread, conn->host.dispname);
}
+#ifndef CURL_DISABLE_HTTP
if(conn->bits.chunk) {
/*
* Bless me father for I have sinned. Here comes a chunked
@@ -999,6 +1006,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
}
/* If it returned OK, we just keep going */
}
+#endif /* CURL_DISABLE_HTTP */
if((-1 != conn->maxdownload) &&
(k->bytecount + nread >= conn->maxdownload)) {
@@ -1302,6 +1310,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
return CURLE_OK;
}
+
/*
* Curl_readwrite_init() inits the readwrite session.
*/
@@ -1517,6 +1526,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 there was a list of cookie files to read and we haven't done it before,
do it now! */
if(data->change.cookielist) {
@@ -1533,7 +1543,7 @@ CURLcode Curl_pretransfer(struct SessionHandle *data)
curl_slist_free_all(data->change.cookielist); /* clean up list */
data->change.cookielist = NULL; /* don't do this again! */
}
-
+#endif /* CURL_DISABLE_HTTP */
/* Allow data->set.use_port to set which port to use. This needs to be
diff --git a/lib/url.c b/lib/url.c
index b53dcd1c4..2bc9e53c6 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -238,6 +238,8 @@ CURLcode Curl_close(struct SessionHandle *data)
Curl_cookie_cleanup(data->cookies);
}
Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);
+
+ Curl_digest_cleanup(data);
#endif
/* free the connection cache */
@@ -245,8 +247,6 @@ CURLcode Curl_close(struct SessionHandle *data)
Curl_safefree(data->info.contenttype);
- Curl_digest_cleanup(data);
-
#ifdef USE_ARES
/* this destroys the channel and we cannot use it anymore after this */
ares_destroy(data->state.areschannel);
@@ -555,27 +555,6 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
*/
data->set.netrc_file = va_arg(param, char *);
break;
- case CURLOPT_FOLLOWLOCATION:
- /*
- * Follow Location: header hints on a HTTP-server.
- */
- data->set.http_follow_location = va_arg(param, long)?TRUE:FALSE;
- break;
- case CURLOPT_UNRESTRICTED_AUTH:
- /*
- * Send authentication (user+password) when following locations, even when
- * hostname changed.
- */
- data->set.http_disable_hostname_check_before_authentication =
- va_arg(param, long)?TRUE:FALSE;
- break;
- case CURLOPT_HTTP_VERSION:
- /*
- * This sets a requested HTTP version to be used. The value is one of
- * the listed enums in curl/curl.h.
- */
- data->set.httpversion = va_arg(param, long);
- break;
case CURLOPT_TRANSFERTEXT:
/*
* This option was previously named 'FTPASCII'. Renamed to work with
@@ -607,117 +586,86 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
data->set.ssl.version = va_arg(param, long);
break;
- case CURLOPT_COOKIESESSION:
- /*
- * Set this option to TRUE to start a new "cookie session". It will
- * prevent the forthcoming read-cookies-from-file actions to accept
- * cookies that are marked as being session cookies, as they belong to a
- * previous session.
- *
- * In the original Netscape cookie spec, "session cookies" are cookies
- * with no expire date set. RFC2109 describes the same action if no
- * 'Max-Age' is set and RFC2965 includes the RFC2109 description and adds
- * a 'Discard' action that can enforce the discard even for cookies that
- * have a Max-Age.
- *
- * We run mostly with the original cookie spec, as hardly anyone implements
- * anything else.
- */
- data->set.cookiesession = (bool)va_arg(param, long);
- break;
-
#ifndef CURL_DISABLE_HTTP
- case CURLOPT_COOKIEFILE:
+ case CURLOPT_AUTOREFERER:
/*
- * Set cookie file to read and parse. Can be used multiple times.
+ * Switch on automatic referer that gets set if curl follows locations.
*/
- cookiefile = (char *)va_arg(param, void *);
- if(cookiefile) {
- struct curl_slist *cl;
- /* append the cookie file name to the list of file names, and deal with
- them later */
- cl = curl_slist_append(data->change.cookielist, cookiefile);
-
- if(!cl)
- return CURLE_OUT_OF_MEMORY;
-
- data->change.cookielist = cl;
- }
+ data->set.http_auto_referer = va_arg(param, long)?1:0;
break;
- case CURLOPT_COOKIEJAR:
+ case CURLOPT_ENCODING:
/*
- * Set cookie file name to dump all cookies to when we're done.
+ * String to use at the value of Accept-Encoding header.
+ *
+ * If the encoding is set to "" we use an Accept-Encoding header that
+ * encompasses all the encodings we support.
+ * If the encoding is set to NULL we don't send an Accept-Encoding header
+ * and ignore an received Content-Encoding header.
+ *
*/
- data->set.cookiejar = (char *)va_arg(param, void *);
+ data->set.encoding = va_arg(param, char *);
+ if(data->set.encoding && !*data->set.encoding)
+ data->set.encoding = (char*)ALL_CONTENT_ENCODINGS;
+ break;
+ case CURLOPT_FOLLOWLOCATION:
/*
- * Activate the cookie parser. This may or may not already
- * have been made.
+ * Follow Location: header hints on a HTTP-server.
*/
- data->cookies = Curl_cookie_init(data, NULL, data->cookies,
- data->set.cookiesession);
+ data->set.http_follow_location = va_arg(param, long)?TRUE:FALSE;
break;
-#endif
- case CURLOPT_WRITEHEADER:
+ case CURLOPT_UNRESTRICTED_AUTH:
/*
- * Custom pointer to pass the header write callback function
+ * Send authentication (user+password) when following locations, even when
+ * hostname changed.
*/
- data->set.writeheader = (void *)va_arg(param, void *);
+ data->set.http_disable_hostname_check_before_authentication =
+ va_arg(param, long)?TRUE:FALSE;
break;
- case CURLOPT_COOKIE:
+
+ case CURLOPT_MAXREDIRS:
/*
- * Cookie string to send to the remote server in the request.
+ * The maximum amount of hops you allow curl to follow Location:
+ * headers. This should mostly be used to detect never-ending loops.
*/
- data->set.cookie = va_arg(param, char *);
+ data->set.maxredirs = va_arg(param, long);
break;
- case CURLOPT_ERRORBUFFER:
- /*
- * Error buffer provided by the caller to get the human readable
- * error string in.
- */
- data->set.errorbuffer = va_arg(param, char *);
+
+ case CURLOPT_POST:
+ /* Does this option serve a purpose anymore? Yes it does, when
+ CURLOPT_POSTFIELDS isn't used and the POST data is read off the
+ callback! */
+ if(va_arg(param, long))
+ data->set.httpreq = HTTPREQ_POST;
break;
- case CURLOPT_FILE:
+
+ case CURLOPT_POSTFIELDS:
/*
- * FILE pointer to write to or include in the data write callback
+ * A string with POST data. Makes curl HTTP POST.
*/
- data->set.out = va_arg(param, FILE *);
+ data->set.postfields = va_arg(param, char *);
+ if(data->set.postfields)
+ data->set.httpreq = HTTPREQ_POST;
break;
- case CURLOPT_FTPPORT:
+
+ case CURLOPT_POSTFIELDSIZE:
/*
- * Use FTP PORT, this also specifies which IP address to use
+ * The size of the POSTFIELD data to prevent libcurl to do strlen() to
+ * figure it out. Enables binary posts.
*/
- data->set.ftpport = va_arg(param, char *);
- data->set.ftp_use_port = data->set.ftpport?1:0;
- break;
-
- case CURLOPT_FTP_USE_EPRT:
- data->set.ftp_use_eprt = va_arg(param, long)?TRUE:FALSE;
- break;
-
- case CURLOPT_FTP_USE_EPSV:
- data->set.ftp_use_epsv = va_arg(param, long)?TRUE:FALSE;
+ data->set.postfieldsize = va_arg(param, long);
break;
- case CURLOPT_HTTPHEADER:
+ case CURLOPT_POSTFIELDSIZE_LARGE:
/*
- * Set a list with HTTP headers to use (or replace internals with)
+ * The size of the POSTFIELD data to prevent libcurl to do strlen() to
+ * figure it out. Enables binary posts.
*/
- data->set.headers = va_arg(param, struct curl_slist *);
+ data->set.postfieldsize = va_arg(param, curl_off_t);
break;
- case CURLOPT_CUSTOMREQUEST:
- /*
- * Set a custom string to use as request
- */
- data->set.customrequest = va_arg(param, char *);
- /* we don't set
- data->set.httpreq = HTTPREQ_CUSTOM;
- here, we continue as if we were using the already set type
- and this just changes the actual request keyword */
- break;
case CURLOPT_HTTPPOST:
/*
* Set to make us do HTTP POST
@@ -727,116 +675,134 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
data->set.httpreq = HTTPREQ_POST_FORM;
break;
- case CURLOPT_HTTPGET:
+ case CURLOPT_REFERER:
/*
- * Set to force us do HTTP GET
+ * String to set in the HTTP Referer: field.
*/
- if(va_arg(param, long)) {
- data->set.httpreq = HTTPREQ_GET;
- data->set.upload = FALSE; /* switch off upload */
+ if(data->change.referer_alloc) {
+ free(data->change.referer);
+ data->change.referer_alloc = FALSE;
}
+ data->set.set_referer = va_arg(param, char *);
+ data->change.referer = data->set.set_referer;
break;
- case CURLOPT_INFILE:
+ case CURLOPT_USERAGENT:
/*
- * FILE pointer to read the file to be uploaded from. Or possibly
- * used as argument to the read callback.
+ * String to use in the HTTP User-Agent field
*/
- data->set.in = va_arg(param, FILE *);
+ data->set.useragent = va_arg(param, char *);
break;
- case CURLOPT_INFILESIZE:
+
+ case CURLOPT_HTTPHEADER:
/*
- * If known, this should inform curl about the file size of the
- * to-be-uploaded file.
+ * Set a list with HTTP headers to use (or replace internals with)
*/
- data->set.infilesize = va_arg(param, long);
+ data->set.headers = va_arg(param, struct curl_slist *);
break;
- case CURLOPT_INFILESIZE_LARGE:
+
+ case CURLOPT_HTTP200ALIASES:
/*
- * If known, this should inform curl about the file size of the
- * to-be-uploaded file.
+ * Set a list of aliases for HTTP 200 in response header
*/
- data->set.infilesize = va_arg(param, curl_off_t);
+ data->set.http200aliases = va_arg(param, struct curl_slist *);
break;
- case CURLOPT_LOW_SPEED_LIMIT:
+
+ case CURLOPT_COOKIE:
/*
- * The low speed limit that if transfers are below this for
- * CURLOPT_LOW_SPEED_TIME, the transfer is aborted.
+ * Cookie string to send to the remote server in the request.
*/
- data->set.low_speed_limit=va_arg(param, long);
+ data->set.cookie = va_arg(param, char *);
break;
- case CURLOPT_LOW_SPEED_TIME:
+
+ case CURLOPT_COOKIEFILE:
/*
- * The low speed time that if transfers are below the set
- * CURLOPT_LOW_SPEED_LIMIT during this time, the transfer is aborted.
+ * Set cookie file to read and parse. Can be used multiple times.
*/
- data->set.low_speed_time=va_arg(param, long);
+ cookiefile = (char *)va_arg(param, void *);
+ if(cookiefile) {
+ struct curl_slist *cl;
+ /* append the cookie file name to the list of file names, and deal with
+ them later */
+ cl = curl_slist_append(data->change.cookielist, cookiefile);
+
+ if(!cl)
+ return CURLE_OUT_OF_MEMORY;
+
+ data->change.cookielist = cl;
+ }
break;
- case CURLOPT_URL:
+
+ case CURLOPT_COOKIEJAR:
/*
- * The URL to fetch.
+ * Set cookie file name to dump all cookies to when we're done.
*/
- if(data->change.url_alloc) {
- /* the already set URL is allocated, free it first! */
- free(data->change.url);
- data->change.url_alloc=FALSE;
- }
- data->set.set_url = va_arg(param, char *);
- data->change.url = data->set.set_url;
- data->change.url_changed = TRUE;
- break;
- case CURLOPT_PORT:
+ data->set.cookiejar = (char *)va_arg(param, void *);
+
/*
- * The port number to use when getting the URL
+ * Activate the cookie parser. This may or may not already
+ * have been made.
*/
- data->set.use_port = va_arg(param, long);
- break;
- case CURLOPT_POST:
- /* Does this option serve a purpose anymore? Yes it does, when
- CURLOPT_POSTFIELDS isn't used and the POST data is read off the
- callback! */
- if(va_arg(param, long))
- data->set.httpreq = HTTPREQ_POST;
+ data->cookies = Curl_cookie_init(data, NULL, data->cookies,
+ data->set.cookiesession);
break;
- case CURLOPT_POSTFIELDS:
+
+ case CURLOPT_COOKIESESSION:
/*
- * A string with POST data. Makes curl HTTP POST.
+ * Set this option to TRUE to start a new "cookie session". It will
+ * prevent the forthcoming read-cookies-from-file actions to accept
+ * cookies that are marked as being session cookies, as they belong to a
+ * previous session.
+ *
+ * In the original Netscape cookie spec, "session cookies" are cookies
+ * with no expire date set. RFC2109 describes the same action if no
+ * 'Max-Age' is set and RFC2965 includes the RFC2109 description and adds
+ * a 'Discard' action that can enforce the discard even for cookies that
+ * have a Max-Age.
+ *
+ * We run mostly with the original cookie spec, as hardly anyone implements
+ * anything else.
*/
- data->set.postfields = va_arg(param, char *);
- if(data->set.postfields)
- data->set.httpreq = HTTPREQ_POST;
+ data->set.cookiesession = (bool)va_arg(param, long);
break;
- case CURLOPT_POSTFIELDSIZE:
+
+ case CURLOPT_HTTPGET:
/*
- * The size of the POSTFIELD data to prevent libcurl to do strlen() to
- * figure it out. Enables binary posts.
+ * Set to force us do HTTP GET
*/
- data->set.postfieldsize = va_arg(param, long);
+ if(va_arg(param, long)) {
+ data->set.httpreq = HTTPREQ_GET;
+ data->set.upload = FALSE; /* switch off upload */
+ }
break;
- case CURLOPT_POSTFIELDSIZE_LARGE:
+
+ case CURLOPT_HTTP_VERSION:
/*
- * The size of the POSTFIELD data to prevent libcurl to do strlen() to
- * figure it out. Enables binary posts.
+ * This sets a requested HTTP version to be used. The value is one of
+ * the listed enums in curl/curl.h.
*/
- data->set.postfieldsize = va_arg(param, curl_off_t);
+ data->set.httpversion = va_arg(param, long);
break;
- case CURLOPT_REFERER:
+
+ case CURLOPT_HTTPPROXYTUNNEL:
/*
- * String to set in the HTTP Referer: field.
+ * Tunnel operations through the proxy instead of normal proxy use
*/
- if(data->change.referer_alloc) {
- free(data->change.referer);
- data->change.referer_alloc = FALSE;
- }
- data->set.set_referer = va_arg(param, char *);
- data->change.referer = data->set.set_referer;
+ data->set.tunnel_thru_httpproxy = va_arg(param, long)?TRUE:FALSE;
break;
- case CURLOPT_AUTOREFERER:
+
+ case CURLOPT_CUSTOMREQUEST:
/*
- * Switch on automatic referer that gets set if curl follows locations.
+ * Set a custom string to use as request
*/
- data->set.http_auto_referer = va_arg(param, long)?1:0;
+ data->set.customrequest = va_arg(param, char *);
+
+ /* we don't set
+ data->set.httpreq = HTTPREQ_CUSTOM;
+ here, we continue as if we were using the already set type
+ and this just changes the actual request keyword */
break;
+
case CURLOPT_PROXY:
/*
* Set proxy server:port to use as HTTP proxy.
@@ -857,58 +823,13 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
data->set.set_proxy = va_arg(param, char *);
data->change.proxy = data->set.set_proxy;
break;
- case CURLOPT_HTTPPROXYTUNNEL:
- /*
- * Tunnel operations through the proxy instead of normal proxy use
- */
- data->set.tunnel_thru_httpproxy = va_arg(param, long)?TRUE:FALSE;
- break;
+
case CURLOPT_PROXYPORT:
/*
* Explicitly set HTTP proxy port number.
*/
data->set.proxyport = va_arg(param, long);
break;
- case CURLOPT_TIMEOUT:
- /*
- * The maximum time you allow curl to use for a single transfer
- * operation.
- */
- data->set.timeout = va_arg(param, long);
- break;
- case CURLOPT_CONNECTTIMEOUT:
- /*
- * The maximum time you allow curl to use to connect.
- */
- data->set.connecttimeout = va_arg(param, long);
- break;
- case CURLOPT_MAXREDIRS:
- /*
- * The maximum amount of hops you allow curl to follow Location:
- * headers. This should mostly be used to detect never-ending loops.
- */
- data->set.maxredirs = va_arg(param, long);
- break;
- case CURLOPT_USERAGENT:
- /*
- * String to use in the HTTP User-Agent field
- */
- data->set.useragent = va_arg(param, char *);
- break;
- case CURLOPT_ENCODING:
- /*
- * String to use at the value of Accept-Encoding header.
- *
- * If the encoding is set to "" we use an Accept-Encoding header that
- * encompasses all the encodings we support.
- * If the encoding is set to NULL we don't send an Accept-Encoding header
- * and ignore an received Content-Encoding header.
- *
- */
- data->set.encoding = va_arg(param, char *);
- if(data->set.encoding && !*data->set.encoding)
- data->set.encoding = (char*)ALL_CONTENT_ENCODINGS;
- break;
case CURLOPT_HTTPAUTH:
/*
@@ -949,6 +870,110 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
data->set.proxyauth = auth;
}
break;
+#endif /* CURL_DISABLE_HTTP */
+
+ case CURLOPT_WRITEHEADER:
+ /*
+ * Custom pointer to pass the header write callback function
+ */
+ data->set.writeheader = (void *)va_arg(param, void *);
+ break;
+ case CURLOPT_ERRORBUFFER:
+ /*
+ * Error buffer provided by the caller to get the human readable
+ * error string in.
+ */
+ data->set.errorbuffer = va_arg(param, char *);
+ break;
+ case CURLOPT_FILE:
+ /*
+ * FILE pointer to write to or include in the data write callback
+ */
+ data->set.out = va_arg(param, FILE *);
+ break;
+ case CURLOPT_FTPPORT:
+ /*
+ * Use FTP PORT, this also specifies which IP address to use
+ */
+ data->set.ftpport = va_arg(param, char *);
+ data->set.ftp_use_port = data->set.ftpport?1:0;
+ break;
+
+ case CURLOPT_FTP_USE_EPRT:
+ data->set.ftp_use_eprt = va_arg(param, long)?TRUE:FALSE;
+ break;
+
+ case CURLOPT_FTP_USE_EPSV:
+ data->set.ftp_use_epsv = va_arg(param, long)?TRUE:FALSE;
+ break;
+
+ case CURLOPT_INFILE:
+ /*
+ * FILE pointer to read the file to be uploaded from. Or possibly
+ * used as argument to the read callback.
+ */
+ data->set.in = va_arg(param, FILE *);
+ break;
+ case CURLOPT_INFILESIZE:
+ /*
+ * If known, this should inform curl about the file size of the
+ * to-be-uploaded file.
+ */
+ data->set.infilesize = va_arg(param, long);
+ break;
+ case CURLOPT_INFILESIZE_LARGE:
+ /*
+ * If known, this should inform curl about the file size of the
+ * to-be-uploaded file.
+ */
+ data->set.infilesize = va_arg(param, curl_off_t);
+ break;
+ case CURLOPT_LOW_SPEED_LIMIT:
+ /*
+ * The low speed limit that if transfers are below this for
+ * CURLOPT_LOW_SPEED_TIME, the transfer is aborted.
+ */
+ data->set.low_speed_limit=va_arg(param, long);
+ break;
+ case CURLOPT_LOW_SPEED_TIME:
+ /*
+ * The low speed time that if transfers are below the set
+ * CURLOPT_LOW_SPEED_LIMIT during this time, the transfer is aborted.
+ */
+ data->set.low_speed_time=va_arg(param, long);
+ break;
+ case CURLOPT_URL:
+ /*
+ * The URL to fetch.
+ */
+ if(data->change.url_alloc) {
+ /* the already set URL is allocated, free it first! */
+ free(data->change.url);
+ data->change.url_alloc=FALSE;
+ }
+ data->set.set_url = va_arg(param, char *);
+ data->change.url = data->set.set_url;
+ data->change.url_changed = TRUE;
+ break;
+ case CURLOPT_PORT:
+ /*
+ * The port number to use when getting the URL
+ */
+ data->set.use_port = va_arg(param, long);
+ break;
+ case CURLOPT_TIMEOUT:
+ /*
+ * The maximum time you allow curl to use for a single transfer
+ * operation.
+ */
+ data->set.timeout = va_arg(param, long);
+ break;
+ case CURLOPT_CONNECTTIMEOUT:
+ /*
+ * The maximum time you allow curl to use to connect.
+ */
+ data->set.connecttimeout = va_arg(param, long);
+ break;
case CURLOPT_USERPWD:
/*
@@ -1262,22 +1287,22 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
data->hostcache = data->share->hostcache;
}
-
+#ifndef CURL_DISABLE_HTTP
if(data->share->cookies) {
/* use shared cookie list, first free own one if any */
if (data->cookies)
Curl_cookie_cleanup(data->cookies);
data->cookies = data->share->cookies;
}
-
+#endif /* CURL_DISABLE_HTTP */
Curl_share_unlock(data, CURL_LOCK_DATA_SHARE);
}
-
+#ifndef CURL_DISABLE_HTTP
/* check cookie list is set */
if(!data->cookies)
data->cookies = Curl_cookie_init(data, NULL, NULL, TRUE );
-
+#endif /* CURL_DISABLE_HTTP */
/* check for host cache not needed,
* it will be done by curl_easy_perform */
}
@@ -1297,13 +1322,6 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
data->set.private = va_arg(param, char *);
break;
- case CURLOPT_HTTP200ALIASES:
- /*
- * Set a list of aliases for HTTP 200 in response header
- */
- data->set.http200aliases = va_arg(param, struct curl_slist *);
- break;
-
case CURLOPT_MAXFILESIZE:
/*
* Set the maximum size of a file to download.