mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 15:48:49 -05:00
Alexander Krasnostavsky's fix to make libcurl build fine with configure
--disable-http, which thus builds a libcurl without HTTP support.
This commit is contained in:
parent
6ec145d4b4
commit
90037b85d1
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
492
lib/url.c
492
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,26 +586,135 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
|
||||
data->set.ssl.version = va_arg(param, long);
|
||||
break;
|
||||
|
||||
case CURLOPT_COOKIESESSION:
|
||||
#ifndef CURL_DISABLE_HTTP
|
||||
case CURLOPT_AUTOREFERER:
|
||||
/*
|
||||
* 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.
|
||||
* Switch on automatic referer that gets set if curl follows locations.
|
||||
*/
|
||||
data->set.cookiesession = (bool)va_arg(param, long);
|
||||
data->set.http_auto_referer = va_arg(param, long)?1:0;
|
||||
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_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_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_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_POSTFIELDS:
|
||||
/*
|
||||
* A string with POST data. Makes curl HTTP POST.
|
||||
*/
|
||||
data->set.postfields = va_arg(param, char *);
|
||||
if(data->set.postfields)
|
||||
data->set.httpreq = HTTPREQ_POST;
|
||||
break;
|
||||
|
||||
case CURLOPT_POSTFIELDSIZE:
|
||||
/*
|
||||
* The size of the POSTFIELD data to prevent libcurl to do strlen() to
|
||||
* figure it out. Enables binary posts.
|
||||
*/
|
||||
data->set.postfieldsize = va_arg(param, long);
|
||||
break;
|
||||
|
||||
case CURLOPT_POSTFIELDSIZE_LARGE:
|
||||
/*
|
||||
* The size of the POSTFIELD data to prevent libcurl to do strlen() to
|
||||
* figure it out. Enables binary posts.
|
||||
*/
|
||||
data->set.postfieldsize = va_arg(param, curl_off_t);
|
||||
break;
|
||||
|
||||
case CURLOPT_HTTPPOST:
|
||||
/*
|
||||
* Set to make us do HTTP POST
|
||||
*/
|
||||
data->set.httppost = va_arg(param, struct curl_httppost *);
|
||||
if(data->set.httppost)
|
||||
data->set.httpreq = HTTPREQ_POST_FORM;
|
||||
break;
|
||||
|
||||
case CURLOPT_REFERER:
|
||||
/*
|
||||
* String to set in the HTTP Referer: field.
|
||||
*/
|
||||
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_USERAGENT:
|
||||
/*
|
||||
* String to use in the HTTP User-Agent field
|
||||
*/
|
||||
data->set.useragent = va_arg(param, char *);
|
||||
break;
|
||||
|
||||
case CURLOPT_HTTPHEADER:
|
||||
/*
|
||||
* Set a list with HTTP headers to use (or replace internals with)
|
||||
*/
|
||||
data->set.headers = va_arg(param, struct curl_slist *);
|
||||
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_COOKIE:
|
||||
/*
|
||||
* Cookie string to send to the remote server in the request.
|
||||
*/
|
||||
data->set.cookie = va_arg(param, char *);
|
||||
break;
|
||||
|
||||
#ifndef CURL_DISABLE_HTTP
|
||||
case CURLOPT_COOKIEFILE:
|
||||
/*
|
||||
* Set cookie file to read and parse. Can be used multiple times.
|
||||
@ -658,7 +746,131 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
|
||||
data->cookies = Curl_cookie_init(data, NULL, data->cookies,
|
||||
data->set.cookiesession);
|
||||
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;
|
||||
|
||||
case CURLOPT_HTTPGET:
|
||||
/*
|
||||
* Set to force us do HTTP GET
|
||||
*/
|
||||
if(va_arg(param, long)) {
|
||||
data->set.httpreq = HTTPREQ_GET;
|
||||
data->set.upload = FALSE; /* switch off upload */
|
||||
}
|
||||
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_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_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_PROXY:
|
||||
/*
|
||||
* Set proxy server:port to use as HTTP proxy.
|
||||
*
|
||||
* If the proxy is set to "" we explicitly say that we don't want to use a
|
||||
* proxy (even though there might be environment variables saying so).
|
||||
*
|
||||
* Setting it to NULL, means no proxy but allows the environment variables
|
||||
* to decide for us.
|
||||
*/
|
||||
if(data->change.proxy_alloc) {
|
||||
/*
|
||||
* The already set string is allocated, free that first
|
||||
*/
|
||||
data->change.proxy_alloc=FALSE;;
|
||||
free(data->change.proxy);
|
||||
}
|
||||
data->set.set_proxy = va_arg(param, char *);
|
||||
data->change.proxy = data->set.set_proxy;
|
||||
break;
|
||||
|
||||
case CURLOPT_PROXYPORT:
|
||||
/*
|
||||
* Explicitly set HTTP proxy port number.
|
||||
*/
|
||||
data->set.proxyport = va_arg(param, long);
|
||||
break;
|
||||
|
||||
case CURLOPT_HTTPAUTH:
|
||||
/*
|
||||
* Set HTTP Authentication type BITMASK.
|
||||
*/
|
||||
{
|
||||
long auth = va_arg(param, long);
|
||||
/* switch off bits we can't support */
|
||||
#ifndef USE_SSLEAY
|
||||
auth &= ~CURLAUTH_NTLM; /* no NTLM without SSL */
|
||||
#endif
|
||||
#ifndef HAVE_GSSAPI
|
||||
auth &= ~CURLAUTH_GSSNEGOTIATE; /* no GSS-Negotiate without GSSAPI */
|
||||
#endif
|
||||
if(!auth)
|
||||
return CURLE_FAILED_INIT; /* no supported types left! */
|
||||
|
||||
data->set.httpauth = auth;
|
||||
}
|
||||
break;
|
||||
|
||||
case CURLOPT_PROXYAUTH:
|
||||
/*
|
||||
* Set HTTP Authentication type BITMASK.
|
||||
*/
|
||||
{
|
||||
long auth = va_arg(param, long);
|
||||
/* switch off bits we can't support */
|
||||
#ifndef USE_SSLEAY
|
||||
auth &= ~CURLAUTH_NTLM; /* no NTLM without SSL */
|
||||
#endif
|
||||
#ifndef HAVE_GSSAPI
|
||||
auth &= ~CURLAUTH_GSSNEGOTIATE; /* no GSS-Negotiate without GSSAPI */
|
||||
#endif
|
||||
if(!auth)
|
||||
return CURLE_FAILED_INIT; /* no supported types left! */
|
||||
|
||||
data->set.proxyauth = auth;
|
||||
}
|
||||
break;
|
||||
#endif /* CURL_DISABLE_HTTP */
|
||||
|
||||
case CURLOPT_WRITEHEADER:
|
||||
/*
|
||||
@ -666,12 +878,6 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
|
||||
*/
|
||||
data->set.writeheader = (void *)va_arg(param, void *);
|
||||
break;
|
||||
case CURLOPT_COOKIE:
|
||||
/*
|
||||
* Cookie string to send to the remote server in the request.
|
||||
*/
|
||||
data->set.cookie = va_arg(param, char *);
|
||||
break;
|
||||
case CURLOPT_ERRORBUFFER:
|
||||
/*
|
||||
* Error buffer provided by the caller to get the human readable
|
||||
@ -701,42 +907,6 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
|
||||
data->set.ftp_use_epsv = va_arg(param, long)?TRUE:FALSE;
|
||||
break;
|
||||
|
||||
case CURLOPT_HTTPHEADER:
|
||||
/*
|
||||
* Set a list with HTTP headers to use (or replace internals with)
|
||||
*/
|
||||
data->set.headers = va_arg(param, struct curl_slist *);
|
||||
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
|
||||
*/
|
||||
data->set.httppost = va_arg(param, struct curl_httppost *);
|
||||
if(data->set.httppost)
|
||||
data->set.httpreq = HTTPREQ_POST_FORM;
|
||||
break;
|
||||
|
||||
case CURLOPT_HTTPGET:
|
||||
/*
|
||||
* Set to force us do HTTP GET
|
||||
*/
|
||||
if(va_arg(param, long)) {
|
||||
data->set.httpreq = HTTPREQ_GET;
|
||||
data->set.upload = FALSE; /* switch off upload */
|
||||
}
|
||||
break;
|
||||
|
||||
case CURLOPT_INFILE:
|
||||
/*
|
||||
* FILE pointer to read the file to be uploaded from. Or possibly
|
||||
@ -791,84 +961,6 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
|
||||
*/
|
||||
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;
|
||||
break;
|
||||
case CURLOPT_POSTFIELDS:
|
||||
/*
|
||||
* A string with POST data. Makes curl HTTP POST.
|
||||
*/
|
||||
data->set.postfields = va_arg(param, char *);
|
||||
if(data->set.postfields)
|
||||
data->set.httpreq = HTTPREQ_POST;
|
||||
break;
|
||||
case CURLOPT_POSTFIELDSIZE:
|
||||
/*
|
||||
* The size of the POSTFIELD data to prevent libcurl to do strlen() to
|
||||
* figure it out. Enables binary posts.
|
||||
*/
|
||||
data->set.postfieldsize = va_arg(param, long);
|
||||
break;
|
||||
case CURLOPT_POSTFIELDSIZE_LARGE:
|
||||
/*
|
||||
* The size of the POSTFIELD data to prevent libcurl to do strlen() to
|
||||
* figure it out. Enables binary posts.
|
||||
*/
|
||||
data->set.postfieldsize = va_arg(param, curl_off_t);
|
||||
break;
|
||||
case CURLOPT_REFERER:
|
||||
/*
|
||||
* String to set in the HTTP Referer: field.
|
||||
*/
|
||||
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_AUTOREFERER:
|
||||
/*
|
||||
* Switch on automatic referer that gets set if curl follows locations.
|
||||
*/
|
||||
data->set.http_auto_referer = va_arg(param, long)?1:0;
|
||||
break;
|
||||
case CURLOPT_PROXY:
|
||||
/*
|
||||
* Set proxy server:port to use as HTTP proxy.
|
||||
*
|
||||
* If the proxy is set to "" we explicitly say that we don't want to use a
|
||||
* proxy (even though there might be environment variables saying so).
|
||||
*
|
||||
* Setting it to NULL, means no proxy but allows the environment variables
|
||||
* to decide for us.
|
||||
*/
|
||||
if(data->change.proxy_alloc) {
|
||||
/*
|
||||
* The already set string is allocated, free that first
|
||||
*/
|
||||
data->change.proxy_alloc=FALSE;;
|
||||
free(data->change.proxy);
|
||||
}
|
||||
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
|
||||
@ -882,73 +974,6 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
|
||||
*/
|
||||
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:
|
||||
/*
|
||||
* Set HTTP Authentication type BITMASK.
|
||||
*/
|
||||
{
|
||||
long auth = va_arg(param, long);
|
||||
/* switch off bits we can't support */
|
||||
#ifndef USE_SSLEAY
|
||||
auth &= ~CURLAUTH_NTLM; /* no NTLM without SSL */
|
||||
#endif
|
||||
#ifndef HAVE_GSSAPI
|
||||
auth &= ~CURLAUTH_GSSNEGOTIATE; /* no GSS-Negotiate without GSSAPI */
|
||||
#endif
|
||||
if(!auth)
|
||||
return CURLE_FAILED_INIT; /* no supported types left! */
|
||||
|
||||
data->set.httpauth = auth;
|
||||
}
|
||||
break;
|
||||
|
||||
case CURLOPT_PROXYAUTH:
|
||||
/*
|
||||
* Set HTTP Authentication type BITMASK.
|
||||
*/
|
||||
{
|
||||
long auth = va_arg(param, long);
|
||||
/* switch off bits we can't support */
|
||||
#ifndef USE_SSLEAY
|
||||
auth &= ~CURLAUTH_NTLM; /* no NTLM without SSL */
|
||||
#endif
|
||||
#ifndef HAVE_GSSAPI
|
||||
auth &= ~CURLAUTH_GSSNEGOTIATE; /* no GSS-Negotiate without GSSAPI */
|
||||
#endif
|
||||
if(!auth)
|
||||
return CURLE_FAILED_INIT; /* no supported types left! */
|
||||
|
||||
data->set.proxyauth = auth;
|
||||
}
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user