aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/url.c209
1 files changed, 101 insertions, 108 deletions
diff --git a/lib/url.c b/lib/url.c
index 58c7331c8..9baa4b368 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -787,16 +787,16 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
data->set.dns_cache_timeout = va_arg(param, long);
break;
case CURLOPT_DNS_USE_GLOBAL_CACHE:
- {
- /* remember we want this enabled */
- long use_cache = va_arg(param, long);
- data->set.global_dns_cache = (bool)(0 != use_cache);
- }
- break;
+ {
+ /* remember we want this enabled */
+ long use_cache = va_arg(param, long);
+ data->set.global_dns_cache = (bool)(0 != use_cache);
+ }
+ break;
case CURLOPT_SSL_CIPHER_LIST:
/* set a list of cipher we want to use in the SSL connection */
result = setstropt(&data->set.str[STRING_SSL_CIPHER_LIST],
- va_arg(param, char *));
+ va_arg(param, char *));
break;
case CURLOPT_RANDOM_FILE:
@@ -805,14 +805,14 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* the random SSL stuff with. The file is only used for reading.
*/
result = setstropt(&data->set.str[STRING_SSL_RANDOM_FILE],
- va_arg(param, char *));
+ va_arg(param, char *));
break;
case CURLOPT_EGDSOCKET:
/*
* The Entropy Gathering Daemon socket pathname
*/
result = setstropt(&data->set.str[STRING_SSL_EGDSOCKET],
- va_arg(param, char *));
+ va_arg(param, char *));
break;
case CURLOPT_MAXCONNECTS:
/*
@@ -940,7 +940,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* Use this file instead of the $HOME/.netrc file
*/
result = setstropt(&data->set.str[STRING_NETRC_FILE],
- va_arg(param, char *));
+ va_arg(param, char *));
break;
case CURLOPT_TRANSFERTEXT:
/*
@@ -993,8 +993,8 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
*/
argptr = va_arg(param, char *);
result = setstropt(&data->set.str[STRING_ENCODING],
- (argptr && !*argptr)?
- (char *) ALL_CONTENT_ENCODINGS: argptr);
+ (argptr && !*argptr)?
+ (char *) ALL_CONTENT_ENCODINGS: argptr);
break;
case CURLOPT_FOLLOWLOCATION:
@@ -1056,8 +1056,8 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
*/
if((data->set.postfieldsize < 0) ||
- ((sizeof(curl_off_t) != sizeof(size_t)) &&
- (data->set.postfieldsize > (curl_off_t)((size_t)-1))))
+ ((sizeof(curl_off_t) != sizeof(size_t)) &&
+ (data->set.postfieldsize > (curl_off_t)((size_t)-1))))
result = CURLE_OUT_OF_MEMORY;
else {
char * p;
@@ -1068,7 +1068,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
later address compare to detect the COPYPOSTFIELDS mode, and
to mark that postfields is used rather than read function or
form data.
- */
+ */
p = malloc((size_t)(data->set.postfieldsize?data->set.postfieldsize:1));
if(!p)
@@ -1104,11 +1104,11 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
bigsize = va_arg(param, long);
if(data->set.postfieldsize < bigsize &&
- data->set.postfields == data->set.str[STRING_COPYPOSTFIELDS]) {
+ data->set.postfields == data->set.str[STRING_COPYPOSTFIELDS]) {
/* Previous CURLOPT_COPYPOSTFIELDS is no longer valid. */
(void) setstropt(&data->set.str[STRING_COPYPOSTFIELDS], NULL);
data->set.postfields = NULL;
- }
+ }
data->set.postfieldsize = bigsize;
break;
@@ -1121,11 +1121,11 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
bigsize = va_arg(param, curl_off_t);
if(data->set.postfieldsize < bigsize &&
- data->set.postfields == data->set.str[STRING_COPYPOSTFIELDS]) {
+ data->set.postfields == data->set.str[STRING_COPYPOSTFIELDS]) {
/* Previous CURLOPT_COPYPOSTFIELDS is no longer valid. */
(void) setstropt(&data->set.str[STRING_COPYPOSTFIELDS], NULL);
data->set.postfields = NULL;
- }
+ }
data->set.postfieldsize = bigsize;
break;
@@ -1148,7 +1148,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
data->change.referer_alloc = FALSE;
}
result = setstropt(&data->set.str[STRING_SET_REFERER],
- va_arg(param, char *));
+ va_arg(param, char *));
data->change.referer = data->set.str[STRING_SET_REFERER];
break;
@@ -1157,7 +1157,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* String to use in the HTTP User-Agent field
*/
result = setstropt(&data->set.str[STRING_USERAGENT],
- va_arg(param, char *));
+ va_arg(param, char *));
break;
case CURLOPT_HTTPHEADER:
@@ -1180,7 +1180,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* Cookie string to send to the remote server in the request.
*/
result = setstropt(&data->set.str[STRING_COOKIE],
- va_arg(param, char *));
+ va_arg(param, char *));
break;
case CURLOPT_COOKIEFILE:
@@ -1206,7 +1206,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* Set cookie file name to dump all cookies to when we're done.
*/
result = setstropt(&data->set.str[STRING_COOKIEJAR],
- va_arg(param, char *));
+ va_arg(param, char *));
/*
* Activate the cookie parser. This may or may not already
@@ -1310,7 +1310,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* Set a custom string to use as request
*/
result = setstropt(&data->set.str[STRING_CUSTOMREQUEST],
- va_arg(param, char *));
+ va_arg(param, char *));
/* we don't set
data->set.httpreq = HTTPREQ_CUSTOM;
@@ -1377,7 +1377,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* to decide for us.
*/
result = setstropt(&data->set.str[STRING_PROXY],
- va_arg(param, char *));
+ va_arg(param, char *));
break;
case CURLOPT_WRITEHEADER:
@@ -1404,7 +1404,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* Use FTP PORT, this also specifies which IP address to use
*/
result = setstropt(&data->set.str[STRING_FTPPORT],
- va_arg(param, char *));
+ va_arg(param, char *));
data->set.ftp_use_port = (bool)(NULL != data->set.str[STRING_FTPPORT]);
break;
@@ -1489,7 +1489,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
data->change.url_alloc=FALSE;
}
result = setstropt(&data->set.str[STRING_SET_URL],
- va_arg(param, char *));
+ va_arg(param, char *));
data->change.url = data->set.str[STRING_SET_URL];
break;
case CURLOPT_PORT:
@@ -1526,7 +1526,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* user:password to use in the operation
*/
result = setstropt(&data->set.str[STRING_USERPWD],
- va_arg(param, char *));
+ va_arg(param, char *));
break;
case CURLOPT_POSTQUOTE:
/*
@@ -1568,14 +1568,14 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* user:password needed to use the proxy
*/
result = setstropt(&data->set.str[STRING_PROXYUSERPWD],
- va_arg(param, char *));
+ va_arg(param, char *));
break;
case CURLOPT_RANGE:
/*
* What range of the file you want to transfer
*/
result = setstropt(&data->set.str[STRING_SET_RANGE],
- va_arg(param, char *));
+ va_arg(param, char *));
break;
case CURLOPT_RESUME_FROM:
/*
@@ -1685,35 +1685,35 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* String that holds file name of the SSL certificate to use
*/
result = setstropt(&data->set.str[STRING_CERT],
- va_arg(param, char *));
+ va_arg(param, char *));
break;
case CURLOPT_SSLCERTTYPE:
/*
* String that holds file type of the SSL certificate to use
*/
result = setstropt(&data->set.str[STRING_CERT_TYPE],
- va_arg(param, char *));
+ va_arg(param, char *));
break;
case CURLOPT_SSLKEY:
/*
* String that holds file name of the SSL certificate to use
*/
result = setstropt(&data->set.str[STRING_KEY],
- va_arg(param, char *));
+ va_arg(param, char *));
break;
case CURLOPT_SSLKEYTYPE:
/*
* String that holds file type of the SSL certificate to use
*/
result = setstropt(&data->set.str[STRING_KEY_TYPE],
- va_arg(param, char *));
+ va_arg(param, char *));
break;
case CURLOPT_KEYPASSWD:
/*
* String that holds the SSL or SSH private key password.
*/
result = setstropt(&data->set.str[STRING_KEY_PASSWD],
- va_arg(param, char *));
+ va_arg(param, char *));
break;
case CURLOPT_SSLENGINE:
/*
@@ -1721,7 +1721,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
*/
argptr = va_arg(param, char *);
if(argptr && argptr[0])
- result = Curl_ssl_set_engine(data, argptr);
+ result = Curl_ssl_set_engine(data, argptr);
break;
case CURLOPT_SSLENGINE_DEFAULT:
@@ -1743,7 +1743,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* performing an operation and thus what from-IP your connection will use.
*/
result = setstropt(&data->set.str[STRING_DEVICE],
- va_arg(param, char *));
+ va_arg(param, char *));
break;
case CURLOPT_LOCALPORT:
/*
@@ -1762,7 +1762,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* A string that defines the kerberos security level.
*/
result = setstropt(&data->set.str[STRING_KRB_LEVEL],
- va_arg(param, char *));
+ va_arg(param, char *));
data->set.krb = (bool)(NULL != data->set.str[STRING_KRB_LEVEL]);
break;
case CURLOPT_SSL_VERIFYPEER:
@@ -1800,7 +1800,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* Set CA info for SSL connection. Specify file name of the CA certificate
*/
result = setstropt(&data->set.str[STRING_SSL_CAFILE],
- va_arg(param, char *));
+ va_arg(param, char *));
break;
case CURLOPT_CAPATH:
/*
@@ -1809,7 +1809,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
*/
/* This does not work on windows. */
result = setstropt(&data->set.str[STRING_SSL_CAPATH],
- va_arg(param, char *));
+ va_arg(param, char *));
break;
case CURLOPT_CRLFILE:
/*
@@ -1856,60 +1856,60 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
break;
case CURLOPT_SHARE:
- {
- struct Curl_share *set;
- set = va_arg(param, struct Curl_share *);
+ {
+ struct Curl_share *set;
+ set = va_arg(param, struct Curl_share *);
- /* disconnect from old share, if any */
- if(data->share) {
- Curl_share_lock(data, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE);
+ /* disconnect from old share, if any */
+ if(data->share) {
+ Curl_share_lock(data, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE);
- if(data->dns.hostcachetype == HCACHE_SHARED) {
- data->dns.hostcache = NULL;
- data->dns.hostcachetype = HCACHE_NONE;
- }
+ if(data->dns.hostcachetype == HCACHE_SHARED) {
+ data->dns.hostcache = NULL;
+ data->dns.hostcachetype = HCACHE_NONE;
+ }
- if(data->share->cookies == data->cookies)
- data->cookies = NULL;
+ if(data->share->cookies == data->cookies)
+ data->cookies = NULL;
- data->share->dirty--;
+ data->share->dirty--;
- Curl_share_unlock(data, CURL_LOCK_DATA_SHARE);
- data->share = NULL;
- }
+ Curl_share_unlock(data, CURL_LOCK_DATA_SHARE);
+ data->share = NULL;
+ }
- /* use new share if it set */
- data->share = set;
- if(data->share) {
+ /* use new share if it set */
+ data->share = set;
+ if(data->share) {
- Curl_share_lock(data, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE);
+ Curl_share_lock(data, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE);
- data->share->dirty++;
+ data->share->dirty++;
- if(data->share->hostcache) {
- /* use shared host cache, first free the private one if any */
- if(data->dns.hostcachetype == HCACHE_PRIVATE)
- Curl_hash_destroy(data->dns.hostcache);
+ if(data->share->hostcache) {
+ /* use shared host cache, first free the private one if any */
+ if(data->dns.hostcachetype == HCACHE_PRIVATE)
+ Curl_hash_destroy(data->dns.hostcache);
- data->dns.hostcache = data->share->hostcache;
- data->dns.hostcachetype = HCACHE_SHARED;
- }
+ data->dns.hostcache = data->share->hostcache;
+ data->dns.hostcachetype = HCACHE_SHARED;
+ }
#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)
- Curl_cookie_cleanup(data->cookies);
- /* enable cookies since we now use a share that uses cookies! */
- data->cookies = data->share->cookies;
- }
+ if(data->share->cookies) {
+ /* use shared cookie list, first free own one if any */
+ if(data->cookies)
+ Curl_cookie_cleanup(data->cookies);
+ /* enable cookies since we now use a share that uses cookies! */
+ data->cookies = data->share->cookies;
+ }
#endif /* CURL_DISABLE_HTTP */
- Curl_share_unlock(data, CURL_LOCK_DATA_SHARE);
+ Curl_share_unlock(data, CURL_LOCK_DATA_SHARE);
- }
- /* check for host cache not needed,
- * it will be done by curl_easy_perform */
}
- break;
+ /* check for host cache not needed,
+ * it will be done by curl_easy_perform */
+ }
+ break;
case CURLOPT_PROXYTYPE:
/*
@@ -1965,17 +1965,9 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
data->set.tcp_nodelay = (bool)(0 != va_arg(param, long));
break;
- /*
- case CURLOPT_SOURCE_URL:
- case CURLOPT_SOURCE_USERPWD:
- case CURLOPT_SOURCE_QUOTE:
- case CURLOPT_SOURCE_PREQUOTE:
- case CURLOPT_SOURCE_POSTQUOTE:
- These former 3rd party transfer options are deprecated */
-
case CURLOPT_FTP_ACCOUNT:
result = setstropt(&data->set.str[STRING_FTP_ACCOUNT],
- va_arg(param, char *));
+ va_arg(param, char *));
break;
case CURLOPT_IGNORE_CONTENT_LENGTH:
@@ -1991,7 +1983,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
case CURLOPT_FTP_ALTERNATIVE_TO_USER:
result = setstropt(&data->set.str[STRING_FTP_ALTERNATIVE_TO_USER],
- va_arg(param, char *));
+ va_arg(param, char *));
break;
case CURLOPT_SOCKOPTFUNCTION:
@@ -2036,7 +2028,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* Use this file instead of the $HOME/.ssh/id_dsa.pub file
*/
result = setstropt(&data->set.str[STRING_SSH_PUBLIC_KEY],
- va_arg(param, char *));
+ va_arg(param, char *));
break;
case CURLOPT_SSH_PRIVATE_KEYFILE:
@@ -2044,7 +2036,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* Use this file instead of the $HOME/.ssh/id_dsa file
*/
result = setstropt(&data->set.str[STRING_SSH_PRIVATE_KEY],
- va_arg(param, char *));
+ va_arg(param, char *));
break;
case CURLOPT_SSH_HOST_PUBLIC_KEY_MD5:
/*
@@ -2052,7 +2044,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* for validation purposes.
*/
result = setstropt(&data->set.str[STRING_SSH_HOST_PUBLIC_KEY_MD5],
- va_arg(param, char *));
+ va_arg(param, char *));
break;
case CURLOPT_HTTP_TRANSFER_DECODING:
/*
@@ -2086,16 +2078,16 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy
*/
switch (va_arg(param, long)) {
- case 0:
- data->set.proxy_transfer_mode = FALSE;
- break;
- case 1:
- data->set.proxy_transfer_mode = TRUE;
- break;
- default:
- /* reserve other values for future use */
- result = CURLE_FAILED_INIT;
- break;
+ case 0:
+ data->set.proxy_transfer_mode = FALSE;
+ break;
+ case 1:
+ data->set.proxy_transfer_mode = TRUE;
+ break;
+ default:
+ /* reserve other values for future use */
+ result = CURLE_FAILED_INIT;
+ break;
}
break;
@@ -4344,11 +4336,12 @@ static CURLcode setup_conn(struct connectdata *conn,
set this here perhaps a second time */
#ifdef __EMX__
- /* 20000330 mgs
- * the check is quite a hack...
- * we're calling _fsetmode to fix the problem with fwrite converting newline
- * characters (you get mangled text files, and corrupted binary files when
- * you download to stdout and redirect it to a file). */
+ /*
+ * This check is quite a hack. We're calling _fsetmode to fix the problem
+ * with fwrite converting newline characters (you get mangled text files,
+ * and corrupted binary files when you download to stdout and redirect it to
+ * a file).
+ */
if((data->set.out)->_handle == NULL) {
_fsetmode(stdout, "b");