*
* Returns: sockets-in-use-bitmap
*/
-
-
CURLcode Curl_ares_pollset(struct Curl_easy *data,
ares_channel channel,
struct easy_pollset *ps)
/* Start at 1ms poll interval */
thrdd->addr->poll_interval = 1;
else if(elapsed >= thrdd->addr->interval_end)
- /* Back-off exponentially if last interval expired */
+ /* Back-off exponentially if last interval expired */
thrdd->addr->poll_interval *= 2;
if(thrdd->addr->poll_interval > 250)
curlx_dyn_init(&ts->request_data, DYN_HTTP_REQUEST);
Curl_httpchunk_init(data, &ts->ch, TRUE);
- *pts = ts;
+ *pts = ts;
connkeep(cf->conn, "HTTP proxy CONNECT");
return tunnel_reinit(cf, data, ts);
}
ISDIGIT(header[9]) && ISDIGIT(header[10]) && ISDIGIT(header[11]) &&
!ISDIGIT(header[12])) {
/* store the HTTP code from the proxy */
- data->info.httpproxycode = k->httpcode = (header[9] - '0') * 100 +
+ data->info.httpproxycode = k->httpcode = (header[9] - '0') * 100 +
(header[10] - '0') * 10 + (header[11] - '0');
}
return result;
goto out;
}
-
/* all set, traffic will be send on connect */
result = CURLE_OK;
/* Receive data from the "lower" filters, e.g. network until
* it is time to stop or we have enough data for this stream */
- while(!ctx->conn_closed && /* not closed the connection */
- !ctx->tunnel.closed && /* nor the tunnel */
+ while(!ctx->conn_closed && /* not closed the connection */
+ !ctx->tunnel.closed && /* nor the tunnel */
Curl_bufq_is_empty(&ctx->inbufq) && /* and we consumed our input */
!Curl_bufq_is_full(&ctx->tunnel.recvbuf)) {
bool *connected)
{
*connected = a->connected;
- if(!a->result && !*connected) {
+ if(!a->result && !*connected) {
/* evaluate again */
a->result = Curl_conn_cf_connect(a->cf, data, connected);
bundle = cpool_find_bundle(cpool, conn);
live = bundle ? Curl_llist_count(&bundle->conns) : 0;
shutdowns = Curl_cshutdn_dest_count(data, conn->destination);
- while((live + shutdowns) >= dest_limit) {
+ while((live + shutdowns) >= dest_limit) {
if(shutdowns) {
/* close one connection in shutdown right away, if we can */
if(!Curl_cshutdn_close_oldest(data, conn->destination))
*/
#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 910) && \
- defined(__OPTIMIZE__) && defined(__unix__) && defined(__i386__)
+ defined(__OPTIMIZE__) && defined(__unix__) && defined(__i386__)
/* workaround icc 9.1 optimizer issue */
# define vqualifier volatile
#else
case CURLFNM_SCHS_RIGHTBRLEFTBR:
if(c == ']')
return SETCHARSET_OK;
- state = CURLFNM_SCHS_DEFAULT;
+ state = CURLFNM_SCHS_DEFAULT;
charset[c] = 1;
(*p)++;
break;
#define GSS_LOG_BUFFER_LEN 1024
static size_t display_gss_error(OM_uint32 status, int type,
- char *buf, size_t len) {
+ char *buf, size_t len)
+{
OM_uint32 maj_stat;
OM_uint32 min_stat;
OM_uint32 msg_ctx = 0;
*
* Returns CURLE_OK on success.
*/
-CURLcode Curl_ntlm_core_mk_lmv2_resp(unsigned char *ntlmv2hash,
- unsigned char *challenge_client,
- unsigned char *challenge_server,
- unsigned char *lmresp)
+CURLcode Curl_ntlm_core_mk_lmv2_resp(unsigned char *ntlmv2hash,
+ unsigned char *challenge_client,
+ unsigned char *challenge_server,
+ unsigned char *lmresp)
{
unsigned char data[16];
unsigned char hmac_output[16];
CURL_SASL_DIGEST, TRUE, NULL);
sasl_unchosen(data, SASL_MECH_NTLM, enabledmechs,
CURL_SASL_NTLM, Curl_auth_is_ntlm_supported(), NULL);
- sasl_unchosen(data, SASL_MECH_OAUTHBEARER, enabledmechs, TRUE, TRUE,
+ sasl_unchosen(data, SASL_MECH_OAUTHBEARER, enabledmechs, TRUE, TRUE,
data->set.str[STRING_BEARER] ?
NULL : "CURLOPT_XOAUTH2_BEARER");
- sasl_unchosen(data, SASL_MECH_XOAUTH2, enabledmechs, TRUE, TRUE,
+ sasl_unchosen(data, SASL_MECH_XOAUTH2, enabledmechs, TRUE, TRUE,
data->set.str[STRING_BEARER] ?
NULL : "CURLOPT_XOAUTH2_BEARER");
}
* Size of the SHA-512/256 resulting digest in words.
* This is the final digest size, not intermediate hash.
*/
-#define SHA512_256_DIGEST_SIZE_WORDS (SHA512_256_HASH_SIZE_WORDS / 2)
+#define SHA512_256_DIGEST_SIZE_WORDS (SHA512_256_HASH_SIZE_WORDS / 2)
/**
* Size of the SHA-512/256 resulting digest in bytes
#endif /* Local SHA-512/256 code */
-
/**
* Compute SHA-512/256 hash for the given data in one function call
* @param[out] output the pointer to put the hash
size_t wlen, nwritten;
CURLcode result;
- /* If we errored once, we do not invoke the client callback again */
+ /* If we errored once, we do not invoke the client callback again */
if(ctx->errored)
return CURLE_WRITE_ERROR;
UNITTEST DOHcode doh_req_encode(const char *host,
DNStype dnstype,
unsigned char *dnsp, /* buffer */
- size_t len, /* buffer size */
+ size_t len, /* buffer size */
size_t *olen) /* output length */
{
const size_t hostlen = strlen(host);
*dnsp++ = 0; /* append zero-length label for root */
- /* There are assigned TYPE codes beyond 255: use range [1..65535] */
+ /* There are assigned TYPE codes beyond 255: use range [1..65535] */
*dnsp++ = (unsigned char)(255 & (dnstype >> 8)); /* upper 8 bit TYPE */
- *dnsp++ = (unsigned char)(255 & dnstype); /* lower 8 bit TYPE */
+ *dnsp++ = (unsigned char)(255 & dnstype); /* lower 8 bit TYPE */
*dnsp++ = '\0'; /* upper 8 bit CLASS */
*dnsp++ = DNS_CLASS_IN; /* IN - "the Internet" */
struct dohentry *d)
{
/* RDATA
- - A (TYPE 1): 4 bytes
+ - A (TYPE 1): 4 bytes
- AAAA (TYPE 28): 16 bytes
- NS (TYPE 2): N bytes
- HTTPS (TYPE 65): N bytes */
return rc;
break;
case CURL_DNS_TYPE_DNAME:
- /* explicit for clarity; just skip; rely on synthesized CNAME */
+ /* explicit for clarity; just skip; rely on synthesized CNAME */
break;
default:
/* unsupported type, just skip it */
***************************************************************************/
/* Escape and unescape URL encoding in strings. The functions return a new
- * allocated string or NULL if an error occurred. */
+ * allocated string or NULL if an error occurred. */
#include "curl_setup.h"
HTTPPOST_PTRCONTENTS | HTTPPOST_PTRBUFFER |
HTTPPOST_CALLBACK)) && form->value) {
/* copy value (without strdup; possibly contains null characters) */
- size_t clen = (size_t) form->contentslength;
+ size_t clen = (size_t) form->contentslength;
if(!clen)
clen = strlen(form->value) + 1;
retval = CURL_FORMADD_OPTION_TWICE;
else {
if(!array_state)
- avalue = va_arg(params, char *);
+ avalue = va_arg(params, char *);
if(avalue) {
curr->userp = avalue;
curr->value = avalue; /* this is not strictly true but we derive a
port++;
}
-
/* get the name again after the bind() so that we can extract the
port number it uses now */
sslen = sizeof(ss);
goto error;
}
-
/*
* When this is used from the multi interface, this might've returned with
* the 'connected' set to FALSE and thus we are now awaiting a non-blocking
data->req.size = -1; /* default unknown size */
-
/*
* It appears that there are FTP-servers that return size 0 for files when
* SIZE is used on the file while being in BINARY mode. To work around
k->download_done = TRUE;
/* If max download size is *zero* (nothing) we already have
- nothing and can safely return ok now! But for HTTP/2, we would
+ nothing and can safely return ok now! But for HTTP/2, we would
like to call http2_handle_stream_close to properly close a
stream. In order to do this, we keep reading until we
close the stream. */
const char *buf, const size_t buflen,
CURLcode *err)
{
- const char *line_end;
+ const char *line_end;
DEBUGASSERT(!parser->line);
line_end = memchr(buf, '\n', buflen);
static CURLcode start_req(struct h1_req_parser *parser,
const char *scheme_default, int options)
{
- const char *p, *m, *target, *hv, *scheme, *authority, *path;
+ const char *p, *m, *target, *hv, *scheme, *authority, *path;
size_t m_len, target_len, hv_len, scheme_len, authority_len, path_len;
size_t i;
CURLU *url = NULL;
ctx->nw_out_blocked = 1;
return NGHTTP2_ERR_WOULDBLOCK;
}
- return (nwritten > SSIZE_MAX) ?
+ return (nwritten > SSIZE_MAX) ?
NGHTTP2_ERR_CALLBACK_FAILURE : (ssize_t)nwritten;
}
}
/* Send out our SETTINGS and ACKs and such. If that blocks, we
- * have it buffered and can count this filter as being connected */
+ * have it buffered and can count this filter as being connected */
result = h2_progress_egress(cf, data);
if(result && (result != CURLE_AGAIN))
goto out;
struct cf_h2_ctx *ctx;
CURLcode result;
- DEBUGASSERT(Curl_conn_http_version(data, conn) < 20);
+ DEBUGASSERT(Curl_conn_http_version(data, conn) < 20);
result = http2_cfilter_add(&cf, data, conn, sockindex, TRUE);
if(result)
}
}
-
if(*content_sha256_header) {
tmp_head = curl_slist_append(head, content_sha256_header);
if(!tmp_head)
static const char *parse_content_sha_hdr(struct Curl_easy *data,
const char *provider1,
size_t plen,
- size_t *value_len) {
+ size_t *value_len)
+{
char key[CONTENT_SHA256_KEY_LEN];
size_t key_len;
const char *value;
unsigned short code;
size_t len = 0;
- code = ares_dns_rr_get_opt(rr, key, idx, &val, &len);
+ code = ares_dns_rr_get_opt(rr, key, idx, &val, &len);
return Curl_httpsrr_set(data, hinfo, code, val, len);
}
size_t nread;
char tmp[256];
-
/* Once we have errored, we will return the same error forever */
if(ctx->errored) {
CURL_TRC_READ(data, "cr_mime_read(len=%zu) is errored -> %d, eos=0",
DEBUGASSERT(data->conn);
if(data->conn->bits.multiplex)
/* Check if we can move pending requests to send pipe */
- process_pending_handles(multi); /* multiplexed */
+ process_pending_handles(multi); /* multiplexed */
/* Only perform the transfer if there is a good socket to work with.
Having both BAD is a signal to skip immediately to DONE */
break;
}
-
if(!result)
result = client_write(data, STRCONST("\n"), NULL, 0, NULL, 0);
if(!result)
time_t t = 0;
int wdaynum = -1; /* day of the week number, 0-6 (mon-sun) */
int monnum = -1; /* month of the year number, 0-11 */
- int mdaynum = -1; /* day of month, 1 - 31 */
+ int mdaynum = -1; /* day of month, 1 - 31 */
int hournum = -1;
int minnum = -1;
int secnum = -1;
size_t full = curlx_dyn_len(&pp->recvbuf);
/* trim off the "final" leading part */
- curlx_dyn_tail(&pp->recvbuf, full - pp->nfinal);
+ curlx_dyn_tail(&pp->recvbuf, full - pp->nfinal);
pp->nfinal = 0; /* now gone */
}
req->header = FALSE;
req->headerline = 0;
req->headerbytecount = 0;
- req->allheadercount = 0;
+ req->allheadercount = 0;
req->deductheadercount = 0;
req->httpversion_sent = 0;
req->httpversion = 0;
req->writebytecount = 0;
req->start = t0;
req->headerbytecount = 0;
- req->allheadercount = 0;
+ req->allheadercount = 0;
req->deductheadercount = 0;
req->headerline = 0;
req->offset = 0;
s->connect_only_ws = (arg == 2);
break;
-
#ifdef USE_SSH
case CURLOPT_SSH_AUTH_TYPES:
s->ssh_auth_types = (int)arg;
/*
* A string with POST data. Makes curl HTTP POST. Even if it is NULL.
* If needed, CURLOPT_POSTFIELDSIZE must have been set prior to
- * CURLOPT_COPYPOSTFIELDS and not altered later.
+ * CURLOPT_COPYPOSTFIELDS and not altered later.
*/
if(!ptr || s->postfieldsize == -1)
result = Curl_setstropt(&s->str[STRING_COPYPOSTFIELDS], ptr);
/* Duplicate the fully qualified email address so we can manipulate it,
ensuring it does not contain the delimiters if specified */
- char *dup = strdup(fqma[0] == '<' ? fqma + 1 : fqma);
+ char *dup = strdup(fqma[0] == '<' ? fqma + 1 : fqma);
if(!dup)
return CURLE_OUT_OF_MEMORY;
/* socks4a, not resolving locally, sends the hostname.
* add an invalid address + user + hostname */
unsigned char buf[4] = { 0, 0, 0, 1 };
- size_t hlen = strlen(sx->hostname) + 1; /* including NUL */
+ size_t hlen = strlen(sx->hostname) + 1; /* including NUL */
if(hlen > 255) {
failf(data, "SOCKS4: too long hostname");
const size_t serviceptr_length = strlen(serviceptr);
gss_ctx_id_t gss_context = GSS_C_NO_CONTEXT;
-
/* GSS-API request looks like
* +----+------+-----+----------------+
* |VER | MTYP | LEN | TOKEN |
unsigned long qop;
unsigned char socksreq[4]; /* room for GSS-API exchange header only */
const char *service = data->set.str[STRING_PROXY_SERVICE_NAME] ?
- data->set.str[STRING_PROXY_SERVICE_NAME] : "rcmd";
+ data->set.str[STRING_PROXY_SERVICE_NAME] : "rcmd";
char *etbuf;
size_t etbuf_size;
(void)curlx_nonblock(sock, FALSE);
/* As long as we need to keep sending some context info, and there is no */
- /* errors, keep sending it... */
+ /* errors, keep sending it... */
for(;;) {
TCHAR *sname;
goto error;
}
-
if(!data->set.socks5_gssapi_nec) {
wrap_desc.cBuffers = 2;
sspi_w_token[0].BufferType = SECBUFFER_STREAM;
curl_msnprintf((char *)state->spacket.data + 2,
state->blksize,
- "%s%c%s%c", filename, '\0', mode, '\0');
+ "%s%c%s%c", filename, '\0', mode, '\0');
sbytes = 4 + strlen(filename) + strlen(mode);
/* optional addition of TFTP options */
bool is_unix_proxy = FALSE;
#endif
-
if(!uhp) {
result = CURLE_OUT_OF_MEMORY;
goto error;
Curl_pSecFn->FreeContextBuffer(SecurityPackage);
}
-
return status == SEC_E_OK;
}
static int cb_h3_reset_stream(nghttp3_conn *conn, int64_t sid,
uint64_t app_error_code, void *user_data,
- void *stream_user_data) {
+ void *stream_user_data)
+{
struct Curl_cfilter *cf = user_data;
struct cf_ngtcp2_ctx *ctx = cf->ctx;
curl_int64_t stream_id = (curl_int64_t)sid;
static int cb_h3_reset_stream(nghttp3_conn *conn, int64_t sid,
uint64_t app_error_code, void *user_data,
- void *stream_user_data) {
+ void *stream_user_data)
+{
struct Curl_cfilter *cf = user_data;
struct cf_osslq_ctx *ctx = cf->ctx;
struct Curl_easy *data = stream_user_data;
if(!stream)
return CURLE_RECV_ERROR;
-
if(!Curl_bufq_is_empty(&stream->recvbuf)) {
result = Curl_bufq_cread(&stream->recvbuf, buf, len, pnread);
CURL_TRC_CF(data, cf, "[%" FMT_PRIu64 "] read recvbuf(len=%zu) "
}
#endif
-
while((sent = sendmsg(qctx->sockfd, &msg, 0)) == -1 &&
SOCKERRNO == SOCKEINTR)
;
"QUIT"
};
-
if(sshc->state != nowstate) {
infof(data, "SSH %p state change from %s to %s (line %d)",
(void *) sshc, names[sshc->state], names[nowstate],
}
} while(!rc && (sshc->state != SSH_STOP));
-
if(rc == SSH_AGAIN) {
/* we would block, we need to wait for the socket to be ready (in the
right direction too)! */
Curl_pgrsSetDownloadSize(data, -1);
if(conn->handler->protocol & CURLPROTO_SCP)
- result = scp_perform(data, &connected, done);
+ result = scp_perform(data, &connected, done);
else
- result = sftp_perform(data, &connected, done);
+ result = sftp_perform(data, &connected, done);
return result;
}
CURLcode result;
int rc;
-
/* Consider the X509 store cacheable if it comes exclusively from a CAfile,
or no source is provided and we are falling back to OpenSSL's built-in
default. */
*/
static CURLcode gtls_connect_common(struct Curl_cfilter *cf,
struct Curl_easy *data,
- bool *done) {
+ bool *done)
+{
struct ssl_connect_data *connssl = cf->ctx;
struct gtls_ssl_backend_data *backend =
(struct gtls_ssl_backend_data *)connssl->backend;
mbedtls_ssl_list_ciphersuites());
}
-
#ifdef MBEDTLS_SSL_RENEGOTIATION
mbedtls_ssl_conf_renegotiation(&backend->config,
MBEDTLS_SSL_RENEGOTIATION_ENABLED);
static void
init_config_builder_alpn(struct Curl_easy *data,
const struct ssl_connect_data *connssl,
- struct rustls_client_config_builder *config_builder) {
+ struct rustls_client_config_builder *config_builder)
+{
struct alpn_proto_buf proto;
rustls_slice_bytes alpn[ALPN_ENTRIES_MAX];
size_t i;
struct rustls_client_config_builder *builder,
const struct ssl_primary_config *conn_config,
const struct curl_blob *ca_info_blob,
- const char * const ssl_cafile) {
+ const char * const ssl_cafile)
+{
const struct rustls_root_cert_store *roots = NULL;
struct rustls_root_cert_store_builder *roots_builder = NULL;
struct rustls_web_pki_server_cert_verifier_builder *verifier_builder = NULL;
break; /* failed */
}
-
if(!(((pCertContextServer->dwCertEncodingType & X509_ASN_ENCODING) != 0) &&
(pCertContextServer->cbCertEncoded > 0)))
break;
len = strlen(spec->entries[i]);
if(len >= ALPN_NAME_MAX)
return CURLE_FAILED_INIT;
- blen = (unsigned char)len;
+ blen = (unsigned char)len;
if(off + blen + 1 >= (int)sizeof(buf->data))
return CURLE_FAILED_INIT;
buf->data[off++] = blen;
if(sess_reuse_cb) {
result = sess_reuse_cb(cf, data, alpns, scs, &do_early_data);
if(result)
- goto out;
+ goto out;
}
#ifdef WOLFSSL_EARLY_DATA
if(do_early_data) {
if an error occurs. */
if(!beg || !end || beg >= end || !*beg ||
((size_t)(end - beg) > CURL_ASN1_MAX) ||
- lvl >= CURL_ASN1_MAX_RECURSIONS)
+ lvl >= CURL_ASN1_MAX_RECURSIONS)
return NULL;
/* Process header byte. */
return CURLE_BAD_FUNCTION_ARGUMENT;
}
-
memset(&ctx, 0, sizeof(ctx));
ctx.data = data;
ctx.ws = ws;
}
- /* Start of DECC RTL Feature handling */
+/* Start of DECC RTL Feature handling */
/*
** Sets default value for a feature
/* We always want the new parse style */
set_feature_default("DECC$ARGV_PARSE_STYLE", ENABLE);
-
/* Unless we are in POSIX compliant mode, we want the old POSIX root
* enabled.
*/
/* Gets rid of output logs with single character lines in them. */
set_feature_default("DECC$STDIO_CTX_EOL", ENABLE);
- /* Fix mv aa.bb aa */
+ /* Fix mv aa.bb aa */
set_feature_default("DECC$RENAME_NO_INHERIT", ENABLE);
if(use_unix_settings) {
/* Set strtol to proper behavior */
set_feature_default("DECC$STRTOL_ERANGE", ENABLE);
- /* Commented here to prevent future bugs: A program or user should */
+ /* Commented here to prevent future bugs: A program or user should */
/* never ever enable DECC$POSIX_STYLE_UID. */
/* It will probably break all code that accesses UIDs */
/* do_not_set_default ("DECC$POSIX_STYLE_UID", TRUE); */
global->noprogress = orig_noprogress;
global->isatty = orig_isatty;
-
return result;
}
speed = dls > uls ? dls : uls;
}
-
if(dlknown && speed) {
curl_off_t est = all_dltotal / speed;
curl_off_t left = (all_dltotal - all_dlnow) / speed;