mirror of
https://github.com/curl/curl.git
synced 2025-04-24 16:40:32 +08:00
lib/src: white space edits to comply better with code style
... as checksrc now finds and complains about these. Closes #14921
This commit is contained in:
parent
a57b45c386
commit
fbf5d507ce
@ -180,31 +180,31 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* check for bytes downloaded */
|
||||
res = curl_easy_getinfo(curl_handle, CURLINFO_SIZE_DOWNLOAD_T, &val);
|
||||
if((CURLE_OK == res) && (val>0))
|
||||
if((CURLE_OK == res) && (val > 0))
|
||||
printf("Data downloaded: %lu bytes.\n", (unsigned long)val);
|
||||
|
||||
/* check for total download time */
|
||||
res = curl_easy_getinfo(curl_handle, CURLINFO_TOTAL_TIME_T, &val);
|
||||
if((CURLE_OK == res) && (val>0))
|
||||
if((CURLE_OK == res) && (val > 0))
|
||||
printf("Total download time: %lu.%06lu sec.\n",
|
||||
(unsigned long)(val / 1000000), (unsigned long)(val % 1000000));
|
||||
|
||||
/* check for average download speed */
|
||||
res = curl_easy_getinfo(curl_handle, CURLINFO_SPEED_DOWNLOAD_T, &val);
|
||||
if((CURLE_OK == res) && (val>0))
|
||||
if((CURLE_OK == res) && (val > 0))
|
||||
printf("Average download speed: %lu kbyte/sec.\n",
|
||||
(unsigned long)(val / 1024));
|
||||
|
||||
if(prtall) {
|
||||
/* check for name resolution time */
|
||||
res = curl_easy_getinfo(curl_handle, CURLINFO_NAMELOOKUP_TIME_T, &val);
|
||||
if((CURLE_OK == res) && (val>0))
|
||||
if((CURLE_OK == res) && (val > 0))
|
||||
printf("Name lookup time: %lu.%06lu sec.\n",
|
||||
(unsigned long)(val / 1000000), (unsigned long)(val % 1000000));
|
||||
|
||||
/* check for connect time */
|
||||
res = curl_easy_getinfo(curl_handle, CURLINFO_CONNECT_TIME_T, &val);
|
||||
if((CURLE_OK == res) && (val>0))
|
||||
if((CURLE_OK == res) && (val > 0))
|
||||
printf("Connect time: %lu.%06lu sec.\n",
|
||||
(unsigned long)(val / 1000000), (unsigned long)(val % 1000000));
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ void dump(const char *text,
|
||||
fprintf(stream, "%s, %10.10lu bytes (0x%8.8lx)\n",
|
||||
text, (unsigned long)size, (unsigned long)size);
|
||||
|
||||
for(i = 0; i<size; i += width) {
|
||||
for(i = 0; i < size; i += width) {
|
||||
|
||||
fprintf(stream, "%4.4lx: ", (unsigned long)i);
|
||||
|
||||
@ -70,7 +70,7 @@ void dump(const char *text,
|
||||
break;
|
||||
}
|
||||
fprintf(stream, "%c",
|
||||
(ptr[i + c] >= 0x20) && (ptr[i + c]<0x80)?ptr[i + c]:'.');
|
||||
(ptr[i + c] >= 0x20) && (ptr[i + c] < 0x80) ? ptr[i + c] : '.');
|
||||
/* check again for 0D0A, to avoid an extra \n if it's at width */
|
||||
if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D &&
|
||||
ptr[i + c + 2] == 0x0A) {
|
||||
|
@ -74,7 +74,7 @@ int main(void)
|
||||
}
|
||||
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
|
||||
&filesize);
|
||||
if((CURLE_OK == res) && (filesize>0))
|
||||
if((CURLE_OK == res) && (filesize > 0))
|
||||
printf("filesize %s: %" CURL_FORMAT_CURL_OFF_T " bytes\n",
|
||||
filename, filesize);
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ static void new_conn(char *url, GlobalInfo *g)
|
||||
curl_easy_setopt(conn->easy, CURLOPT_VERBOSE, (long)SHOW_VERBOSE);
|
||||
curl_easy_setopt(conn->easy, CURLOPT_ERRORBUFFER, conn->error);
|
||||
curl_easy_setopt(conn->easy, CURLOPT_PRIVATE, conn);
|
||||
curl_easy_setopt(conn->easy, CURLOPT_NOPROGRESS, SHOW_PROGRESS?0L:1L);
|
||||
curl_easy_setopt(conn->easy, CURLOPT_NOPROGRESS, SHOW_PROGRESS ? 0L : 1L);
|
||||
curl_easy_setopt(conn->easy, CURLOPT_PROGRESSFUNCTION, prog_cb);
|
||||
curl_easy_setopt(conn->easy, CURLOPT_PROGRESSDATA, conn);
|
||||
curl_easy_setopt(conn->easy, CURLOPT_FOLLOWLOCATION, 1L);
|
||||
|
@ -56,8 +56,8 @@ void dumpNode(TidyDoc doc, TidyNode tnod, int indent)
|
||||
/* walk the attribute list */
|
||||
for(attr = tidyAttrFirst(child); attr; attr = tidyAttrNext(attr) ) {
|
||||
printf("%s", tidyAttrName(attr));
|
||||
tidyAttrValue(attr)?printf("=\"%s\" ",
|
||||
tidyAttrValue(attr)):printf(" ");
|
||||
tidyAttrValue(attr) ? printf("=\"%s\" ",
|
||||
tidyAttrValue(attr)) : printf(" ");
|
||||
}
|
||||
printf(">\n");
|
||||
}
|
||||
@ -66,7 +66,7 @@ void dumpNode(TidyDoc doc, TidyNode tnod, int indent)
|
||||
TidyBuffer buf;
|
||||
tidyBufInit(&buf);
|
||||
tidyNodeGetText(doc, child, &buf);
|
||||
printf("%*.*s\n", indent, indent, buf.bp?(char *)buf.bp:"");
|
||||
printf("%*.*s\n", indent, indent, buf.bp ? (char *)buf.bp : "");
|
||||
tidyBufFree(&buf);
|
||||
}
|
||||
dumpNode(doc, child, indent + 4); /* recursive */
|
||||
|
@ -65,7 +65,7 @@ void dump(const char *text, unsigned int num, unsigned char *ptr, size_t size,
|
||||
fprintf(stderr, "%u %s, %lu bytes (0x%lx)\n",
|
||||
num, text, (unsigned long)size, (unsigned long)size);
|
||||
|
||||
for(i = 0; i<size; i += width) {
|
||||
for(i = 0; i < size; i += width) {
|
||||
|
||||
fprintf(stderr, "%4.4lx: ", (unsigned long)i);
|
||||
|
||||
@ -86,7 +86,7 @@ void dump(const char *text, unsigned int num, unsigned char *ptr, size_t size,
|
||||
break;
|
||||
}
|
||||
fprintf(stderr, "%c",
|
||||
(ptr[i + c] >= 0x20) && (ptr[i + c]<0x80)?ptr[i + c]:'.');
|
||||
(ptr[i + c] >= 0x20) && (ptr[i + c] < 0x80) ? ptr[i + c] : '.');
|
||||
/* check again for 0D0A, to avoid an extra \n if it's at width */
|
||||
if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D &&
|
||||
ptr[i + c + 2] == 0x0A) {
|
||||
|
@ -52,7 +52,7 @@ void dump(const char *text, unsigned char *ptr, size_t size,
|
||||
fprintf(stderr, "%s, %lu bytes (0x%lx)\n",
|
||||
text, (unsigned long)size, (unsigned long)size);
|
||||
|
||||
for(i = 0; i<size; i += width) {
|
||||
for(i = 0; i < size; i += width) {
|
||||
|
||||
fprintf(stderr, "%4.4lx: ", (unsigned long)i);
|
||||
|
||||
@ -73,7 +73,7 @@ void dump(const char *text, unsigned char *ptr, size_t size,
|
||||
break;
|
||||
}
|
||||
fprintf(stderr, "%c",
|
||||
(ptr[i + c] >= 0x20) && (ptr[i + c]<0x80)?ptr[i + c]:'.');
|
||||
(ptr[i + c] >= 0x20) && (ptr[i + c] < 0x80) ? ptr[i + c] : '.');
|
||||
/* check again for 0D0A, to avoid an extra \n if it's at width */
|
||||
if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D &&
|
||||
ptr[i + c + 2] == 0x0A) {
|
||||
@ -188,7 +188,7 @@ static int server_push_callback(CURL *parent,
|
||||
fprintf(stderr, "**** push callback approves stream %u, got %lu headers!\n",
|
||||
count, (unsigned long)num_headers);
|
||||
|
||||
for(i = 0; i<num_headers; i++) {
|
||||
for(i = 0; i < num_headers; i++) {
|
||||
headp = curl_pushheader_bynum(headers, i);
|
||||
fprintf(stderr, "**** header %lu: %s\n", (unsigned long)i, headp);
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ void dump(const char *text, int num, unsigned char *ptr, size_t size,
|
||||
fprintf(stderr, "%d %s, %lu bytes (0x%lx)\n",
|
||||
num, text, (unsigned long)size, (unsigned long)size);
|
||||
|
||||
for(i = 0; i<size; i += width) {
|
||||
for(i = 0; i < size; i += width) {
|
||||
|
||||
fprintf(stderr, "%4.4lx: ", (unsigned long)i);
|
||||
|
||||
@ -114,7 +114,7 @@ void dump(const char *text, int num, unsigned char *ptr, size_t size,
|
||||
break;
|
||||
}
|
||||
fprintf(stderr, "%c",
|
||||
(ptr[i + c] >= 0x20) && (ptr[i + c]<0x80)?ptr[i + c]:'.');
|
||||
(ptr[i + c] >= 0x20) && (ptr[i + c] < 0x80) ? ptr[i + c] : '.');
|
||||
/* check again for 0D0A, to avoid an extra \n if it's at width */
|
||||
if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D &&
|
||||
ptr[i + c + 2] == 0x0A) {
|
||||
@ -290,7 +290,7 @@ int main(int argc, char **argv)
|
||||
/* init a multi stack */
|
||||
multi_handle = curl_multi_init();
|
||||
|
||||
for(i = 0; i<num_transfers; i++) {
|
||||
for(i = 0; i < num_transfers; i++) {
|
||||
setup(&trans[i], i, filename);
|
||||
|
||||
/* add the individual transfer */
|
||||
@ -316,7 +316,7 @@ int main(int argc, char **argv)
|
||||
|
||||
curl_multi_cleanup(multi_handle);
|
||||
|
||||
for(i = 0; i<num_transfers; i++) {
|
||||
for(i = 0; i < num_transfers; i++) {
|
||||
curl_multi_remove_handle(multi_handle, trans[i].hnd);
|
||||
curl_easy_cleanup(trans[i].hnd);
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ int main(void)
|
||||
int msgs_left; /* how many messages are left */
|
||||
|
||||
/* Allocate one CURL handle per transfer */
|
||||
for(i = 0; i<HANDLECOUNT; i++)
|
||||
for(i = 0; i < HANDLECOUNT; i++)
|
||||
handles[i] = curl_easy_init();
|
||||
|
||||
/* set the options (I left out a few, you get the point anyway) */
|
||||
@ -66,7 +66,7 @@ int main(void)
|
||||
multi_handle = curl_multi_init();
|
||||
|
||||
/* add the individual transfers */
|
||||
for(i = 0; i<HANDLECOUNT; i++)
|
||||
for(i = 0; i < HANDLECOUNT; i++)
|
||||
curl_multi_add_handle(multi_handle, handles[i]);
|
||||
|
||||
while(still_running) {
|
||||
@ -86,7 +86,7 @@ int main(void)
|
||||
int idx;
|
||||
|
||||
/* Find out which handle this message is about */
|
||||
for(idx = 0; idx<HANDLECOUNT; idx++) {
|
||||
for(idx = 0; idx < HANDLECOUNT; idx++) {
|
||||
int found = (msg->easy_handle == handles[idx]);
|
||||
if(found)
|
||||
break;
|
||||
@ -104,7 +104,7 @@ int main(void)
|
||||
}
|
||||
|
||||
/* remove the transfers and cleanup the handles */
|
||||
for(i = 0; i<HANDLECOUNT; i++) {
|
||||
for(i = 0; i < HANDLECOUNT; i++) {
|
||||
curl_multi_remove_handle(multi_handle, handles[i]);
|
||||
curl_easy_cleanup(handles[i]);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ static void dump(const char *text, FILE *stream, unsigned char *ptr,
|
||||
fprintf(stream, "%s, %10.10lu bytes (0x%8.8lx)\n",
|
||||
text, (unsigned long)size, (unsigned long)size);
|
||||
|
||||
for(i = 0; i<size; i += width) {
|
||||
for(i = 0; i < size; i += width) {
|
||||
|
||||
fprintf(stream, "%4.4lx: ", (unsigned long)i);
|
||||
|
||||
@ -70,7 +70,7 @@ static void dump(const char *text, FILE *stream, unsigned char *ptr,
|
||||
break;
|
||||
}
|
||||
fprintf(stream, "%c",
|
||||
(ptr[i + c] >= 0x20) && (ptr[i + c]<0x80)?ptr[i + c]:'.');
|
||||
(ptr[i + c] >= 0x20) && (ptr[i + c] < 0x80) ? ptr[i + c] : '.');
|
||||
/* check again for 0D0A, to avoid an extra \n if it's at width */
|
||||
if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D &&
|
||||
ptr[i + c + 2] == 0x0A) {
|
||||
|
@ -59,7 +59,7 @@ int main(void)
|
||||
int msgs_left; /* how many messages are left */
|
||||
|
||||
/* Allocate one CURL handle per transfer */
|
||||
for(i = 0; i<HANDLECOUNT; i++)
|
||||
for(i = 0; i < HANDLECOUNT; i++)
|
||||
handles[i] = curl_easy_init();
|
||||
|
||||
/* set the options (I left out a few, you get the point anyway) */
|
||||
@ -72,7 +72,7 @@ int main(void)
|
||||
multi_handle = curl_multi_init();
|
||||
|
||||
/* add the individual transfers */
|
||||
for(i = 0; i<HANDLECOUNT; i++)
|
||||
for(i = 0; i < HANDLECOUNT; i++)
|
||||
curl_multi_add_handle(multi_handle, handles[i]);
|
||||
|
||||
/* we start some action by calling perform right away */
|
||||
@ -155,7 +155,7 @@ int main(void)
|
||||
int idx;
|
||||
|
||||
/* Find out which handle this message is about */
|
||||
for(idx = 0; idx<HANDLECOUNT; idx++) {
|
||||
for(idx = 0; idx < HANDLECOUNT; idx++) {
|
||||
int found = (msg->easy_handle == handles[idx]);
|
||||
if(found)
|
||||
break;
|
||||
@ -175,7 +175,7 @@ int main(void)
|
||||
curl_multi_cleanup(multi_handle);
|
||||
|
||||
/* Free the CURL handles */
|
||||
for(i = 0; i<HANDLECOUNT; i++)
|
||||
for(i = 0; i < HANDLECOUNT; i++)
|
||||
curl_easy_cleanup(handles[i]);
|
||||
|
||||
return 0;
|
||||
|
@ -75,7 +75,7 @@ int main(int argc, char **argv)
|
||||
/* Must initialize libcurl before any threads are started */
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
for(i = 0; i< NUMT; i++) {
|
||||
for(i = 0; i < NUMT; i++) {
|
||||
int error = pthread_create(&tid[i],
|
||||
NULL, /* default attributes please */
|
||||
pull_one_url,
|
||||
@ -87,7 +87,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* now wait for all threads to terminate */
|
||||
for(i = 0; i< NUMT; i++) {
|
||||
for(i = 0; i < NUMT; i++) {
|
||||
pthread_join(tid[i], NULL);
|
||||
fprintf(stderr, "Thread %d terminated\n", i);
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ size_t SyncTime_CURL_WriteHeader(void *ptr, size_t size, size_t nmemb,
|
||||
if(RetVal == 7) {
|
||||
int i;
|
||||
SYSTime.wMilliseconds = 500; /* adjust to midpoint, 0.5 sec */
|
||||
for(i = 0; i<12; i++) {
|
||||
for(i = 0; i < 12; i++) {
|
||||
if(strcmp(MthStr[i], TmpStr2) == 0) {
|
||||
SYSTime.wMonth = i + 1;
|
||||
break;
|
||||
@ -250,7 +250,7 @@ int conf_init(conf_t *conf)
|
||||
int i;
|
||||
|
||||
*conf->http_proxy = 0;
|
||||
for(i = 0; i<MAX_STRING1; i++)
|
||||
for(i = 0; i < MAX_STRING1; i++)
|
||||
conf->proxy_user[i] = 0; /* Clean up password from memory */
|
||||
*conf->timeserver = 0;
|
||||
return 1;
|
||||
|
@ -78,7 +78,7 @@ int main(int argc, char **argv)
|
||||
/* Must initialize libcurl before any threads are started */
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
for(i = 0; i< NUMT; i++) {
|
||||
for(i = 0; i < NUMT; i++) {
|
||||
int error = pthread_create(&tid[i],
|
||||
NULL, /* default attributes please */
|
||||
pull_one_url,
|
||||
@ -90,7 +90,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* now wait for all threads to terminate */
|
||||
for(i = 0; i< NUMT; i++) {
|
||||
for(i = 0; i < NUMT; i++) {
|
||||
pthread_join(tid[i], NULL);
|
||||
fprintf(stderr, "Thread %d terminated\n", i);
|
||||
}
|
||||
|
@ -366,10 +366,10 @@ static int waitperform(struct Curl_easy *data, timediff_t timeout_ms)
|
||||
/* move through the descriptors and ask for processing on them */
|
||||
for(i = 0; i < num; i++)
|
||||
ares_process_fd((ares_channel)data->state.async.resolver,
|
||||
(pfd[i].revents & (POLLRDNORM|POLLIN))?
|
||||
pfd[i].fd:ARES_SOCKET_BAD,
|
||||
(pfd[i].revents & (POLLWRNORM|POLLOUT))?
|
||||
pfd[i].fd:ARES_SOCKET_BAD);
|
||||
(pfd[i].revents & (POLLRDNORM|POLLIN)) ?
|
||||
pfd[i].fd : ARES_SOCKET_BAD,
|
||||
(pfd[i].revents & (POLLWRNORM|POLLOUT)) ?
|
||||
pfd[i].fd : ARES_SOCKET_BAD);
|
||||
}
|
||||
return nfds;
|
||||
}
|
||||
@ -801,7 +801,7 @@ struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct Curl_easy *data,
|
||||
}
|
||||
#endif /* CURLRES_IPV6 */
|
||||
hints.ai_family = pf;
|
||||
hints.ai_socktype = (data->conn->transport == TRNSPRT_TCP)?
|
||||
hints.ai_socktype = (data->conn->transport == TRNSPRT_TCP) ?
|
||||
SOCK_STREAM : SOCK_DGRAM;
|
||||
/* Since the service is a numerical one, set the hint flags
|
||||
* accordingly to save a call to getservbyname in inside C-Ares
|
||||
|
@ -728,7 +728,7 @@ struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct Curl_easy *data,
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_family = pf;
|
||||
hints.ai_socktype = (data->conn->transport == TRNSPRT_TCP)?
|
||||
hints.ai_socktype = (data->conn->transport == TRNSPRT_TCP) ?
|
||||
SOCK_STREAM : SOCK_DGRAM;
|
||||
|
||||
reslv->start = Curl_now();
|
||||
|
@ -484,7 +484,7 @@ CURLcode Curl_bufq_cwrite(struct bufq *q,
|
||||
ssize_t n;
|
||||
CURLcode result;
|
||||
n = Curl_bufq_write(q, (const unsigned char *)buf, len, &result);
|
||||
*pnwritten = (n < 0)? 0 : (size_t)n;
|
||||
*pnwritten = (n < 0) ? 0 : (size_t)n;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -494,7 +494,7 @@ CURLcode Curl_bufq_unwrite(struct bufq *q, size_t len)
|
||||
len -= chunk_unwrite(q->head, len);
|
||||
prune_tail(q);
|
||||
}
|
||||
return len? CURLE_AGAIN : CURLE_OK;
|
||||
return len ? CURLE_AGAIN : CURLE_OK;
|
||||
}
|
||||
|
||||
ssize_t Curl_bufq_read(struct bufq *q, unsigned char *buf, size_t len,
|
||||
@ -526,7 +526,7 @@ CURLcode Curl_bufq_cread(struct bufq *q, char *buf, size_t len,
|
||||
ssize_t n;
|
||||
CURLcode result;
|
||||
n = Curl_bufq_read(q, (unsigned char *)buf, len, &result);
|
||||
*pnread = (n < 0)? 0 : (size_t)n;
|
||||
*pnread = (n < 0) ? 0 : (size_t)n;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ static CURLcode status_line(struct Curl_easy *data,
|
||||
/* We need to set 'httpcodeq' for functions that check the response code in
|
||||
a single place. */
|
||||
data->req.httpcode = http_status;
|
||||
data->req.httpversion = http_version == HYPER_HTTP_VERSION_1_1? 11 :
|
||||
data->req.httpversion = http_version == HYPER_HTTP_VERSION_1_1 ? 11 :
|
||||
(http_version == HYPER_HTTP_VERSION_2 ? 20 : 10);
|
||||
if(data->state.hconnect)
|
||||
/* CONNECT */
|
||||
@ -481,7 +481,7 @@ CURLcode Curl_hyper_stream(struct Curl_easy *data,
|
||||
goto out;
|
||||
|
||||
k->deductheadercount =
|
||||
(100 <= http_status && 199 >= http_status)?k->headerbytecount:0;
|
||||
(100 <= http_status && 199 >= http_status) ? k->headerbytecount : 0;
|
||||
#ifdef USE_WEBSOCKETS
|
||||
if(k->upgr101 == UPGR101_WS) {
|
||||
if(http_status == 101) {
|
||||
|
@ -547,8 +547,8 @@ static CURLcode CONNECT_host(struct Curl_cfilter *cf,
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
authority = aprintf("%s%s%s:%d", ipv6_ip?"[":"", hostname, ipv6_ip?"]":"",
|
||||
port);
|
||||
authority = aprintf("%s%s%s:%d", ipv6_ip ? "[":"", hostname,
|
||||
ipv6_ip ? "]" : "", port);
|
||||
if(!authority)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
|
@ -98,7 +98,8 @@ static CURLcode tunnel_stream_init(struct Curl_cfilter *cf,
|
||||
return result;
|
||||
|
||||
ts->authority = /* host:port with IPv6 support */
|
||||
aprintf("%s%s%s:%d", ipv6_ip?"[":"", hostname, ipv6_ip?"]":"", port);
|
||||
aprintf("%s%s%s:%d", ipv6_ip ? "[":"", hostname,
|
||||
ipv6_ip ? "]" : "", port);
|
||||
if(!ts->authority)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
@ -429,7 +430,7 @@ static CURLcode proxy_h2_nw_out_flush(struct Curl_cfilter *cf,
|
||||
return result;
|
||||
}
|
||||
CURL_TRC_CF(data, cf, "[0] nw send buffer flushed");
|
||||
return Curl_bufq_is_empty(&ctx->outbufq)? CURLE_OK: CURLE_AGAIN;
|
||||
return Curl_bufq_is_empty(&ctx->outbufq) ? CURLE_OK : CURLE_AGAIN;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -604,22 +605,20 @@ static int proxy_h2_fr_print(const nghttp2_frame *frame,
|
||||
return msnprintf(buffer, blen,
|
||||
"FRAME[SETTINGS, len=%d]", (int)frame->hd.length);
|
||||
}
|
||||
case NGHTTP2_PUSH_PROMISE: {
|
||||
case NGHTTP2_PUSH_PROMISE:
|
||||
return msnprintf(buffer, blen,
|
||||
"FRAME[PUSH_PROMISE, len=%d, hend=%d]",
|
||||
(int)frame->hd.length,
|
||||
!!(frame->hd.flags & NGHTTP2_FLAG_END_HEADERS));
|
||||
}
|
||||
case NGHTTP2_PING: {
|
||||
case NGHTTP2_PING:
|
||||
return msnprintf(buffer, blen,
|
||||
"FRAME[PING, len=%d, ack=%d]",
|
||||
(int)frame->hd.length,
|
||||
frame->hd.flags&NGHTTP2_FLAG_ACK);
|
||||
}
|
||||
frame->hd.flags & NGHTTP2_FLAG_ACK);
|
||||
case NGHTTP2_GOAWAY: {
|
||||
char scratch[128];
|
||||
size_t s_len = sizeof(scratch)/sizeof(scratch[0]);
|
||||
size_t len = (frame->goaway.opaque_data_len < s_len)?
|
||||
size_t len = (frame->goaway.opaque_data_len < s_len) ?
|
||||
frame->goaway.opaque_data_len : s_len-1;
|
||||
if(len)
|
||||
memcpy(scratch, frame->goaway.opaque_data, len);
|
||||
@ -1220,7 +1219,7 @@ static bool cf_h2_proxy_data_pending(struct Curl_cfilter *cf,
|
||||
(ctx && ctx->tunnel.state == H2_TUNNEL_ESTABLISHED &&
|
||||
!Curl_bufq_is_empty(&ctx->tunnel.recvbuf)))
|
||||
return TRUE;
|
||||
return cf->next? cf->next->cft->has_data_pending(cf->next, data) : FALSE;
|
||||
return cf->next ? cf->next->cft->has_data_pending(cf->next, data) : FALSE;
|
||||
}
|
||||
|
||||
static void cf_h2_proxy_adjust_pollset(struct Curl_cfilter *cf,
|
||||
@ -1586,7 +1585,7 @@ static CURLcode cf_h2_proxy_query(struct Curl_cfilter *cf,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return cf->next?
|
||||
return cf->next ?
|
||||
cf->next->cft->query(cf->next, data, query, pres1, pres2) :
|
||||
CURLE_UNKNOWN_OPTION;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ static CURLcode cf_haproxy_date_out_set(struct Curl_cfilter*cf,
|
||||
client_ip = ipquad.local_ip;
|
||||
|
||||
result = Curl_dyn_addf(&ctx->data_out, "PROXY %s %s %s %i %i\r\n",
|
||||
is_ipv6? "TCP6" : "TCP4",
|
||||
is_ipv6 ? "TCP6" : "TCP4",
|
||||
client_ip, ipquad.remote_ip,
|
||||
ipquad.local_port, ipquad.remote_port);
|
||||
|
||||
|
@ -306,7 +306,7 @@ static CURLcode cf_hc_connect(struct Curl_cfilter *cf,
|
||||
(!ctx->h21_baller.enabled || ctx->h21_baller.result)) {
|
||||
/* both failed or disabled. we give up */
|
||||
CURL_TRC_CF(data, cf, "connect, all failed");
|
||||
result = ctx->result = ctx->h3_baller.enabled?
|
||||
result = ctx->result = ctx->h3_baller.enabled ?
|
||||
ctx->h3_baller.result : ctx->h21_baller.result;
|
||||
ctx->state = CF_HC_FAILURE;
|
||||
goto out;
|
||||
@ -420,13 +420,13 @@ static struct curltime cf_get_max_baller_time(struct Curl_cfilter *cf,
|
||||
|
||||
memset(&tmax, 0, sizeof(tmax));
|
||||
memset(&t, 0, sizeof(t));
|
||||
cfb = ctx->h21_baller.enabled? ctx->h21_baller.cf : NULL;
|
||||
cfb = ctx->h21_baller.enabled ? ctx->h21_baller.cf : NULL;
|
||||
if(cfb && !cfb->cft->query(cfb, data, query, NULL, &t)) {
|
||||
if((t.tv_sec || t.tv_usec) && Curl_timediff_us(t, tmax) > 0)
|
||||
tmax = t;
|
||||
}
|
||||
memset(&t, 0, sizeof(t));
|
||||
cfb = ctx->h3_baller.enabled? ctx->h3_baller.cf : NULL;
|
||||
cfb = ctx->h3_baller.enabled ? ctx->h3_baller.cf : NULL;
|
||||
if(cfb && !cfb->cft->query(cfb, data, query, NULL, &t)) {
|
||||
if((t.tv_sec || t.tv_usec) && Curl_timediff_us(t, tmax) > 0)
|
||||
tmax = t;
|
||||
@ -464,7 +464,7 @@ static CURLcode cf_hc_query(struct Curl_cfilter *cf,
|
||||
break;
|
||||
}
|
||||
}
|
||||
return cf->next?
|
||||
return cf->next ?
|
||||
cf->next->cft->query(cf->next, data, query, pres1, pres2) :
|
||||
CURLE_UNKNOWN_OPTION;
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ static void
|
||||
tcpkeepalive(struct Curl_easy *data,
|
||||
curl_socket_t sockfd)
|
||||
{
|
||||
int optval = data->set.tcp_keepalive?1:0;
|
||||
int optval = data->set.tcp_keepalive ? 1 : 0;
|
||||
|
||||
/* only set IDLE and INTVL if setting KEEPALIVE is successful */
|
||||
if(setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE,
|
||||
@ -603,7 +603,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn,
|
||||
|
||||
memset(&sa, 0, sizeof(struct Curl_sockaddr_storage));
|
||||
|
||||
if(iface && (strlen(iface)<255) ) {
|
||||
if(iface && (strlen(iface) < 255) ) {
|
||||
char myhost[256] = "";
|
||||
int done = 0; /* -1 for error, 1 for address found */
|
||||
if2ip_result_t if2ip_result = IF2IP_NOT_FOUND;
|
||||
@ -1642,7 +1642,7 @@ static void cf_socket_active(struct Curl_cfilter *cf, struct Curl_easy *data)
|
||||
cf->conn->primary = ctx->ip;
|
||||
cf->conn->remote_addr = &ctx->addr;
|
||||
#ifdef USE_IPV6
|
||||
cf->conn->bits.ipv6 = (ctx->addr.family == AF_INET6)? TRUE : FALSE;
|
||||
cf->conn->bits.ipv6 = (ctx->addr.family == AF_INET6) ? TRUE : FALSE;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
@ -1725,7 +1725,7 @@ static CURLcode cf_socket_query(struct Curl_cfilter *cf,
|
||||
case CF_QUERY_CONNECT_REPLY_MS:
|
||||
if(ctx->got_first_byte) {
|
||||
timediff_t ms = Curl_timediff(ctx->first_byte_at, ctx->started_at);
|
||||
*pres1 = (ms < INT_MAX)? (int)ms : INT_MAX;
|
||||
*pres1 = (ms < INT_MAX) ? (int)ms : INT_MAX;
|
||||
}
|
||||
else
|
||||
*pres1 = -1;
|
||||
@ -1750,7 +1750,7 @@ static CURLcode cf_socket_query(struct Curl_cfilter *cf,
|
||||
}
|
||||
case CF_QUERY_IP_INFO:
|
||||
#ifdef USE_IPV6
|
||||
*pres1 = (ctx->addr.family == AF_INET6)? TRUE : FALSE;
|
||||
*pres1 = (ctx->addr.family == AF_INET6) ? TRUE : FALSE;
|
||||
#else
|
||||
*pres1 = FALSE;
|
||||
#endif
|
||||
@ -1759,7 +1759,7 @@ static CURLcode cf_socket_query(struct Curl_cfilter *cf,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return cf->next?
|
||||
return cf->next ?
|
||||
cf->next->cft->query(cf->next, data, query, pres1, pres2) :
|
||||
CURLE_UNKNOWN_OPTION;
|
||||
}
|
||||
@ -1806,7 +1806,7 @@ CURLcode Curl_cf_tcp_create(struct Curl_cfilter **pcf,
|
||||
result = Curl_cf_create(&cf, &Curl_cft_tcp, ctx);
|
||||
|
||||
out:
|
||||
*pcf = (!result)? cf : NULL;
|
||||
*pcf = (!result) ? cf : NULL;
|
||||
if(result) {
|
||||
Curl_safefree(cf);
|
||||
Curl_safefree(ctx);
|
||||
@ -1836,7 +1836,7 @@ static CURLcode cf_udp_setup_quic(struct Curl_cfilter *cf,
|
||||
set_local_ip(cf, data);
|
||||
CURL_TRC_CF(data, cf, "%s socket %" FMT_SOCKET_T
|
||||
" connected: [%s:%d] -> [%s:%d]",
|
||||
(ctx->transport == TRNSPRT_QUIC)? "QUIC" : "UDP",
|
||||
(ctx->transport == TRNSPRT_QUIC) ? "QUIC" : "UDP",
|
||||
ctx->sock, ctx->ip.local_ip, ctx->ip.local_port,
|
||||
ctx->ip.remote_ip, ctx->ip.remote_port);
|
||||
|
||||
@ -1955,7 +1955,7 @@ CURLcode Curl_cf_udp_create(struct Curl_cfilter **pcf,
|
||||
result = Curl_cf_create(&cf, &Curl_cft_udp, ctx);
|
||||
|
||||
out:
|
||||
*pcf = (!result)? cf : NULL;
|
||||
*pcf = (!result) ? cf : NULL;
|
||||
if(result) {
|
||||
Curl_safefree(cf);
|
||||
Curl_safefree(ctx);
|
||||
@ -2007,7 +2007,7 @@ CURLcode Curl_cf_unix_create(struct Curl_cfilter **pcf,
|
||||
result = Curl_cf_create(&cf, &Curl_cft_unix, ctx);
|
||||
|
||||
out:
|
||||
*pcf = (!result)? cf : NULL;
|
||||
*pcf = (!result) ? cf : NULL;
|
||||
if(result) {
|
||||
Curl_safefree(cf);
|
||||
Curl_safefree(ctx);
|
||||
|
@ -96,7 +96,7 @@ void Curl_cf_def_adjust_pollset(struct Curl_cfilter *cf,
|
||||
bool Curl_cf_def_data_pending(struct Curl_cfilter *cf,
|
||||
const struct Curl_easy *data)
|
||||
{
|
||||
return cf->next?
|
||||
return cf->next ?
|
||||
cf->next->cft->has_data_pending(cf->next, data) : FALSE;
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ ssize_t Curl_cf_def_send(struct Curl_cfilter *cf, struct Curl_easy *data,
|
||||
const void *buf, size_t len, bool eos,
|
||||
CURLcode *err)
|
||||
{
|
||||
return cf->next?
|
||||
return cf->next ?
|
||||
cf->next->cft->do_send(cf->next, data, buf, len, eos, err) :
|
||||
CURLE_RECV_ERROR;
|
||||
}
|
||||
@ -112,7 +112,7 @@ ssize_t Curl_cf_def_send(struct Curl_cfilter *cf, struct Curl_easy *data,
|
||||
ssize_t Curl_cf_def_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
|
||||
char *buf, size_t len, CURLcode *err)
|
||||
{
|
||||
return cf->next?
|
||||
return cf->next ?
|
||||
cf->next->cft->do_recv(cf->next, data, buf, len, err) :
|
||||
CURLE_SEND_ERROR;
|
||||
}
|
||||
@ -121,7 +121,7 @@ bool Curl_cf_def_conn_is_alive(struct Curl_cfilter *cf,
|
||||
struct Curl_easy *data,
|
||||
bool *input_pending)
|
||||
{
|
||||
return cf->next?
|
||||
return cf->next ?
|
||||
cf->next->cft->is_alive(cf->next, data, input_pending) :
|
||||
FALSE; /* pessimistic in absence of data */
|
||||
}
|
||||
@ -129,7 +129,7 @@ bool Curl_cf_def_conn_is_alive(struct Curl_cfilter *cf,
|
||||
CURLcode Curl_cf_def_conn_keep_alive(struct Curl_cfilter *cf,
|
||||
struct Curl_easy *data)
|
||||
{
|
||||
return cf->next?
|
||||
return cf->next ?
|
||||
cf->next->cft->keep_alive(cf->next, data) :
|
||||
CURLE_OK;
|
||||
}
|
||||
@ -138,7 +138,7 @@ CURLcode Curl_cf_def_query(struct Curl_cfilter *cf,
|
||||
struct Curl_easy *data,
|
||||
int query, int *pres1, void *pres2)
|
||||
{
|
||||
return cf->next?
|
||||
return cf->next ?
|
||||
cf->next->cft->query(cf->next, data, query, pres1, pres2) :
|
||||
CURLE_UNKNOWN_OPTION;
|
||||
}
|
||||
@ -204,7 +204,7 @@ CURLcode Curl_conn_shutdown(struct Curl_easy *data, int sockindex, bool *done)
|
||||
now = Curl_now();
|
||||
if(!Curl_shutdown_started(data, sockindex)) {
|
||||
DEBUGF(infof(data, "shutdown start on%s connection",
|
||||
sockindex? " secondary" : ""));
|
||||
sockindex ? " secondary" : ""));
|
||||
Curl_shutdown_start(data, sockindex, &now);
|
||||
}
|
||||
else {
|
||||
@ -483,12 +483,12 @@ bool Curl_conn_cf_is_ssl(struct Curl_cfilter *cf)
|
||||
|
||||
bool Curl_conn_is_ssl(struct connectdata *conn, int sockindex)
|
||||
{
|
||||
return conn? Curl_conn_cf_is_ssl(conn->cfilter[sockindex]) : FALSE;
|
||||
return conn ? Curl_conn_cf_is_ssl(conn->cfilter[sockindex]) : FALSE;
|
||||
}
|
||||
|
||||
bool Curl_conn_is_multiplex(struct connectdata *conn, int sockindex)
|
||||
{
|
||||
struct Curl_cfilter *cf = conn? conn->cfilter[sockindex] : NULL;
|
||||
struct Curl_cfilter *cf = conn ? conn->cfilter[sockindex] : NULL;
|
||||
|
||||
for(; cf; cf = cf->next) {
|
||||
if(cf->cft->flags & CF_TYPE_MULTIPLEX)
|
||||
@ -523,9 +523,9 @@ bool Curl_conn_cf_needs_flush(struct Curl_cfilter *cf,
|
||||
{
|
||||
CURLcode result;
|
||||
int pending = FALSE;
|
||||
result = cf? cf->cft->query(cf, data, CF_QUERY_NEED_FLUSH,
|
||||
result = cf ? cf->cft->query(cf, data, CF_QUERY_NEED_FLUSH,
|
||||
&pending, NULL) : CURLE_UNKNOWN_OPTION;
|
||||
return (result || pending == FALSE)? FALSE : TRUE;
|
||||
return (result || pending == FALSE) ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
bool Curl_conn_needs_flush(struct Curl_easy *data, int sockindex)
|
||||
@ -672,13 +672,13 @@ curl_socket_t Curl_conn_get_socket(struct Curl_easy *data, int sockindex)
|
||||
{
|
||||
struct Curl_cfilter *cf;
|
||||
|
||||
cf = data->conn? data->conn->cfilter[sockindex] : NULL;
|
||||
cf = data->conn ? data->conn->cfilter[sockindex] : NULL;
|
||||
/* if the top filter has not connected, ask it (and its sub-filters)
|
||||
* for the socket. Otherwise conn->sock[sockindex] should have it.
|
||||
*/
|
||||
if(cf && !cf->connected)
|
||||
return Curl_conn_cf_get_socket(cf, data);
|
||||
return data->conn? data->conn->sock[sockindex] : CURL_SOCKET_BAD;
|
||||
return data->conn ? data->conn->sock[sockindex] : CURL_SOCKET_BAD;
|
||||
}
|
||||
|
||||
void Curl_conn_forget_socket(struct Curl_easy *data, int sockindex)
|
||||
@ -807,7 +807,7 @@ CURLcode Curl_conn_keep_alive(struct Curl_easy *data,
|
||||
int sockindex)
|
||||
{
|
||||
struct Curl_cfilter *cf = conn->cfilter[sockindex];
|
||||
return cf? cf->cft->keep_alive(cf, data) : CURLE_OK;
|
||||
return cf ? cf->cft->keep_alive(cf, data) : CURLE_OK;
|
||||
}
|
||||
|
||||
size_t Curl_conn_get_max_concurrent(struct Curl_easy *data,
|
||||
@ -818,9 +818,9 @@ size_t Curl_conn_get_max_concurrent(struct Curl_easy *data,
|
||||
int n = 0;
|
||||
|
||||
struct Curl_cfilter *cf = conn->cfilter[sockindex];
|
||||
result = cf? cf->cft->query(cf, data, CF_QUERY_MAX_CONCURRENT,
|
||||
result = cf ? cf->cft->query(cf, data, CF_QUERY_MAX_CONCURRENT,
|
||||
&n, NULL) : CURLE_UNKNOWN_OPTION;
|
||||
return (result || n <= 0)? 1 : (size_t)n;
|
||||
return (result || n <= 0) ? 1 : (size_t)n;
|
||||
}
|
||||
|
||||
int Curl_conn_get_stream_error(struct Curl_easy *data,
|
||||
@ -831,9 +831,9 @@ int Curl_conn_get_stream_error(struct Curl_easy *data,
|
||||
int n = 0;
|
||||
|
||||
struct Curl_cfilter *cf = conn->cfilter[sockindex];
|
||||
result = cf? cf->cft->query(cf, data, CF_QUERY_STREAM_ERROR,
|
||||
result = cf ? cf->cft->query(cf, data, CF_QUERY_STREAM_ERROR,
|
||||
&n, NULL) : CURLE_UNKNOWN_OPTION;
|
||||
return (result || n < 0)? 0 : n;
|
||||
return (result || n < 0) ? 0 : n;
|
||||
}
|
||||
|
||||
int Curl_conn_sockindex(struct Curl_easy *data, curl_socket_t sockfd)
|
||||
@ -854,7 +854,7 @@ CURLcode Curl_conn_recv(struct Curl_easy *data, int sockindex,
|
||||
nread = data->conn->recv[sockindex](data, sockindex, buf, blen, &result);
|
||||
DEBUGASSERT(nread >= 0 || result);
|
||||
DEBUGASSERT(nread < 0 || !result);
|
||||
*n = (nread >= 0)? (size_t)nread : 0;
|
||||
*n = (nread >= 0) ? (size_t)nread : 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -889,7 +889,7 @@ CURLcode Curl_conn_send(struct Curl_easy *data, int sockindex,
|
||||
nwritten = conn->send[sockindex](data, sockindex, buf, write_len, eos,
|
||||
&result);
|
||||
DEBUGASSERT((nwritten >= 0) || result);
|
||||
*pnwritten = (nwritten < 0)? 0 : (size_t)nwritten;
|
||||
*pnwritten = (nwritten < 0) ? 0 : (size_t)nwritten;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -899,7 +899,7 @@ void Curl_pollset_reset(struct Curl_easy *data,
|
||||
size_t i;
|
||||
(void)data;
|
||||
memset(ps, 0, sizeof(*ps));
|
||||
for(i = 0; i< MAX_SOCKSPEREASYHANDLE; i++)
|
||||
for(i = 0; i < MAX_SOCKSPEREASYHANDLE; i++)
|
||||
ps->sockets[i] = CURL_SOCKET_BAD;
|
||||
}
|
||||
|
||||
@ -961,8 +961,10 @@ void Curl_pollset_set(struct Curl_easy *data,
|
||||
bool do_in, bool do_out)
|
||||
{
|
||||
Curl_pollset_change(data, ps, sock,
|
||||
(do_in?CURL_POLL_IN:0)|(do_out?CURL_POLL_OUT:0),
|
||||
(!do_in?CURL_POLL_IN:0)|(!do_out?CURL_POLL_OUT:0));
|
||||
(do_in ? CURL_POLL_IN : 0)|
|
||||
(do_out ? CURL_POLL_OUT : 0),
|
||||
(!do_in ? CURL_POLL_IN : 0)|
|
||||
(!do_out ? CURL_POLL_OUT : 0));
|
||||
}
|
||||
|
||||
static void ps_add(struct Curl_easy *data, struct easy_pollset *ps,
|
||||
|
@ -491,7 +491,7 @@ bool Curl_cpool_conn_now_idle(struct Curl_easy *data,
|
||||
struct connectdata *conn)
|
||||
{
|
||||
unsigned int maxconnects = !data->multi->maxconnects ?
|
||||
data->multi->num_easy * 4: data->multi->maxconnects;
|
||||
data->multi->num_easy * 4 : data->multi->maxconnects;
|
||||
struct connectdata *oldest_idle = NULL;
|
||||
struct cpool *cpool = cpool_get_instance(data);
|
||||
bool kept = TRUE;
|
||||
@ -820,7 +820,7 @@ void Curl_cpool_disconnect(struct Curl_easy *data,
|
||||
if(data->multi) {
|
||||
/* Add it to the multi's cpool for shutdown handling */
|
||||
infof(data, "%s connection #%" FMT_OFF_T,
|
||||
aborted? "closing" : "shutting down", conn->connection_id);
|
||||
aborted ? "closing" : "shutting down", conn->connection_id);
|
||||
cpool_discard_conn(&data->multi->cpool, data, conn, aborted);
|
||||
}
|
||||
else {
|
||||
@ -1180,7 +1180,7 @@ static void cpool_shutdown_all(struct cpool *cpool,
|
||||
timespent = Curl_timediff(Curl_now(), started);
|
||||
if(timespent >= (timediff_t)timeout_ms) {
|
||||
DEBUGF(infof(data, "cpool shutdown %s",
|
||||
(timeout_ms > 0)? "timeout" : "best effort done"));
|
||||
(timeout_ms > 0) ? "timeout" : "best effort done"));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ timediff_t Curl_timeleft(struct Curl_easy *data,
|
||||
return ctimeleft_ms; /* no general timeout, this is it */
|
||||
}
|
||||
/* return minimal time left or max amount already expired */
|
||||
return (ctimeleft_ms < timeleft_ms)? ctimeleft_ms : timeleft_ms;
|
||||
return (ctimeleft_ms < timeleft_ms) ? ctimeleft_ms : timeleft_ms;
|
||||
}
|
||||
|
||||
void Curl_shutdown_start(struct Curl_easy *data, int sockindex,
|
||||
@ -172,7 +172,7 @@ timediff_t Curl_shutdown_timeleft(struct connectdata *conn, int sockindex,
|
||||
}
|
||||
left_ms = conn->shutdown.timeout_ms -
|
||||
Curl_timediff(*nowp, conn->shutdown.start[sockindex]);
|
||||
return left_ms? left_ms : -1;
|
||||
return left_ms ? left_ms : -1;
|
||||
}
|
||||
|
||||
timediff_t Curl_conn_shutdown_timeleft(struct connectdata *conn,
|
||||
@ -414,9 +414,9 @@ static CURLcode eyeballer_new(struct eyeballer **pballer,
|
||||
if(!baller)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
baller->name = ((ai_family == AF_INET)? "ipv4" : (
|
||||
baller->name = ((ai_family == AF_INET) ? "ipv4" : (
|
||||
#ifdef USE_IPV6
|
||||
(ai_family == AF_INET6)? "ipv6" :
|
||||
(ai_family == AF_INET6) ? "ipv6" :
|
||||
#endif
|
||||
"ip"));
|
||||
baller->cf_create = cf_create;
|
||||
@ -424,7 +424,7 @@ static CURLcode eyeballer_new(struct eyeballer **pballer,
|
||||
baller->ai_family = ai_family;
|
||||
baller->primary = primary;
|
||||
baller->delay_ms = delay_ms;
|
||||
baller->timeoutms = addr_next_match(baller->addr, baller->ai_family)?
|
||||
baller->timeoutms = addr_next_match(baller->addr, baller->ai_family) ?
|
||||
USETIME(timeout_ms) : timeout_ms;
|
||||
baller->timeout_id = timeout_id;
|
||||
baller->result = CURLE_COULDNT_CONNECT;
|
||||
@ -1089,7 +1089,7 @@ static CURLcode cf_he_query(struct Curl_cfilter *cf,
|
||||
}
|
||||
}
|
||||
|
||||
return cf->next?
|
||||
return cf->next ?
|
||||
cf->next->cft->query(cf->next, data, query, pres1, pres2) :
|
||||
CURLE_UNKNOWN_OPTION;
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ static CURLcode process_trailer(struct Curl_easy *data,
|
||||
{
|
||||
z_stream *z = &zp->z;
|
||||
CURLcode result = CURLE_OK;
|
||||
uInt len = z->avail_in < zp->trailerlen? z->avail_in: zp->trailerlen;
|
||||
uInt len = z->avail_in < zp->trailerlen ? z->avail_in : zp->trailerlen;
|
||||
|
||||
/* Consume expected trailer bytes. Terminate stream if exhausted.
|
||||
Issue an error if unexpected bytes follow. */
|
||||
@ -654,7 +654,7 @@ static CURLcode brotli_do_init(struct Curl_easy *data,
|
||||
(void) data;
|
||||
|
||||
bp->br = BrotliDecoderCreateInstance(NULL, NULL, NULL);
|
||||
return bp->br? CURLE_OK: CURLE_OUT_OF_MEMORY;
|
||||
return bp->br ? CURLE_OK : CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
static CURLcode brotli_do_write(struct Curl_easy *data,
|
||||
@ -971,8 +971,8 @@ static const struct Curl_cwtype *find_unencode_writer(const char *name,
|
||||
CURLcode Curl_build_unencoding_stack(struct Curl_easy *data,
|
||||
const char *enclist, int is_transfer)
|
||||
{
|
||||
Curl_cwriter_phase phase = is_transfer?
|
||||
CURL_CW_TRANSFER_DECODE:CURL_CW_CONTENT_DECODE;
|
||||
Curl_cwriter_phase phase = is_transfer ?
|
||||
CURL_CW_TRANSFER_DECODE : CURL_CW_CONTENT_DECODE;
|
||||
CURLcode result;
|
||||
|
||||
do {
|
||||
@ -995,7 +995,7 @@ CURLcode Curl_build_unencoding_stack(struct Curl_easy *data,
|
||||
struct Curl_cwriter *writer;
|
||||
|
||||
CURL_TRC_WRITE(data, "looking for %s decoder: %.*s",
|
||||
is_transfer? "transfer" : "content", (int)namelen, name);
|
||||
is_transfer ? "transfer" : "content", (int)namelen, name);
|
||||
is_chunked = (is_transfer && (namelen == 7) &&
|
||||
strncasecompare(name, "chunked", 7));
|
||||
/* if we skip the decoding in this phase, do not look further.
|
||||
@ -1046,7 +1046,7 @@ CURLcode Curl_build_unencoding_stack(struct Curl_easy *data,
|
||||
|
||||
result = Curl_cwriter_create(&writer, data, cwt, phase);
|
||||
CURL_TRC_WRITE(data, "added %s decoder %s -> %d",
|
||||
is_transfer? "transfer" : "content", cwt->name, result);
|
||||
is_transfer ? "transfer" : "content", cwt->name, result);
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
|
24
lib/cookie.c
24
lib/cookie.c
@ -245,7 +245,7 @@ static const char *get_top_domain(const char * const domain, size_t *outlen)
|
||||
if(outlen)
|
||||
*outlen = len;
|
||||
|
||||
return first? first: domain;
|
||||
return first ? first : domain;
|
||||
}
|
||||
|
||||
/* Avoid C1001, an "internal error" with MSVC14 */
|
||||
@ -730,8 +730,8 @@ Curl_cookie_add(struct Curl_easy *data,
|
||||
*/
|
||||
CURLofft offt;
|
||||
const char *maxage = valuep;
|
||||
offt = curlx_strtoofft((*maxage == '\"')?
|
||||
&maxage[1]:&maxage[0], NULL, 10,
|
||||
offt = curlx_strtoofft((*maxage == '\"') ?
|
||||
&maxage[1] : &maxage[0], NULL, 10,
|
||||
&co->expires);
|
||||
switch(offt) {
|
||||
case CURL_OFFT_FLOW:
|
||||
@ -1171,7 +1171,7 @@ Curl_cookie_add(struct Curl_easy *data,
|
||||
/* Only show this when NOT reading the cookies from a file */
|
||||
infof(data, "%s cookie %s=\"%s\" for domain %s, path %s, "
|
||||
"expire %" FMT_OFF_T,
|
||||
replace_old?"Replaced":"Added", co->name, co->value,
|
||||
replace_old ? "Replaced":"Added", co->name, co->value,
|
||||
co->domain, co->path, co->expires);
|
||||
|
||||
if(!replace_old) {
|
||||
@ -1471,7 +1471,7 @@ struct Cookie *Curl_cookie_getlist(struct Curl_easy *data,
|
||||
/* remake the linked list order according to the new order */
|
||||
|
||||
mainco = array[0]; /* start here */
|
||||
for(i = 0; i<matches-1; i++)
|
||||
for(i = 0; i < matches-1; i++)
|
||||
array[i]->next = array[i + 1];
|
||||
array[matches-1]->next = NULL; /* terminate the list */
|
||||
|
||||
@ -1592,19 +1592,19 @@ static char *get_netscape_format(const struct Cookie *co)
|
||||
"%" FMT_OFF_T "\t" /* expires */
|
||||
"%s\t" /* name */
|
||||
"%s", /* value */
|
||||
co->httponly?"#HttpOnly_":"",
|
||||
co->httponly ? "#HttpOnly_" : "",
|
||||
/*
|
||||
* Make sure all domains are prefixed with a dot if they allow
|
||||
* tailmatching. This is Mozilla-style.
|
||||
*/
|
||||
(co->tailmatch && co->domain && co->domain[0] != '.')? ".":"",
|
||||
co->domain?co->domain:"unknown",
|
||||
co->tailmatch?"TRUE":"FALSE",
|
||||
co->path?co->path:"/",
|
||||
co->secure?"TRUE":"FALSE",
|
||||
(co->tailmatch && co->domain && co->domain[0] != '.') ? "." : "",
|
||||
co->domain ? co->domain : "unknown",
|
||||
co->tailmatch ? "TRUE" : "FALSE",
|
||||
co->path ? co->path : "/",
|
||||
co->secure ? "TRUE" : "FALSE",
|
||||
co->expires,
|
||||
co->name,
|
||||
co->value?co->value:"");
|
||||
co->value ? co->value : "");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -293,7 +293,7 @@ static int loop(const unsigned char *pattern, const unsigned char *string,
|
||||
p++;
|
||||
break;
|
||||
case '\0':
|
||||
return *s? CURL_FNMATCH_NOMATCH: CURL_FNMATCH_MATCH;
|
||||
return *s ? CURL_FNMATCH_NOMATCH : CURL_FNMATCH_MATCH;
|
||||
case '\\':
|
||||
if(p[1])
|
||||
p++;
|
||||
|
@ -483,7 +483,7 @@ static void time2filetime(struct ms_filetime *ft, time_t t)
|
||||
134774 days = 11644473600 seconds = 0x2B6109100 */
|
||||
r = ft->dwLowDateTime;
|
||||
ft->dwLowDateTime = (ft->dwLowDateTime + 0xB6109100U) & 0xFFFFFFFF;
|
||||
ft->dwHighDateTime += ft->dwLowDateTime < r? 0x03: 0x02;
|
||||
ft->dwHighDateTime += ft->dwLowDateTime < r ? 0x03 : 0x02;
|
||||
|
||||
/* Convert to tenths of microseconds. */
|
||||
ft->dwHighDateTime *= 10000000;
|
||||
|
@ -399,7 +399,7 @@ static CURLcode trc_opt(const char *config)
|
||||
|
||||
CURLcode Curl_trc_opt(const char *config)
|
||||
{
|
||||
CURLcode result = config? trc_opt(config) : CURLE_OK;
|
||||
CURLcode result = config ? trc_opt(config) : CURLE_OK;
|
||||
#ifdef DEBUGBUILD
|
||||
/* CURL_DEBUG can override anything */
|
||||
if(!result) {
|
||||
|
10
lib/cw-out.c
10
lib/cw-out.c
@ -177,8 +177,8 @@ static void cw_get_writefunc(struct Curl_easy *data, cw_out_type otype,
|
||||
*pmin_write = 0;
|
||||
break;
|
||||
case CW_OUT_HDS:
|
||||
*pwcb = data->set.fwrite_header? data->set.fwrite_header :
|
||||
(data->set.writeheader? data->set.fwrite_func : NULL);
|
||||
*pwcb = data->set.fwrite_header ? data->set.fwrite_header :
|
||||
(data->set.writeheader ? data->set.fwrite_func : NULL);
|
||||
*pwcb_data = data->set.writeheader;
|
||||
*pmax_write = 0; /* do not chunk-write headers, write them as they are */
|
||||
*pmin_write = 0;
|
||||
@ -218,12 +218,12 @@ static CURLcode cw_out_ptr_flush(struct cw_out_ctx *ctx,
|
||||
while(blen && !ctx->paused) {
|
||||
if(!flush_all && blen < min_write)
|
||||
break;
|
||||
wlen = max_write? CURLMIN(blen, max_write) : blen;
|
||||
wlen = max_write ? CURLMIN(blen, max_write) : blen;
|
||||
Curl_set_in_callback(data, TRUE);
|
||||
nwritten = wcb((char *)buf, 1, wlen, wcb_data);
|
||||
Curl_set_in_callback(data, FALSE);
|
||||
CURL_TRC_WRITE(data, "cw_out, wrote %zu %s bytes -> %zu",
|
||||
wlen, (otype == CW_OUT_BODY)? "body" : "header",
|
||||
wlen, (otype == CW_OUT_BODY) ? "body" : "header",
|
||||
nwritten);
|
||||
if(CURL_WRITEFUNC_PAUSE == nwritten) {
|
||||
if(data->conn && data->conn->handler->flags & PROTOPT_NONETWORK) {
|
||||
@ -431,7 +431,7 @@ bool Curl_cw_out_is_paused(struct Curl_easy *data)
|
||||
return FALSE;
|
||||
|
||||
ctx = (struct cw_out_ctx *)cw_out;
|
||||
CURL_TRC_WRITE(data, "cw-out is%spaused", ctx->paused? "" : " not");
|
||||
CURL_TRC_WRITE(data, "cw-out is%spaused", ctx->paused ? "" : " not");
|
||||
return ctx->paused;
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ UNITTEST DOHcode doh_req_encode(const char *host,
|
||||
*dnsp++ = 0; /* append zero-length label for root */
|
||||
|
||||
/* 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 >> 8)); /* upper 8 bit TYPE */
|
||||
*dnsp++ = (unsigned char)(255 & dnstype); /* lower 8 bit TYPE */
|
||||
|
||||
*dnsp++ = '\0'; /* upper 8 bit CLASS */
|
||||
@ -855,7 +855,7 @@ static void doh_show(struct Curl_easy *data,
|
||||
len = sizeof(buffer) - len;
|
||||
for(j = 0; j < 16; j += 2) {
|
||||
size_t l;
|
||||
msnprintf(ptr, len, "%s%02x%02x", j?":":"", d->addr[i].ip.v6[j],
|
||||
msnprintf(ptr, len, "%s%02x%02x", j ? ":" : "", d->addr[i].ip.v6[j],
|
||||
d->addr[i].ip.v6[j + 1]);
|
||||
l = strlen(ptr);
|
||||
len -= l;
|
||||
@ -1305,7 +1305,7 @@ CURLcode Curl_doh_is_resolved(struct Curl_easy *data,
|
||||
if(dohp->probe[DOH_SLOT_IPV4].easy_mid < 0 &&
|
||||
dohp->probe[DOH_SLOT_IPV6].easy_mid < 0) {
|
||||
failf(data, "Could not DoH-resolve: %s", data->state.async.hostname);
|
||||
return CONN_IS_PROXIED(data->conn)?CURLE_COULDNT_RESOLVE_PROXY:
|
||||
return CONN_IS_PROXIED(data->conn) ? CURLE_COULDNT_RESOLVE_PROXY :
|
||||
CURLE_COULDNT_RESOLVE_HOST;
|
||||
}
|
||||
else if(!dohp->pending) {
|
||||
@ -1415,7 +1415,8 @@ void Curl_doh_close(struct Curl_easy *data)
|
||||
doh->probe[slot].easy_mid = -1;
|
||||
/* should have been called before data is removed from multi handle */
|
||||
DEBUGASSERT(data->multi);
|
||||
probe_data = data->multi? Curl_multi_get_handle(data->multi, mid) : NULL;
|
||||
probe_data = data->multi ? Curl_multi_get_handle(data->multi, mid) :
|
||||
NULL;
|
||||
if(!probe_data) {
|
||||
DEBUGF(infof(data, "Curl_doh_close: xfer for mid=%"
|
||||
FMT_OFF_T " not found!",
|
||||
|
@ -141,7 +141,7 @@ void Curl_dynhds_set_opts(struct dynhds *dynhds, int opts)
|
||||
struct dynhds_entry *Curl_dynhds_getn(struct dynhds *dynhds, size_t n)
|
||||
{
|
||||
DEBUGASSERT(dynhds);
|
||||
return (n < dynhds->hds_len)? dynhds->hds[n] : NULL;
|
||||
return (n < dynhds->hds_len) ? dynhds->hds[n] : NULL;
|
||||
}
|
||||
|
||||
struct dynhds_entry *Curl_dynhds_get(struct dynhds *dynhds, const char *name,
|
||||
@ -272,7 +272,7 @@ CURLcode Curl_dynhds_h1_add_line(struct dynhds *dynhds,
|
||||
|
||||
CURLcode Curl_dynhds_h1_cadd_line(struct dynhds *dynhds, const char *line)
|
||||
{
|
||||
return Curl_dynhds_h1_add_line(dynhds, line, line? strlen(line) : 0);
|
||||
return Curl_dynhds_h1_add_line(dynhds, line, line ? strlen(line) : 0);
|
||||
}
|
||||
|
||||
#ifdef UNITTESTS
|
||||
|
16
lib/easy.c
16
lib/easy.c
@ -487,8 +487,8 @@ static int events_socket(struct Curl_easy *easy, /* easy handle */
|
||||
m->socket.events = socketcb2poll(what);
|
||||
infof(easy, "socket cb: socket %" FMT_SOCKET_T
|
||||
" UPDATED as %s%s", s,
|
||||
(what&CURL_POLL_IN)?"IN":"",
|
||||
(what&CURL_POLL_OUT)?"OUT":"");
|
||||
(what&CURL_POLL_IN) ? "IN" : "",
|
||||
(what&CURL_POLL_OUT) ? "OUT" : "");
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -512,8 +512,8 @@ static int events_socket(struct Curl_easy *easy, /* easy handle */
|
||||
m->socket.revents = 0;
|
||||
ev->list = m;
|
||||
infof(easy, "socket cb: socket %" FMT_SOCKET_T " ADDED as %s%s", s,
|
||||
(what&CURL_POLL_IN)?"IN":"",
|
||||
(what&CURL_POLL_OUT)?"OUT":"");
|
||||
(what&CURL_POLL_IN) ? "IN" : "",
|
||||
(what&CURL_POLL_OUT) ? "OUT" : "");
|
||||
}
|
||||
else
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
@ -617,7 +617,7 @@ static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev)
|
||||
DEBUGASSERT(data);
|
||||
|
||||
/* loop over the monitored sockets to see which ones had activity */
|
||||
for(i = 0; i< numfds; i++) {
|
||||
for(i = 0; i < numfds; i++) {
|
||||
if(fds[i].revents) {
|
||||
/* socket activity, tell libcurl */
|
||||
int act = poll2cselect(fds[i].revents); /* convert */
|
||||
@ -877,7 +877,7 @@ static CURLcode dupset(struct Curl_easy *dst, struct Curl_easy *src)
|
||||
memset(dst->set.blobs, 0, BLOB_LAST * sizeof(struct curl_blob *));
|
||||
|
||||
/* duplicate all strings */
|
||||
for(i = (enum dupstring)0; i< STRING_LASTZEROTERMINATED; i++) {
|
||||
for(i = (enum dupstring)0; i < STRING_LASTZEROTERMINATED; i++) {
|
||||
result = Curl_setstropt(&dst->set.str[i], src->set.str[i]);
|
||||
if(result)
|
||||
return result;
|
||||
@ -1127,8 +1127,8 @@ CURLcode curl_easy_pause(struct Curl_easy *data, int action)
|
||||
|
||||
/* first switch off both pause bits then set the new pause bits */
|
||||
newstate = (k->keepon &~ (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE)) |
|
||||
((action & CURLPAUSE_RECV)?KEEP_RECV_PAUSE:0) |
|
||||
((action & CURLPAUSE_SEND)?KEEP_SEND_PAUSE:0);
|
||||
((action & CURLPAUSE_RECV) ? KEEP_RECV_PAUSE : 0) |
|
||||
((action & CURLPAUSE_SEND) ? KEEP_SEND_PAUSE : 0);
|
||||
|
||||
keep_changed = ((newstate & (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE)) != oldstate);
|
||||
not_all_paused = (newstate & (KEEP_RECV_PAUSE|KEEP_SEND_PAUSE)) !=
|
||||
|
@ -63,7 +63,7 @@ char *curl_easy_escape(struct Curl_easy *data, const char *string,
|
||||
if(!string || (inlength < 0))
|
||||
return NULL;
|
||||
|
||||
length = (inlength?(size_t)inlength:strlen(string));
|
||||
length = (inlength ? (size_t)inlength : strlen(string));
|
||||
if(!length)
|
||||
return strdup("");
|
||||
|
||||
@ -82,7 +82,7 @@ char *curl_easy_escape(struct Curl_easy *data, const char *string,
|
||||
/* encode it */
|
||||
const char hex[] = "0123456789ABCDEF";
|
||||
char out[3]={'%'};
|
||||
out[1] = hex[in>>4];
|
||||
out[1] = hex[in >> 4];
|
||||
out[2] = hex[in & 0xf];
|
||||
if(Curl_dyn_addn(&d, out, 3))
|
||||
return NULL;
|
||||
@ -223,7 +223,7 @@ void Curl_hexencode(const unsigned char *src, size_t len, /* input length */
|
||||
while(len-- && (olen >= 3)) {
|
||||
/* clang-tidy warns on this line without this comment: */
|
||||
/* NOLINTNEXTLINE(clang-analyzer-core.UndefinedBinaryOperatorResult) */
|
||||
*out++ = (unsigned char)hex[(*src & 0xF0)>>4];
|
||||
*out++ = (unsigned char)hex[(*src & 0xF0) >> 4];
|
||||
*out++ = (unsigned char)hex[*src & 0x0F];
|
||||
++src;
|
||||
olen -= 2;
|
||||
|
@ -489,7 +489,7 @@ static CURLcode file_do(struct Curl_easy *data, bool *done)
|
||||
headerlen =
|
||||
msnprintf(header, sizeof(header),
|
||||
"Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",
|
||||
Curl_wkday[tm->tm_wday?tm->tm_wday-1:6],
|
||||
Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6],
|
||||
tm->tm_mday,
|
||||
Curl_month[tm->tm_mon],
|
||||
tm->tm_year + 1900,
|
||||
|
@ -282,8 +282,8 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
if(current_form->name)
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else {
|
||||
char *name = array_state?
|
||||
array_value:va_arg(params, char *);
|
||||
char *name = array_state ?
|
||||
array_value : va_arg(params, char *);
|
||||
if(name)
|
||||
current_form->name = name; /* store for the moment */
|
||||
else
|
||||
@ -295,7 +295,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else
|
||||
current_form->namelength =
|
||||
array_state?(size_t)array_value:(size_t)va_arg(params, long);
|
||||
array_state ? (size_t)array_value : (size_t)va_arg(params, long);
|
||||
break;
|
||||
|
||||
/*
|
||||
@ -309,7 +309,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else {
|
||||
char *value =
|
||||
array_state?array_value:va_arg(params, char *);
|
||||
array_state ? array_value : va_arg(params, char *);
|
||||
if(value)
|
||||
current_form->value = value; /* store for the moment */
|
||||
else
|
||||
@ -318,13 +318,14 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
break;
|
||||
case CURLFORM_CONTENTSLENGTH:
|
||||
current_form->contentslength =
|
||||
array_state?(size_t)array_value:(size_t)va_arg(params, long);
|
||||
array_state ? (size_t)array_value : (size_t)va_arg(params, long);
|
||||
break;
|
||||
|
||||
case CURLFORM_CONTENTLEN:
|
||||
current_form->flags |= CURL_HTTPPOST_LARGE;
|
||||
current_form->contentslength =
|
||||
array_state?(curl_off_t)(size_t)array_value:va_arg(params, curl_off_t);
|
||||
array_state ? (curl_off_t)(size_t)array_value :
|
||||
va_arg(params, curl_off_t);
|
||||
break;
|
||||
|
||||
/* Get contents from a given filename */
|
||||
@ -332,8 +333,8 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
if(current_form->flags & (HTTPPOST_PTRCONTENTS|HTTPPOST_READFILE))
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else {
|
||||
const char *filename = array_state?
|
||||
array_value:va_arg(params, char *);
|
||||
const char *filename = array_state ?
|
||||
array_value : va_arg(params, char *);
|
||||
if(filename) {
|
||||
current_form->value = strdup(filename);
|
||||
if(!current_form->value)
|
||||
@ -351,7 +352,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
/* We upload a file */
|
||||
case CURLFORM_FILE:
|
||||
{
|
||||
const char *filename = array_state?array_value:
|
||||
const char *filename = array_state ? array_value :
|
||||
va_arg(params, char *);
|
||||
|
||||
if(current_form->value) {
|
||||
@ -401,7 +402,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else {
|
||||
char *buffer =
|
||||
array_state?array_value:va_arg(params, char *);
|
||||
array_state ? array_value : va_arg(params, char *);
|
||||
if(buffer) {
|
||||
current_form->buffer = buffer; /* store for the moment */
|
||||
current_form->value = buffer; /* make it non-NULL to be accepted
|
||||
@ -417,7 +418,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else
|
||||
current_form->bufferlength =
|
||||
array_state?(size_t)array_value:(size_t)va_arg(params, long);
|
||||
array_state ? (size_t)array_value : (size_t)va_arg(params, long);
|
||||
break;
|
||||
|
||||
case CURLFORM_STREAM:
|
||||
@ -426,7 +427,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else {
|
||||
char *userp =
|
||||
array_state?array_value:va_arg(params, char *);
|
||||
array_state ? array_value : va_arg(params, char *);
|
||||
if(userp) {
|
||||
current_form->userp = userp;
|
||||
current_form->value = userp; /* this is not strictly true but we
|
||||
@ -442,7 +443,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
case CURLFORM_CONTENTTYPE:
|
||||
{
|
||||
const char *contenttype =
|
||||
array_state?array_value:va_arg(params, char *);
|
||||
array_state ? array_value : va_arg(params, char *);
|
||||
if(current_form->contenttype) {
|
||||
if(current_form->flags & HTTPPOST_FILENAME) {
|
||||
if(contenttype) {
|
||||
@ -485,8 +486,8 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
{
|
||||
/* this "cast increases required alignment of target type" but
|
||||
we consider it OK anyway */
|
||||
struct curl_slist *list = array_state?
|
||||
(struct curl_slist *)(void *)array_value:
|
||||
struct curl_slist *list = array_state ?
|
||||
(struct curl_slist *)(void *)array_value :
|
||||
va_arg(params, struct curl_slist *);
|
||||
|
||||
if(current_form->contentheader)
|
||||
@ -499,7 +500,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
case CURLFORM_FILENAME:
|
||||
case CURLFORM_BUFFER:
|
||||
{
|
||||
const char *filename = array_state?array_value:
|
||||
const char *filename = array_state ? array_value :
|
||||
va_arg(params, char *);
|
||||
if(current_form->showfilename)
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
@ -569,7 +570,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
if(((form->flags & HTTPPOST_FILENAME) ||
|
||||
(form->flags & HTTPPOST_BUFFER)) &&
|
||||
!form->contenttype) {
|
||||
char *f = (form->flags & HTTPPOST_BUFFER)?
|
||||
char *f = (form->flags & HTTPPOST_BUFFER) ?
|
||||
form->showfilename : form->value;
|
||||
char const *type;
|
||||
type = Curl_mime_contenttype(f);
|
||||
@ -603,8 +604,8 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
app passed in a bad combo, so we better check for that first. */
|
||||
if(form->name) {
|
||||
/* copy name (without strdup; possibly not null-terminated) */
|
||||
form->name = Curl_memdup0(form->name, form->namelength?
|
||||
form->namelength:
|
||||
form->name = Curl_memdup0(form->name, form->namelength ?
|
||||
form->namelength :
|
||||
strlen(form->name));
|
||||
}
|
||||
if(!form->name) {
|
||||
@ -896,7 +897,8 @@ CURLcode Curl_getformdata(struct Curl_easy *data,
|
||||
}
|
||||
else if(post->flags & HTTPPOST_BUFFER)
|
||||
result = curl_mime_data(part, post->buffer,
|
||||
post->bufferlength? post->bufferlength: -1);
|
||||
post->bufferlength ?
|
||||
post->bufferlength : -1);
|
||||
else if(post->flags & HTTPPOST_CALLBACK) {
|
||||
/* the contents should be read with the callback and the size is set
|
||||
with the contentslength */
|
||||
|
58
lib/ftp.c
58
lib/ftp.c
@ -712,7 +712,7 @@ static CURLcode AllowServerConnect(struct Curl_easy *data, bool *connected)
|
||||
else {
|
||||
/* Add timeout to multi handle and break out of the loop */
|
||||
Curl_expire(data, data->set.accepttimeout ?
|
||||
data->set.accepttimeout: DEFAULT_ACCEPT_TIMEOUT,
|
||||
data->set.accepttimeout : DEFAULT_ACCEPT_TIMEOUT,
|
||||
EXPIRE_FTP_ACCEPT);
|
||||
}
|
||||
|
||||
@ -864,7 +864,7 @@ CURLcode Curl_GetFTPResponse(struct Curl_easy *data,
|
||||
*/
|
||||
}
|
||||
else if(!Curl_conn_data_pending(data, FIRSTSOCKET)) {
|
||||
curl_socket_t wsock = Curl_pp_needs_flush(data, pp)?
|
||||
curl_socket_t wsock = Curl_pp_needs_flush(data, pp) ?
|
||||
sockfd : CURL_SOCKET_BAD;
|
||||
int ev = Curl_socket_check(sockfd, CURL_SOCKET_BAD, wsock, interval_ms);
|
||||
if(ev < 0) {
|
||||
@ -914,7 +914,7 @@ static CURLcode ftp_state_user(struct Curl_easy *data,
|
||||
{
|
||||
CURLcode result = Curl_pp_sendf(data,
|
||||
&conn->proto.ftpc.pp, "USER %s",
|
||||
conn->user?conn->user:"");
|
||||
conn->user ? conn->user : "");
|
||||
if(!result) {
|
||||
struct ftp_conn *ftpc = &conn->proto.ftpc;
|
||||
ftpc->ftp_trying_alternative = FALSE;
|
||||
@ -1343,7 +1343,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data,
|
||||
*/
|
||||
|
||||
result = Curl_pp_sendf(data, &ftpc->pp, "%s |%d|%s|%hu|", mode[fcmd],
|
||||
sa->sa_family == AF_INET?1:2,
|
||||
sa->sa_family == AF_INET ? 1 : 2,
|
||||
myhost, port);
|
||||
if(result) {
|
||||
failf(data, "Failure sending EPRT command: %s",
|
||||
@ -1368,7 +1368,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data,
|
||||
source++;
|
||||
}
|
||||
*dest = 0;
|
||||
msnprintf(dest, 20, ",%d,%d", (int)(port>>8), (int)(port&0xff));
|
||||
msnprintf(dest, 20, ",%d,%d", (int)(port >> 8), (int)(port & 0xff));
|
||||
|
||||
result = Curl_pp_sendf(data, &ftpc->pp, "%s %s", mode[fcmd], target);
|
||||
if(result) {
|
||||
@ -1426,7 +1426,7 @@ static CURLcode ftp_state_use_pasv(struct Curl_easy *data,
|
||||
conn->bits.ftp_use_epsv = TRUE;
|
||||
#endif
|
||||
|
||||
modeoff = conn->bits.ftp_use_epsv?0:1;
|
||||
modeoff = conn->bits.ftp_use_epsv ? 0 : 1;
|
||||
|
||||
result = Curl_pp_sendf(data, &ftpc->pp, "%s", mode[modeoff]);
|
||||
if(!result) {
|
||||
@ -1470,8 +1470,8 @@ static CURLcode ftp_state_prepare_transfer(struct Curl_easy *data)
|
||||
if(!conn->proto.ftpc.file)
|
||||
result = Curl_pp_sendf(data, &ftpc->pp, "PRET %s",
|
||||
data->set.str[STRING_CUSTOMREQUEST]?
|
||||
data->set.str[STRING_CUSTOMREQUEST]:
|
||||
(data->state.list_only?"NLST":"LIST"));
|
||||
data->set.str[STRING_CUSTOMREQUEST] :
|
||||
(data->state.list_only ? "NLST" : "LIST"));
|
||||
else if(data->state.upload)
|
||||
result = Curl_pp_sendf(data, &ftpc->pp, "PRET STOR %s",
|
||||
conn->proto.ftpc.file);
|
||||
@ -1577,10 +1577,10 @@ static CURLcode ftp_state_list(struct Curl_easy *data)
|
||||
|
||||
cmd = aprintf("%s%s%s",
|
||||
data->set.str[STRING_CUSTOMREQUEST]?
|
||||
data->set.str[STRING_CUSTOMREQUEST]:
|
||||
(data->state.list_only?"NLST":"LIST"),
|
||||
lstArg? " ": "",
|
||||
lstArg? lstArg: "");
|
||||
data->set.str[STRING_CUSTOMREQUEST] :
|
||||
(data->state.list_only ? "NLST" : "LIST"),
|
||||
lstArg ? " " : "",
|
||||
lstArg ? lstArg : "");
|
||||
free(lstArg);
|
||||
|
||||
if(!cmd)
|
||||
@ -1736,7 +1736,7 @@ static CURLcode ftp_state_ul_setup(struct Curl_easy *data,
|
||||
} while(passed < data->state.resume_from);
|
||||
}
|
||||
/* now, decrease the size of the read */
|
||||
if(data->state.infilesize>0) {
|
||||
if(data->state.infilesize > 0) {
|
||||
data->state.infilesize -= data->state.resume_from;
|
||||
|
||||
if(data->state.infilesize <= 0) {
|
||||
@ -1756,7 +1756,7 @@ static CURLcode ftp_state_ul_setup(struct Curl_easy *data,
|
||||
/* we have passed, proceed as normal */
|
||||
} /* resume_from */
|
||||
|
||||
result = Curl_pp_sendf(data, &ftpc->pp, append?"APPE %s":"STOR %s",
|
||||
result = Curl_pp_sendf(data, &ftpc->pp, append ? "APPE %s" : "STOR %s",
|
||||
ftpc->file);
|
||||
if(!result)
|
||||
ftp_state(data, FTP_STOR);
|
||||
@ -1804,7 +1804,7 @@ static CURLcode ftp_state_quote(struct Curl_easy *data,
|
||||
int i = 0;
|
||||
|
||||
/* Skip count1 items in the linked list */
|
||||
while((i< ftpc->count1) && item) {
|
||||
while((i < ftpc->count1) && item) {
|
||||
item = item->next;
|
||||
i++;
|
||||
}
|
||||
@ -2038,7 +2038,7 @@ static CURLcode ftp_state_pasv_resp(struct Curl_easy *data,
|
||||
if(!ftpc->newhost)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
ftpc->newport = (unsigned short)(((ip[4]<<8) + ip[5]) & 0xffff);
|
||||
ftpc->newport = (unsigned short)(((ip[4] << 8) + ip[5]) & 0xffff);
|
||||
}
|
||||
else if(ftpc->count1 == 0) {
|
||||
/* EPSV failed, move on to PASV */
|
||||
@ -2101,7 +2101,7 @@ static CURLcode ftp_state_pasv_resp(struct Curl_easy *data,
|
||||
}
|
||||
|
||||
result = Curl_conn_setup(data, conn, SECONDARYSOCKET, addr,
|
||||
conn->bits.ftp_use_data_ssl?
|
||||
conn->bits.ftp_use_data_ssl ?
|
||||
CURL_CF_SSL_ENABLE : CURL_CF_SSL_DISABLE);
|
||||
|
||||
if(result) {
|
||||
@ -2267,9 +2267,10 @@ static CURLcode ftp_state_mdtm_resp(struct Curl_easy *data,
|
||||
return result;
|
||||
|
||||
/* format: "Tue, 15 Nov 1994 12:45:26" */
|
||||
headerbuflen = msnprintf(headerbuf, sizeof(headerbuf),
|
||||
headerbuflen =
|
||||
msnprintf(headerbuf, sizeof(headerbuf),
|
||||
"Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",
|
||||
Curl_wkday[tm->tm_wday?tm->tm_wday-1:6],
|
||||
Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6],
|
||||
tm->tm_mday,
|
||||
Curl_month[tm->tm_mon],
|
||||
tm->tm_year + 1900,
|
||||
@ -2387,7 +2388,7 @@ static CURLcode ftp_state_retr(struct Curl_easy *data,
|
||||
else {
|
||||
/* We got a file size report, so we check that there actually is a
|
||||
part of the file left to get, or else we go home. */
|
||||
if(data->state.resume_from< 0) {
|
||||
if(data->state.resume_from < 0) {
|
||||
/* We are supposed to download the last abs(from) bytes */
|
||||
if(filesize < -data->state.resume_from) {
|
||||
failf(data, "Offset (%" FMT_OFF_T
|
||||
@ -2700,8 +2701,8 @@ static CURLcode ftp_state_get_resp(struct Curl_easy *data,
|
||||
}
|
||||
else {
|
||||
failf(data, "RETR response: %03d", ftpcode);
|
||||
return instate == FTP_RETR && ftpcode == 550?
|
||||
CURLE_REMOTE_FILE_NOT_FOUND:
|
||||
return instate == FTP_RETR && ftpcode == 550 ?
|
||||
CURLE_REMOTE_FILE_NOT_FOUND :
|
||||
CURLE_FTP_COULDNT_RETR_FILE;
|
||||
}
|
||||
}
|
||||
@ -2753,7 +2754,7 @@ static CURLcode ftp_state_user_resp(struct Curl_easy *data,
|
||||
/* 331 Password required for ...
|
||||
(the server requires to send the user's password too) */
|
||||
result = Curl_pp_sendf(data, &ftpc->pp, "PASS %s",
|
||||
conn->passwd?conn->passwd:"");
|
||||
conn->passwd ? conn->passwd : "");
|
||||
if(!result)
|
||||
ftp_state(data, FTP_PASS);
|
||||
}
|
||||
@ -3432,7 +3433,8 @@ static CURLcode ftp_done(struct Curl_easy *data, CURLcode status,
|
||||
if(data->set.ftp_filemethod == FTPFILE_NOCWD)
|
||||
pathLen = 0; /* relative path => working directory is FTP home */
|
||||
else
|
||||
pathLen -= ftpc->file?strlen(ftpc->file):0; /* file is url-decoded */
|
||||
/* file is url-decoded */
|
||||
pathLen -= ftpc->file ? strlen(ftpc->file) : 0;
|
||||
|
||||
rawPath[pathLen] = '\0';
|
||||
ftpc->prevpath = rawPath;
|
||||
@ -3550,7 +3552,7 @@ static CURLcode ftp_done(struct Curl_easy *data, CURLcode status,
|
||||
}
|
||||
else if(!ftpc->dont_check &&
|
||||
!data->req.bytecount &&
|
||||
(data->req.size>0)) {
|
||||
(data->req.size > 0)) {
|
||||
failf(data, "No data was received");
|
||||
result = CURLE_FTP_COULDNT_RETR_FILE;
|
||||
}
|
||||
@ -3634,7 +3636,7 @@ CURLcode ftp_sendquote(struct Curl_easy *data,
|
||||
static int ftp_need_type(struct connectdata *conn,
|
||||
bool ascii_wanted)
|
||||
{
|
||||
return conn->proto.ftpc.transfertype != (ascii_wanted?'A':'I');
|
||||
return conn->proto.ftpc.transfertype != (ascii_wanted ? 'A' : 'I');
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -3651,7 +3653,7 @@ static CURLcode ftp_nb_type(struct Curl_easy *data,
|
||||
{
|
||||
struct ftp_conn *ftpc = &conn->proto.ftpc;
|
||||
CURLcode result;
|
||||
char want = (char)(ascii?'A':'I');
|
||||
char want = (char)(ascii ? 'A' : 'I');
|
||||
|
||||
if(ftpc->transfertype == want) {
|
||||
ftp_state(data, newstate);
|
||||
@ -4406,7 +4408,7 @@ CURLcode ftp_parse_url_path(struct Curl_easy *data)
|
||||
if(data->set.ftp_filemethod == FTPFILE_NOCWD)
|
||||
n = 0; /* CWD to entry for relative paths */
|
||||
else
|
||||
n -= ftpc->file?strlen(ftpc->file):0;
|
||||
n -= ftpc->file ? strlen(ftpc->file) : 0;
|
||||
|
||||
if((strlen(oldPath) == n) && !strncmp(rawPath, oldPath, n)) {
|
||||
infof(data, "Request has same path as previous transfer");
|
||||
|
@ -70,7 +70,7 @@ static char *GetEnv(const char *variable)
|
||||
}
|
||||
#else
|
||||
char *env = getenv(variable);
|
||||
return (env && env[0])?strdup(env):NULL;
|
||||
return (env && env[0]) ? strdup(env) : NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ static CURLcode getinfo_char(struct Curl_easy *data, CURLINFO info,
|
||||
{
|
||||
switch(info) {
|
||||
case CURLINFO_EFFECTIVE_URL:
|
||||
*param_charp = data->state.url?data->state.url:(char *)"";
|
||||
*param_charp = data->state.url ? data->state.url : (char *)"";
|
||||
break;
|
||||
case CURLINFO_EFFECTIVE_METHOD: {
|
||||
const char *m = data->set.str[STRING_CUSTOMREQUEST];
|
||||
@ -405,12 +405,12 @@ static CURLcode getinfo_offt(struct Curl_easy *data, CURLINFO info,
|
||||
*param_offt = data->progress.ul.speed;
|
||||
break;
|
||||
case CURLINFO_CONTENT_LENGTH_DOWNLOAD_T:
|
||||
*param_offt = (data->progress.flags & PGRS_DL_SIZE_KNOWN)?
|
||||
data->progress.dl.total_size:-1;
|
||||
*param_offt = (data->progress.flags & PGRS_DL_SIZE_KNOWN) ?
|
||||
data->progress.dl.total_size : -1;
|
||||
break;
|
||||
case CURLINFO_CONTENT_LENGTH_UPLOAD_T:
|
||||
*param_offt = (data->progress.flags & PGRS_UL_SIZE_KNOWN)?
|
||||
data->progress.ul.total_size:-1;
|
||||
*param_offt = (data->progress.flags & PGRS_UL_SIZE_KNOWN) ?
|
||||
data->progress.ul.total_size : -1;
|
||||
break;
|
||||
case CURLINFO_TOTAL_TIME_T:
|
||||
*param_offt = data->progress.timespent;
|
||||
@ -446,7 +446,7 @@ static CURLcode getinfo_offt(struct Curl_easy *data, CURLINFO info,
|
||||
*param_offt = data->id;
|
||||
break;
|
||||
case CURLINFO_CONN_ID:
|
||||
*param_offt = data->conn?
|
||||
*param_offt = data->conn ?
|
||||
data->conn->connection_id : data->state.recent_conn_id;
|
||||
break;
|
||||
default:
|
||||
@ -512,12 +512,12 @@ static CURLcode getinfo_double(struct Curl_easy *data, CURLINFO info,
|
||||
*param_doublep = (double)data->progress.ul.speed;
|
||||
break;
|
||||
case CURLINFO_CONTENT_LENGTH_DOWNLOAD:
|
||||
*param_doublep = (data->progress.flags & PGRS_DL_SIZE_KNOWN)?
|
||||
(double)data->progress.dl.total_size:-1;
|
||||
*param_doublep = (data->progress.flags & PGRS_DL_SIZE_KNOWN) ?
|
||||
(double)data->progress.dl.total_size : -1;
|
||||
break;
|
||||
case CURLINFO_CONTENT_LENGTH_UPLOAD:
|
||||
*param_doublep = (data->progress.flags & PGRS_UL_SIZE_KNOWN)?
|
||||
(double)data->progress.ul.total_size:-1;
|
||||
*param_doublep = (data->progress.flags & PGRS_UL_SIZE_KNOWN) ?
|
||||
(double)data->progress.ul.total_size : -1;
|
||||
break;
|
||||
case CURLINFO_REDIRECT_TIME:
|
||||
*param_doublep = DOUBLE_SECS(data->progress.t_redirect);
|
||||
|
@ -54,7 +54,7 @@ static void copy_header_external(struct Curl_header_store *hs,
|
||||
impossible for applications to do == comparisons, as that would otherwise
|
||||
be very tempting and then lead to the reserved bits not being reserved
|
||||
anymore. */
|
||||
h->origin = (unsigned int)(hs->type | (1<<27));
|
||||
h->origin = (unsigned int)(hs->type | (1 << 27));
|
||||
h->anchor = e;
|
||||
}
|
||||
|
||||
|
@ -630,7 +630,7 @@ bool Curl_ipv6works(struct Curl_easy *data)
|
||||
ipv6_works = 1;
|
||||
sclose(s);
|
||||
}
|
||||
return (ipv6_works>0) ? TRUE : FALSE;
|
||||
return (ipv6_works > 0) ? TRUE : FALSE;
|
||||
}
|
||||
}
|
||||
#endif /* USE_IPV6 */
|
||||
@ -1068,7 +1068,7 @@ void Curl_resolv_unlink(struct Curl_easy *data, struct Curl_dns_entry **pdns)
|
||||
static void hostcache_unlink_entry(void *entry)
|
||||
{
|
||||
struct Curl_dns_entry *dns = (struct Curl_dns_entry *) entry;
|
||||
DEBUGASSERT(dns && (dns->refcount>0));
|
||||
DEBUGASSERT(dns && (dns->refcount > 0));
|
||||
|
||||
dns->refcount--;
|
||||
if(dns->refcount == 0) {
|
||||
|
110
lib/http.c
110
lib/http.c
@ -407,7 +407,7 @@ static CURLcode http_perhapsrewind(struct Curl_easy *data,
|
||||
{
|
||||
curl_off_t bytessent = data->req.writebytecount;
|
||||
curl_off_t expectsend = Curl_creader_total_length(data);
|
||||
curl_off_t upload_remain = (expectsend >= 0)? (expectsend - bytessent) : -1;
|
||||
curl_off_t upload_remain = (expectsend >= 0) ? (expectsend - bytessent) : -1;
|
||||
bool little_upload_remains = (upload_remain >= 0 && upload_remain < 2000);
|
||||
bool needs_rewind = Curl_creader_needs_rewind(data);
|
||||
/* By default, we would like to abort the transfer when little or unknown
|
||||
@ -463,14 +463,14 @@ static CURLcode http_perhapsrewind(struct Curl_easy *data,
|
||||
if(abort_upload) {
|
||||
if(upload_remain >= 0)
|
||||
infof(data, "%s%sclose instead of sending %" FMT_OFF_T " more bytes",
|
||||
ongoing_auth? ongoing_auth : "",
|
||||
ongoing_auth? " send, " : "",
|
||||
ongoing_auth ? ongoing_auth : "",
|
||||
ongoing_auth ? " send, " : "",
|
||||
upload_remain);
|
||||
else
|
||||
infof(data, "%s%sclose instead of sending unknown amount "
|
||||
"of more bytes",
|
||||
ongoing_auth? ongoing_auth : "",
|
||||
ongoing_auth? " send, " : "");
|
||||
ongoing_auth ? ongoing_auth : "",
|
||||
ongoing_auth ? " send, " : "");
|
||||
/* We decided to abort the ongoing transfer */
|
||||
streamclose(conn, "Mid-auth HTTP and much data left to send");
|
||||
/* FIXME: questionable manipulation here, can we do this differently? */
|
||||
@ -502,7 +502,7 @@ CURLcode Curl_http_auth_act(struct Curl_easy *data)
|
||||
return CURLE_OK;
|
||||
|
||||
if(data->state.authproblem)
|
||||
return data->set.http_fail_on_error?CURLE_HTTP_RETURNED_ERROR:CURLE_OK;
|
||||
return data->set.http_fail_on_error ? CURLE_HTTP_RETURNED_ERROR : CURLE_OK;
|
||||
|
||||
if((data->state.aptr.user || data->set.str[STRING_BEARER]) &&
|
||||
((data->req.httpcode == 401) ||
|
||||
@ -1261,8 +1261,8 @@ CURLcode Curl_dynhds_add_custom(struct Curl_easy *data,
|
||||
if(is_connect)
|
||||
proxy = HEADER_CONNECT;
|
||||
else
|
||||
proxy = conn->bits.httpproxy && !conn->bits.tunnel_proxy?
|
||||
HEADER_PROXY:HEADER_SERVER;
|
||||
proxy = conn->bits.httpproxy && !conn->bits.tunnel_proxy ?
|
||||
HEADER_PROXY : HEADER_SERVER;
|
||||
|
||||
switch(proxy) {
|
||||
case HEADER_SERVER:
|
||||
@ -1408,8 +1408,8 @@ CURLcode Curl_add_custom_headers(struct Curl_easy *data,
|
||||
if(is_connect)
|
||||
proxy = HEADER_CONNECT;
|
||||
else
|
||||
proxy = conn->bits.httpproxy && !conn->bits.tunnel_proxy?
|
||||
HEADER_PROXY:HEADER_SERVER;
|
||||
proxy = conn->bits.httpproxy && !conn->bits.tunnel_proxy ?
|
||||
HEADER_PROXY : HEADER_SERVER;
|
||||
|
||||
switch(proxy) {
|
||||
case HEADER_SERVER:
|
||||
@ -1602,7 +1602,7 @@ CURLcode Curl_add_timecondition(struct Curl_easy *data,
|
||||
msnprintf(datestr, sizeof(datestr),
|
||||
"%s: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",
|
||||
condp,
|
||||
Curl_wkday[tm->tm_wday?tm->tm_wday-1:6],
|
||||
Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6],
|
||||
tm->tm_mday,
|
||||
Curl_month[tm->tm_mon],
|
||||
tm->tm_year + 1900,
|
||||
@ -1755,11 +1755,12 @@ CURLcode Curl_http_host(struct Curl_easy *data, struct connectdata *conn)
|
||||
(conn->remote_port == PORT_HTTP)) )
|
||||
/* if(HTTPS on port 443) OR (HTTP on port 80) then do not include
|
||||
the port number in the host string */
|
||||
aptr->host = aprintf("Host: %s%s%s\r\n", conn->bits.ipv6_ip?"[":"",
|
||||
host, conn->bits.ipv6_ip?"]":"");
|
||||
aptr->host = aprintf("Host: %s%s%s\r\n", conn->bits.ipv6_ip ? "[" : "",
|
||||
host, conn->bits.ipv6_ip ? "]" : "");
|
||||
else
|
||||
aptr->host = aprintf("Host: %s%s%s:%d\r\n", conn->bits.ipv6_ip?"[":"",
|
||||
host, conn->bits.ipv6_ip?"]":"",
|
||||
aptr->host = aprintf("Host: %s%s%s:%d\r\n",
|
||||
conn->bits.ipv6_ip ? "[" : "",
|
||||
host, conn->bits.ipv6_ip ? "]" : "",
|
||||
conn->remote_port);
|
||||
|
||||
if(!aptr->host)
|
||||
@ -1837,7 +1838,7 @@ CURLcode Curl_http_target(struct Curl_easy *data,
|
||||
|
||||
/* target or URL */
|
||||
result = Curl_dyn_add(r, data->set.str[STRING_TARGET]?
|
||||
data->set.str[STRING_TARGET]:url);
|
||||
data->set.str[STRING_TARGET] : url);
|
||||
free(url);
|
||||
if(result)
|
||||
return (result);
|
||||
@ -2010,7 +2011,7 @@ static CURLcode set_reader(struct Curl_easy *data, Curl_HttpReq httpreq)
|
||||
chunked = Curl_compareheader(ptr, STRCONST("Transfer-Encoding:"),
|
||||
STRCONST("chunked"));
|
||||
}
|
||||
result = Curl_creader_set_fread(data, chunked? -1 : postsize);
|
||||
result = Curl_creader_set_fread(data, chunked ? -1 : postsize);
|
||||
}
|
||||
return result;
|
||||
|
||||
@ -2285,7 +2286,7 @@ CURLcode Curl_http_cookies(struct Curl_easy *data,
|
||||
linecap = TRUE;
|
||||
break;
|
||||
}
|
||||
result = Curl_dyn_addf(r, "%s%s=%s", count?"; ":"",
|
||||
result = Curl_dyn_addf(r, "%s%s=%s", count ? "; " : "",
|
||||
co->name, co->value);
|
||||
if(result)
|
||||
break;
|
||||
@ -2300,7 +2301,7 @@ CURLcode Curl_http_cookies(struct Curl_easy *data,
|
||||
if(!count)
|
||||
result = Curl_dyn_addn(r, STRCONST("Cookie: "));
|
||||
if(!result) {
|
||||
result = Curl_dyn_addf(r, "%s%s", count?"; ":"", addcookies);
|
||||
result = Curl_dyn_addf(r, "%s%s", count ? "; " : "", addcookies);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@ -2350,7 +2351,7 @@ CURLcode Curl_http_range(struct Curl_easy *data,
|
||||
/* TODO: not sure if we want to send this header during authentication
|
||||
* negotiation, but test1084 checks for it. In which case we have a
|
||||
* "null" client reader installed that gives an unexpected length. */
|
||||
curl_off_t total_len = data->req.authneg?
|
||||
curl_off_t total_len = data->req.authneg ?
|
||||
data->state.infilesize :
|
||||
(data->state.resume_from + req_clen);
|
||||
data->state.aptr.rangeline =
|
||||
@ -2634,35 +2635,34 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
|
||||
"%s",/* Alt-Used */
|
||||
|
||||
httpstring,
|
||||
(data->state.aptr.host?data->state.aptr.host:""),
|
||||
(data->state.aptr.host ? data->state.aptr.host : ""),
|
||||
#ifndef CURL_DISABLE_PROXY
|
||||
data->state.aptr.proxyuserpwd?
|
||||
data->state.aptr.proxyuserpwd:"",
|
||||
data->state.aptr.proxyuserpwd ?
|
||||
data->state.aptr.proxyuserpwd : "",
|
||||
#else
|
||||
"",
|
||||
#endif
|
||||
data->state.aptr.userpwd?data->state.aptr.userpwd:"",
|
||||
(data->state.use_range && data->state.aptr.rangeline)?
|
||||
data->state.aptr.rangeline:"",
|
||||
data->state.aptr.userpwd ? data->state.aptr.userpwd : "",
|
||||
(data->state.use_range && data->state.aptr.rangeline) ?
|
||||
data->state.aptr.rangeline : "",
|
||||
(data->set.str[STRING_USERAGENT] &&
|
||||
*data->set.str[STRING_USERAGENT] &&
|
||||
data->state.aptr.uagent)?
|
||||
data->state.aptr.uagent:"",
|
||||
p_accept?p_accept:"",
|
||||
data->state.aptr.te?data->state.aptr.te:"",
|
||||
data->state.aptr.uagent) ?
|
||||
data->state.aptr.uagent : "",
|
||||
p_accept ? p_accept : "",
|
||||
data->state.aptr.te ? data->state.aptr.te : "",
|
||||
(data->set.str[STRING_ENCODING] &&
|
||||
*data->set.str[STRING_ENCODING] &&
|
||||
data->state.aptr.accept_encoding)?
|
||||
data->state.aptr.accept_encoding:"",
|
||||
(data->state.referer && data->state.aptr.ref)?
|
||||
data->state.aptr.ref:"" /* Referer: <data> */,
|
||||
data->state.aptr.accept_encoding) ?
|
||||
data->state.aptr.accept_encoding : "",
|
||||
(data->state.referer && data->state.aptr.ref) ?
|
||||
data->state.aptr.ref : "" /* Referer: <data> */,
|
||||
#ifndef CURL_DISABLE_PROXY
|
||||
(conn->bits.httpproxy &&
|
||||
!conn->bits.tunnel_proxy &&
|
||||
!Curl_checkheaders(data, STRCONST("Proxy-Connection")) &&
|
||||
!Curl_checkProxyheaders(data,
|
||||
conn,
|
||||
STRCONST("Proxy-Connection")))?
|
||||
!Curl_checkProxyheaders(data, conn,
|
||||
STRCONST("Proxy-Connection"))) ?
|
||||
"Proxy-Connection: Keep-Alive\r\n":"",
|
||||
#else
|
||||
"",
|
||||
@ -2754,7 +2754,7 @@ checkhttpprefix(struct Curl_easy *data,
|
||||
{
|
||||
struct curl_slist *head = data->set.http200aliases;
|
||||
statusline rc = STATUS_BAD;
|
||||
statusline onmatch = len >= 5? STATUS_DONE : STATUS_UNKNOWN;
|
||||
statusline onmatch = len >= 5 ? STATUS_DONE : STATUS_UNKNOWN;
|
||||
|
||||
while(head) {
|
||||
if(checkprefixmax(head->data, s, len)) {
|
||||
@ -2776,7 +2776,7 @@ checkrtspprefix(struct Curl_easy *data,
|
||||
const char *s, size_t len)
|
||||
{
|
||||
statusline result = STATUS_BAD;
|
||||
statusline onmatch = len >= 5? STATUS_DONE : STATUS_UNKNOWN;
|
||||
statusline onmatch = len >= 5 ? STATUS_DONE : STATUS_UNKNOWN;
|
||||
(void)data; /* unused */
|
||||
if(checkprefixmax("RTSP/", s, len))
|
||||
result = onmatch;
|
||||
@ -2837,10 +2837,10 @@ CURLcode Curl_http_header(struct Curl_easy *data,
|
||||
#else
|
||||
0
|
||||
#endif
|
||||
))? HD_VAL(hd, hdlen, "Alt-Svc:") : NULL;
|
||||
)) ? HD_VAL(hd, hdlen, "Alt-Svc:") : NULL;
|
||||
if(v) {
|
||||
/* the ALPN of the current request */
|
||||
enum alpnid id = (conn->httpversion == 30)? ALPN_h3 :
|
||||
enum alpnid id = (conn->httpversion == 30) ? ALPN_h3 :
|
||||
(conn->httpversion == 20) ? ALPN_h2 : ALPN_h1;
|
||||
return Curl_altsvc_parse(data, data->asi, v, id, conn->host.name,
|
||||
curlx_uitous((unsigned int)conn->remote_port));
|
||||
@ -2850,7 +2850,7 @@ CURLcode Curl_http_header(struct Curl_easy *data,
|
||||
case 'c':
|
||||
case 'C':
|
||||
/* Check for Content-Length: header lines to get size */
|
||||
v = (!k->http_bodyless && !data->set.ignorecl)?
|
||||
v = (!k->http_bodyless && !data->set.ignorecl) ?
|
||||
HD_VAL(hd, hdlen, "Content-Length:") : NULL;
|
||||
if(v) {
|
||||
curl_off_t contentlength;
|
||||
@ -2876,7 +2876,7 @@ CURLcode Curl_http_header(struct Curl_easy *data,
|
||||
}
|
||||
return CURLE_OK;
|
||||
}
|
||||
v = (!k->http_bodyless && data->set.str[STRING_ENCODING])?
|
||||
v = (!k->http_bodyless && data->set.str[STRING_ENCODING]) ?
|
||||
HD_VAL(hd, hdlen, "Content-Encoding:") : NULL;
|
||||
if(v) {
|
||||
/*
|
||||
@ -2925,7 +2925,7 @@ CURLcode Curl_http_header(struct Curl_easy *data,
|
||||
infof(data, "HTTP/1.0 connection set to keep alive");
|
||||
return CURLE_OK;
|
||||
}
|
||||
v = !k->http_bodyless? HD_VAL(hd, hdlen, "Content-Range:") : NULL;
|
||||
v = !k->http_bodyless ? HD_VAL(hd, hdlen, "Content-Range:") : NULL;
|
||||
if(v) {
|
||||
/* Content-Range: bytes [num]-
|
||||
Content-Range: bytes: [num]-
|
||||
@ -2959,7 +2959,7 @@ CURLcode Curl_http_header(struct Curl_easy *data,
|
||||
case 'l':
|
||||
case 'L':
|
||||
v = (!k->http_bodyless &&
|
||||
(data->set.timecondition || data->set.get_filetime))?
|
||||
(data->set.timecondition || data->set.get_filetime)) ?
|
||||
HD_VAL(hd, hdlen, "Last-Modified:") : NULL;
|
||||
if(v) {
|
||||
k->timeofdoc = Curl_getdate_capped(v);
|
||||
@ -3073,13 +3073,13 @@ CURLcode Curl_http_header(struct Curl_easy *data,
|
||||
case 's':
|
||||
case 'S':
|
||||
#if !defined(CURL_DISABLE_COOKIES)
|
||||
v = (data->cookies && data->state.cookie_engine)?
|
||||
v = (data->cookies && data->state.cookie_engine) ?
|
||||
HD_VAL(hd, hdlen, "Set-Cookie:") : NULL;
|
||||
if(v) {
|
||||
/* If there is a custom-set Host: name, use it here, or else use
|
||||
* real peer hostname. */
|
||||
const char *host = data->state.aptr.cookiehost?
|
||||
data->state.aptr.cookiehost:conn->host.name;
|
||||
const char *host = data->state.aptr.cookiehost ?
|
||||
data->state.aptr.cookiehost : conn->host.name;
|
||||
const bool secure_context =
|
||||
conn->handler->protocol&(CURLPROTO_HTTPS|CURLPROTO_WSS) ||
|
||||
strcasecompare("localhost", host) ||
|
||||
@ -3105,7 +3105,7 @@ CURLcode Curl_http_header(struct Curl_easy *data,
|
||||
0
|
||||
#endif
|
||||
)
|
||||
)? HD_VAL(hd, hdlen, "Strict-Transport-Security:") : NULL;
|
||||
) ? HD_VAL(hd, hdlen, "Strict-Transport-Security:") : NULL;
|
||||
if(v) {
|
||||
CURLcode check =
|
||||
Curl_hsts_parse(data->hsts, conn->host.name, v);
|
||||
@ -3133,7 +3133,7 @@ CURLcode Curl_http_header(struct Curl_easy *data,
|
||||
*/
|
||||
v = (!k->http_bodyless &&
|
||||
(data->state.httpreq != HTTPREQ_HEAD) &&
|
||||
(k->httpcode != 304))?
|
||||
(k->httpcode != 304)) ?
|
||||
HD_VAL(hd, hdlen, "Transfer-Encoding:") : NULL;
|
||||
if(v) {
|
||||
/* One or more encodings. We check for chunked and/or a compression
|
||||
@ -3372,8 +3372,8 @@ static CURLcode http_write_header(struct Curl_easy *data,
|
||||
return result;
|
||||
|
||||
data->req.deductheadercount = (100 <= data->req.httpcode &&
|
||||
199 >= data->req.httpcode)?
|
||||
data->req.headerbytecount:0;
|
||||
199 >= data->req.httpcode) ?
|
||||
data->req.headerbytecount : 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -4052,7 +4052,7 @@ CURLcode Curl_http_decode_status(int *pstatus, const char *s, size_t len)
|
||||
}
|
||||
result = CURLE_OK;
|
||||
out:
|
||||
*pstatus = result? -1 : status;
|
||||
*pstatus = result ? -1 : status;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -4319,7 +4319,7 @@ CURLcode Curl_http_req_to_h2(struct dynhds *h2_headers,
|
||||
infof(data, "set pseudo header %s to %s", HTTP_PSEUDO_SCHEME, scheme);
|
||||
}
|
||||
else {
|
||||
scheme = (data->conn && data->conn->handler->flags & PROTOPT_SSL)?
|
||||
scheme = (data->conn && data->conn->handler->flags & PROTOPT_SSL) ?
|
||||
"https" : "http";
|
||||
}
|
||||
}
|
||||
@ -4479,7 +4479,7 @@ static void cr_exp100_done(struct Curl_easy *data,
|
||||
struct Curl_creader *reader, int premature)
|
||||
{
|
||||
struct cr_exp100_ctx *ctx = reader->ctx;
|
||||
ctx->state = premature? EXP100_FAILED : EXP100_SEND_DATA;
|
||||
ctx->state = premature ? EXP100_FAILED : EXP100_SEND_DATA;
|
||||
data->req.keepon &= ~KEEP_SEND_TIMED;
|
||||
Curl_expire_done(data, EXPIRE_100_TIMEOUT);
|
||||
}
|
||||
|
10
lib/http1.c
10
lib/http1.c
@ -128,7 +128,7 @@ static ssize_t next_line(struct h1_req_parser *parser,
|
||||
else if(*err == CURLE_AGAIN) {
|
||||
/* no line end in `buf`, add it to our scratch */
|
||||
*err = Curl_dyn_addn(&parser->scratch, (const unsigned char *)buf, buflen);
|
||||
nread = (*err)? -1 : (ssize_t)buflen;
|
||||
nread = (*err) ? -1 : (ssize_t)buflen;
|
||||
}
|
||||
return nread;
|
||||
}
|
||||
@ -325,10 +325,10 @@ CURLcode Curl_h1_req_write_head(struct httpreq *req, int http_minor,
|
||||
|
||||
result = Curl_dyn_addf(dbuf, "%s %s%s%s%s HTTP/1.%d\r\n",
|
||||
req->method,
|
||||
req->scheme? req->scheme : "",
|
||||
req->scheme? "://" : "",
|
||||
req->authority? req->authority : "",
|
||||
req->path? req->path : "",
|
||||
req->scheme ? req->scheme : "",
|
||||
req->scheme ? "://" : "",
|
||||
req->authority ? req->authority : "",
|
||||
req->path ? req->path : "",
|
||||
http_minor);
|
||||
if(result)
|
||||
goto out;
|
||||
|
44
lib/http2.c
44
lib/http2.c
@ -254,7 +254,7 @@ static struct h2_stream_ctx *h2_stream_ctx_create(struct cf_h2_ctx *ctx)
|
||||
static void free_push_headers(struct h2_stream_ctx *stream)
|
||||
{
|
||||
size_t i;
|
||||
for(i = 0; i<stream->push_headers_used; i++)
|
||||
for(i = 0; i < stream->push_headers_used; i++)
|
||||
free(stream->push_headers[i]);
|
||||
Curl_safefree(stream->push_headers);
|
||||
stream->push_headers_used = 0;
|
||||
@ -299,7 +299,7 @@ static CURLcode cf_h2_update_local_win(struct Curl_cfilter *cf,
|
||||
int32_t dwsize;
|
||||
int rv;
|
||||
|
||||
dwsize = paused? 0 : cf_h2_get_desired_local_win(cf, data);
|
||||
dwsize = paused ? 0 : cf_h2_get_desired_local_win(cf, data);
|
||||
if(dwsize != stream->local_window_size) {
|
||||
int32_t wsize = nghttp2_session_get_stream_effective_local_window_size(
|
||||
ctx->h2, stream->id);
|
||||
@ -606,7 +606,7 @@ static CURLcode cf_h2_ctx_open(struct Curl_cfilter *cf,
|
||||
/* all set, traffic will be send on connect */
|
||||
result = CURLE_OK;
|
||||
CURL_TRC_CF(data, cf, "[0] created h2 session%s",
|
||||
ctx->via_h1_upgrade? " (via h1 upgrade)" : "");
|
||||
ctx->via_h1_upgrade ? " (via h1 upgrade)" : "");
|
||||
|
||||
out:
|
||||
if(cbs)
|
||||
@ -764,7 +764,7 @@ static CURLcode nw_out_flush(struct Curl_cfilter *cf,
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return Curl_bufq_is_empty(&ctx->outbufq)? CURLE_OK: CURLE_AGAIN;
|
||||
return Curl_bufq_is_empty(&ctx->outbufq) ? CURLE_OK : CURLE_AGAIN;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -852,7 +852,7 @@ char *curl_pushheader_byname(struct curl_pushheaders *h, const char *header)
|
||||
return NULL;
|
||||
|
||||
len = strlen(header);
|
||||
for(i = 0; i<stream->push_headers_used; i++) {
|
||||
for(i = 0; i < stream->push_headers_used; i++) {
|
||||
if(!strncmp(header, stream->push_headers[i], len)) {
|
||||
/* sub-match, make sure that it is followed by a colon */
|
||||
if(stream->push_headers[i][len] != ':')
|
||||
@ -1235,7 +1235,7 @@ static int fr_print(const nghttp2_frame *frame, char *buffer, size_t blen)
|
||||
case NGHTTP2_GOAWAY: {
|
||||
char scratch[128];
|
||||
size_t s_len = sizeof(scratch)/sizeof(scratch[0]);
|
||||
size_t len = (frame->goaway.opaque_data_len < s_len)?
|
||||
size_t len = (frame->goaway.opaque_data_len < s_len) ?
|
||||
frame->goaway.opaque_data_len : s_len-1;
|
||||
if(len)
|
||||
memcpy(scratch, frame->goaway.opaque_data, len);
|
||||
@ -1350,7 +1350,7 @@ static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame,
|
||||
return 0;
|
||||
}
|
||||
|
||||
return on_stream_frame(cf, data_s, frame)? NGHTTP2_ERR_CALLBACK_FAILURE : 0;
|
||||
return on_stream_frame(cf, data_s, frame) ? NGHTTP2_ERR_CALLBACK_FAILURE : 0;
|
||||
}
|
||||
|
||||
static int on_data_chunk_recv(nghttp2_session *session, uint8_t flags,
|
||||
@ -1402,7 +1402,7 @@ static int on_stream_close(nghttp2_session *session, int32_t stream_id,
|
||||
|
||||
DEBUGASSERT(call_data);
|
||||
/* stream id 0 is the connection, do not look there for streams. */
|
||||
data_s = stream_id?
|
||||
data_s = stream_id ?
|
||||
nghttp2_session_get_stream_user_data(session, stream_id) : NULL;
|
||||
if(!data_s) {
|
||||
CURL_TRC_CF(call_data, cf,
|
||||
@ -1683,7 +1683,7 @@ static ssize_t req_body_read_callback(nghttp2_session *session,
|
||||
*data_flags = NGHTTP2_DATA_FLAG_EOF;
|
||||
return nread;
|
||||
}
|
||||
return (nread == 0)? NGHTTP2_ERR_DEFERRED : nread;
|
||||
return (nread == 0) ? NGHTTP2_ERR_DEFERRED : nread;
|
||||
}
|
||||
|
||||
#if !defined(CURL_DISABLE_VERBOSE_STRINGS)
|
||||
@ -1773,7 +1773,7 @@ static ssize_t http2_handle_stream_close(struct Curl_cfilter *cf,
|
||||
}
|
||||
else if(stream->reset) {
|
||||
failf(data, "HTTP/2 stream %u was reset", stream->id);
|
||||
*err = data->req.bytecount? CURLE_PARTIAL_FILE : CURLE_HTTP2;
|
||||
*err = data->req.bytecount ? CURLE_PARTIAL_FILE : CURLE_HTTP2;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1826,14 +1826,14 @@ out:
|
||||
static int sweight_wanted(const struct Curl_easy *data)
|
||||
{
|
||||
/* 0 weight is not set by user and we take the nghttp2 default one */
|
||||
return data->set.priority.weight?
|
||||
return data->set.priority.weight ?
|
||||
data->set.priority.weight : NGHTTP2_DEFAULT_WEIGHT;
|
||||
}
|
||||
|
||||
static int sweight_in_effect(const struct Curl_easy *data)
|
||||
{
|
||||
/* 0 weight is not set by user and we take the nghttp2 default one */
|
||||
return data->state.priority.weight?
|
||||
return data->state.priority.weight ?
|
||||
data->state.priority.weight : NGHTTP2_DEFAULT_WEIGHT;
|
||||
}
|
||||
|
||||
@ -1849,7 +1849,7 @@ static void h2_pri_spec(struct cf_h2_ctx *ctx,
|
||||
{
|
||||
struct Curl_data_priority *prio = &data->set.priority;
|
||||
struct h2_stream_ctx *depstream = H2_STREAM_CTX(ctx, prio->parent);
|
||||
int32_t depstream_id = depstream? depstream->id:0;
|
||||
int32_t depstream_id = depstream ? depstream->id : 0;
|
||||
nghttp2_priority_spec_init(pri_spec, depstream_id,
|
||||
sweight_wanted(data),
|
||||
data->set.priority.exclusive);
|
||||
@ -1920,7 +1920,7 @@ static ssize_t stream_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
|
||||
(ctx->conn_closed && Curl_bufq_is_empty(&ctx->inbufq)) ||
|
||||
(ctx->rcvd_goaway && ctx->remote_max_sid < stream->id)) {
|
||||
CURL_TRC_CF(data, cf, "[%d] returning ERR", stream->id);
|
||||
*err = data->req.bytecount? CURLE_PARTIAL_FILE : CURLE_HTTP2;
|
||||
*err = data->req.bytecount ? CURLE_PARTIAL_FILE : CURLE_HTTP2;
|
||||
nread = -1;
|
||||
}
|
||||
|
||||
@ -1978,7 +1978,7 @@ static CURLcode h2_progress_ingress(struct Curl_cfilter *cf,
|
||||
}
|
||||
else {
|
||||
CURL_TRC_CF(data, cf, "[0] ingress: read %zd bytes", nread);
|
||||
data_max_bytes = (data_max_bytes > (size_t)nread)?
|
||||
data_max_bytes = (data_max_bytes > (size_t)nread) ?
|
||||
(data_max_bytes - (size_t)nread) : 0;
|
||||
}
|
||||
|
||||
@ -2244,7 +2244,7 @@ static ssize_t h2_submit(struct h2_stream_ctx **pstream,
|
||||
|
||||
out:
|
||||
CURL_TRC_CF(data, cf, "[%d] submit -> %zd, %d",
|
||||
stream? stream->id : -1, nwritten, *err);
|
||||
stream ? stream->id : -1, nwritten, *err);
|
||||
Curl_safefree(nva);
|
||||
*pstream = stream;
|
||||
Curl_dynhds_free(&h2_headers);
|
||||
@ -2584,7 +2584,7 @@ static CURLcode http2_data_pause(struct Curl_cfilter *cf,
|
||||
Curl_expire(data, 0, EXPIRE_RUN_NOW);
|
||||
}
|
||||
CURL_TRC_CF(data, cf, "[%d] stream now %spaused", stream->id,
|
||||
pause? "" : "un");
|
||||
pause ? "" : "un");
|
||||
}
|
||||
return CURLE_OK;
|
||||
}
|
||||
@ -2630,7 +2630,7 @@ static bool cf_h2_data_pending(struct Curl_cfilter *cf,
|
||||
if(ctx && (!Curl_bufq_is_empty(&ctx->inbufq)
|
||||
|| (stream && !Curl_bufq_is_empty(&stream->sendbuf))))
|
||||
return TRUE;
|
||||
return cf->next? cf->next->cft->has_data_pending(cf->next, data) : FALSE;
|
||||
return cf->next ? cf->next->cft->has_data_pending(cf->next, data) : FALSE;
|
||||
}
|
||||
|
||||
static bool cf_h2_is_alive(struct Curl_cfilter *cf,
|
||||
@ -2681,12 +2681,12 @@ static CURLcode cf_h2_query(struct Curl_cfilter *cf,
|
||||
else {
|
||||
effective_max = ctx->max_concurrent_streams;
|
||||
}
|
||||
*pres1 = (effective_max > INT_MAX)? INT_MAX : (int)effective_max;
|
||||
*pres1 = (effective_max > INT_MAX) ? INT_MAX : (int)effective_max;
|
||||
CF_DATA_RESTORE(cf, save);
|
||||
return CURLE_OK;
|
||||
case CF_QUERY_STREAM_ERROR: {
|
||||
struct h2_stream_ctx *stream = H2_STREAM_CTX(ctx, data);
|
||||
*pres1 = stream? (int)stream->error : 0;
|
||||
*pres1 = stream ? (int)stream->error : 0;
|
||||
return CURLE_OK;
|
||||
}
|
||||
case CF_QUERY_NEED_FLUSH: {
|
||||
@ -2701,7 +2701,7 @@ static CURLcode cf_h2_query(struct Curl_cfilter *cf,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return cf->next?
|
||||
return cf->next ?
|
||||
cf->next->cft->query(cf->next, data, query, pres1, pres2) :
|
||||
CURLE_UNKNOWN_OPTION;
|
||||
}
|
||||
@ -2799,7 +2799,7 @@ bool Curl_conn_is_http2(const struct Curl_easy *data,
|
||||
const struct connectdata *conn,
|
||||
int sockindex)
|
||||
{
|
||||
return conn? Curl_cf_is_http2(conn->cfilter[sockindex], data) : FALSE;
|
||||
return conn ? Curl_cf_is_http2(conn->cfilter[sockindex], data) : FALSE;
|
||||
}
|
||||
|
||||
bool Curl_http2_may_switch(struct Curl_easy *data,
|
||||
|
@ -512,7 +512,7 @@ static CURLcode canon_string(const char *q, size_t len,
|
||||
}
|
||||
}
|
||||
/* URL encode */
|
||||
out[1] = hex[((unsigned char)*q)>>4];
|
||||
out[1] = hex[((unsigned char)*q) >> 4];
|
||||
out[2] = hex[*q & 0xf];
|
||||
result = Curl_dyn_addn(dq, out, 3);
|
||||
break;
|
||||
|
@ -97,8 +97,8 @@ CURLcode Curl_http_proxy_create_CONNECT(struct httpreq **preq,
|
||||
if(result)
|
||||
goto out;
|
||||
|
||||
authority = aprintf("%s%s%s:%d", ipv6_ip?"[":"", hostname,
|
||||
ipv6_ip?"]":"", port);
|
||||
authority = aprintf("%s%s%s:%d", ipv6_ip ? "[" : "", hostname,
|
||||
ipv6_ip ?"]" : "", port);
|
||||
if(!authority) {
|
||||
result = CURLE_OUT_OF_MEMORY;
|
||||
goto out;
|
||||
@ -185,7 +185,7 @@ connect_sub:
|
||||
*done = FALSE;
|
||||
if(!ctx->cf_protocol) {
|
||||
struct Curl_cfilter *cf_protocol = NULL;
|
||||
int alpn = Curl_conn_cf_is_ssl(cf->next)?
|
||||
int alpn = Curl_conn_cf_is_ssl(cf->next) ?
|
||||
cf->conn->proxy_alpn : CURL_HTTP_VERSION_1_1;
|
||||
|
||||
/* First time call after the subchain connected */
|
||||
@ -195,7 +195,7 @@ connect_sub:
|
||||
case CURL_HTTP_VERSION_1_1:
|
||||
CURL_TRC_CF(data, cf, "installing subfilter for HTTP/1.1");
|
||||
infof(data, "CONNECT tunnel: HTTP/1.%d negotiated",
|
||||
(alpn == CURL_HTTP_VERSION_1_0)? 0 : 1);
|
||||
(alpn == CURL_HTTP_VERSION_1_0) ? 0 : 1);
|
||||
result = Curl_cf_h1_proxy_insert_after(cf, data);
|
||||
if(result)
|
||||
goto out;
|
||||
|
@ -96,7 +96,7 @@ Curl_llist_insert_next(struct Curl_llist *list,
|
||||
}
|
||||
else {
|
||||
/* if 'e' is NULL here, we insert the new element first in the list */
|
||||
ne->_next = e?e->_next:list->_head;
|
||||
ne->_next = e ? e->_next : list->_head;
|
||||
ne->_prev = e;
|
||||
if(!e) {
|
||||
list->_head->_prev = ne;
|
||||
|
57
lib/mime.c
57
lib/mime.c
@ -259,7 +259,7 @@ static char *Curl_basename(char *path)
|
||||
s2 = strrchr(path, '\\');
|
||||
|
||||
if(s1 && s2) {
|
||||
path = (s1 > s2? s1 : s2) + 1;
|
||||
path = (s1 > s2 ? s1 : s2) + 1;
|
||||
}
|
||||
else if(s1)
|
||||
path = s1 + 1;
|
||||
@ -424,7 +424,7 @@ static size_t encoder_7bit_read(char *buffer, size_t size, bool ateof,
|
||||
for(cursize = 0; cursize < size; cursize++) {
|
||||
*buffer = st->buf[st->bufbeg];
|
||||
if(*buffer++ & 0x80)
|
||||
return cursize? cursize: READ_ERROR;
|
||||
return cursize ? cursize : READ_ERROR;
|
||||
st->bufbeg++;
|
||||
}
|
||||
|
||||
@ -538,7 +538,7 @@ static int qp_lookahead_eol(struct mime_encoder_state *st, int ateof, size_t n)
|
||||
if(n >= st->bufend && ateof)
|
||||
return 1;
|
||||
if(n + 2 > st->bufend)
|
||||
return ateof? 0: -1;
|
||||
return ateof ? 0 : -1;
|
||||
if(qp_class[st->buf[n] & 0xFF] == QP_CR &&
|
||||
qp_class[st->buf[n + 1] & 0xFF] == QP_LF)
|
||||
return 1;
|
||||
@ -651,7 +651,7 @@ static curl_off_t encoder_qp_size(curl_mimepart *part)
|
||||
{
|
||||
/* Determining the size can only be done by reading the data: unless the
|
||||
data size is 0, we return it as unknown (-1). */
|
||||
return part->datasize? -1: 0;
|
||||
return part->datasize ? -1 : 0;
|
||||
}
|
||||
|
||||
|
||||
@ -711,7 +711,7 @@ static int mime_open_file(curl_mimepart *part)
|
||||
if(part->fp)
|
||||
return 0;
|
||||
part->fp = fopen_read(part->data, "rb");
|
||||
return part->fp? 0: -1;
|
||||
return part->fp ? 0 : -1;
|
||||
}
|
||||
|
||||
static size_t mime_file_read(char *buffer, size_t size, size_t nitems,
|
||||
@ -738,8 +738,8 @@ static int mime_file_seek(void *instream, curl_off_t offset, int whence)
|
||||
if(mime_open_file(part))
|
||||
return CURL_SEEKFUNC_FAIL;
|
||||
|
||||
return fseek(part->fp, (long) offset, whence)?
|
||||
CURL_SEEKFUNC_CANTSEEK: CURL_SEEKFUNC_OK;
|
||||
return fseek(part->fp, (long) offset, whence) ?
|
||||
CURL_SEEKFUNC_CANTSEEK : CURL_SEEKFUNC_OK;
|
||||
}
|
||||
|
||||
static void mime_file_free(void *ptr)
|
||||
@ -871,7 +871,7 @@ static size_t read_encoded_part_content(curl_mimepart *part, char *buffer,
|
||||
break;
|
||||
case READ_ERROR:
|
||||
case STOP_FILLING:
|
||||
return cursize? cursize: sz;
|
||||
return cursize ? cursize : sz;
|
||||
default:
|
||||
cursize += sz;
|
||||
buffer += sz;
|
||||
@ -890,7 +890,7 @@ static size_t read_encoded_part_content(curl_mimepart *part, char *buffer,
|
||||
st->bufend = len;
|
||||
}
|
||||
if(st->bufend >= sizeof(st->buf))
|
||||
return cursize? cursize: READ_ERROR; /* Buffer full. */
|
||||
return cursize ? cursize : READ_ERROR; /* Buffer full. */
|
||||
sz = read_part_content(part, st->buf + st->bufend,
|
||||
sizeof(st->buf) - st->bufend, hasread);
|
||||
switch(sz) {
|
||||
@ -901,7 +901,7 @@ static size_t read_encoded_part_content(curl_mimepart *part, char *buffer,
|
||||
case CURL_READFUNC_PAUSE:
|
||||
case READ_ERROR:
|
||||
case STOP_FILLING:
|
||||
return cursize? cursize: sz;
|
||||
return cursize ? cursize : sz;
|
||||
default:
|
||||
st->bufend += sz;
|
||||
break;
|
||||
@ -925,8 +925,8 @@ static size_t readback_part(curl_mimepart *part,
|
||||
switch(part->state.state) {
|
||||
case MIMESTATE_BEGIN:
|
||||
mimesetstate(&part->state,
|
||||
(part->flags & MIME_BODY_ONLY)?
|
||||
MIMESTATE_BODY: MIMESTATE_CURLHEADERS,
|
||||
(part->flags & MIME_BODY_ONLY) ?
|
||||
MIMESTATE_BODY : MIMESTATE_CURLHEADERS,
|
||||
part->curlheaders);
|
||||
break;
|
||||
case MIMESTATE_USERHEADERS:
|
||||
@ -977,7 +977,7 @@ static size_t readback_part(curl_mimepart *part,
|
||||
case CURL_READFUNC_PAUSE:
|
||||
case READ_ERROR:
|
||||
case STOP_FILLING:
|
||||
return cursize? cursize: sz;
|
||||
return cursize ? cursize : sz;
|
||||
}
|
||||
break;
|
||||
case MIMESTATE_END:
|
||||
@ -1043,7 +1043,7 @@ static size_t mime_subparts_read(char *buffer, size_t size, size_t nitems,
|
||||
case CURL_READFUNC_PAUSE:
|
||||
case READ_ERROR:
|
||||
case STOP_FILLING:
|
||||
return cursize? cursize: sz;
|
||||
return cursize ? cursize : sz;
|
||||
case 0:
|
||||
mimesetstate(&mime->state, MIMESTATE_BOUNDARY1, part->nextpart);
|
||||
break;
|
||||
@ -1228,12 +1228,12 @@ CURLcode Curl_mime_duppart(struct Curl_easy *data,
|
||||
/* No one knows about the cloned subparts, thus always attach ownership
|
||||
to the part. */
|
||||
mime = curl_mime_init(data);
|
||||
res = mime? curl_mime_subparts(dst, mime): CURLE_OUT_OF_MEMORY;
|
||||
res = mime ? curl_mime_subparts(dst, mime) : CURLE_OUT_OF_MEMORY;
|
||||
|
||||
/* Duplicate subparts. */
|
||||
for(s = ((curl_mime *) src->arg)->firstpart; !res && s; s = s->nextpart) {
|
||||
d = curl_mime_addpart(mime);
|
||||
res = d? Curl_mime_duppart(data, d, s): CURLE_OUT_OF_MEMORY;
|
||||
res = d ? Curl_mime_duppart(data, d, s) : CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
break;
|
||||
default: /* Invalid kind: should not occur. */
|
||||
@ -1562,7 +1562,8 @@ CURLcode Curl_mime_set_subparts(curl_mimepart *part,
|
||||
subparts->parent = part;
|
||||
/* Subparts are processed internally: no read callback. */
|
||||
part->seekfunc = mime_subparts_seek;
|
||||
part->freefunc = take_ownership? mime_subparts_free: mime_subparts_unbind;
|
||||
part->freefunc = take_ownership ? mime_subparts_free :
|
||||
mime_subparts_unbind;
|
||||
part->arg = subparts;
|
||||
part->datasize = -1;
|
||||
part->kind = MIMEKIND_MULTIPART;
|
||||
@ -1606,8 +1607,8 @@ size_t Curl_mime_read(char *buffer, size_t size, size_t nitems, void *instream)
|
||||
/* Rewind mime stream. */
|
||||
static CURLcode mime_rewind(curl_mimepart *part)
|
||||
{
|
||||
return mime_part_rewind(part) == CURL_SEEKFUNC_OK?
|
||||
CURLE_OK: CURLE_SEND_FAIL_REWIND;
|
||||
return mime_part_rewind(part) == CURL_SEEKFUNC_OK ?
|
||||
CURLE_OK : CURLE_SEND_FAIL_REWIND;
|
||||
}
|
||||
|
||||
/* Compute header list size. */
|
||||
@ -1691,7 +1692,7 @@ CURLcode Curl_mime_add_header(struct curl_slist **slp, const char *fmt, ...)
|
||||
free(s);
|
||||
}
|
||||
|
||||
return hdr? CURLE_OK: CURLE_OUT_OF_MEMORY;
|
||||
return hdr ? CURLE_OK : CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
/* Add a content type header. */
|
||||
@ -1699,8 +1700,8 @@ static CURLcode add_content_type(struct curl_slist **slp,
|
||||
const char *type, const char *boundary)
|
||||
{
|
||||
return Curl_mime_add_header(slp, "Content-Type: %s%s%s", type,
|
||||
boundary? "; boundary=": "",
|
||||
boundary? boundary: "");
|
||||
boundary ? "; boundary=" : "",
|
||||
boundary ? boundary : "");
|
||||
}
|
||||
|
||||
const char *Curl_mime_contenttype(const char *filename)
|
||||
@ -1840,12 +1841,12 @@ CURLcode Curl_mime_prepare_headers(struct Curl_easy *data,
|
||||
ret = Curl_mime_add_header(&part->curlheaders,
|
||||
"Content-Disposition: %s%s%s%s%s%s%s",
|
||||
disposition,
|
||||
name? "; name=\"": "",
|
||||
name? name: "",
|
||||
name? "\"": "",
|
||||
filename? "; filename=\"": "",
|
||||
filename? filename: "",
|
||||
filename? "\"": "");
|
||||
name ? "; name=\"" : "",
|
||||
name ? name : "",
|
||||
name ? "\"" : "",
|
||||
filename ? "; filename=\"" : "",
|
||||
filename ? filename : "",
|
||||
filename ? "\"" : "");
|
||||
Curl_safefree(name);
|
||||
Curl_safefree(filename);
|
||||
if(ret)
|
||||
|
@ -101,27 +101,27 @@ typedef enum {
|
||||
|
||||
/* conversion and display flags */
|
||||
enum {
|
||||
FLAGS_SPACE = 1<<0,
|
||||
FLAGS_SHOWSIGN = 1<<1,
|
||||
FLAGS_LEFT = 1<<2,
|
||||
FLAGS_ALT = 1<<3,
|
||||
FLAGS_SHORT = 1<<4,
|
||||
FLAGS_LONG = 1<<5,
|
||||
FLAGS_LONGLONG = 1<<6,
|
||||
FLAGS_LONGDOUBLE = 1<<7,
|
||||
FLAGS_PAD_NIL = 1<<8,
|
||||
FLAGS_UNSIGNED = 1<<9,
|
||||
FLAGS_OCTAL = 1<<10,
|
||||
FLAGS_HEX = 1<<11,
|
||||
FLAGS_UPPER = 1<<12,
|
||||
FLAGS_WIDTH = 1<<13, /* '*' or '*<num>$' used */
|
||||
FLAGS_WIDTHPARAM = 1<<14, /* width PARAMETER was specified */
|
||||
FLAGS_PREC = 1<<15, /* precision was specified */
|
||||
FLAGS_PRECPARAM = 1<<16, /* precision PARAMETER was specified */
|
||||
FLAGS_CHAR = 1<<17, /* %c story */
|
||||
FLAGS_FLOATE = 1<<18, /* %e or %E */
|
||||
FLAGS_FLOATG = 1<<19, /* %g or %G */
|
||||
FLAGS_SUBSTR = 1<<20 /* no input, only substring */
|
||||
FLAGS_SPACE = 1 << 0,
|
||||
FLAGS_SHOWSIGN = 1 << 1,
|
||||
FLAGS_LEFT = 1 << 2,
|
||||
FLAGS_ALT = 1 << 3,
|
||||
FLAGS_SHORT = 1 << 4,
|
||||
FLAGS_LONG = 1 << 5,
|
||||
FLAGS_LONGLONG = 1 << 6,
|
||||
FLAGS_LONGDOUBLE = 1 << 7,
|
||||
FLAGS_PAD_NIL = 1 << 8,
|
||||
FLAGS_UNSIGNED = 1 << 9,
|
||||
FLAGS_OCTAL = 1 << 10,
|
||||
FLAGS_HEX = 1 << 11,
|
||||
FLAGS_UPPER = 1 << 12,
|
||||
FLAGS_WIDTH = 1 << 13, /* '*' or '*<num>$' used */
|
||||
FLAGS_WIDTHPARAM = 1 << 14, /* width PARAMETER was specified */
|
||||
FLAGS_PREC = 1 << 15, /* precision was specified */
|
||||
FLAGS_PRECPARAM = 1 << 16, /* precision PARAMETER was specified */
|
||||
FLAGS_CHAR = 1 << 17, /* %c story */
|
||||
FLAGS_FLOATE = 1 << 18, /* %e or %E */
|
||||
FLAGS_FLOATG = 1 << 19, /* %g or %G */
|
||||
FLAGS_SUBSTR = 1 << 20 /* no input, only substring */
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -760,7 +760,7 @@ static int formatf(
|
||||
}
|
||||
else if(flags & FLAGS_HEX) {
|
||||
/* Hexadecimal unsigned integer */
|
||||
digits = (flags & FLAGS_UPPER)? upper_digits : lower_digits;
|
||||
digits = (flags & FLAGS_UPPER) ? upper_digits : lower_digits;
|
||||
base = 16;
|
||||
is_neg = FALSE;
|
||||
}
|
||||
@ -906,7 +906,7 @@ number:
|
||||
if(iptr->val.ptr) {
|
||||
/* If the pointer is not NULL, write it as a %#x spec. */
|
||||
base = 16;
|
||||
digits = (flags & FLAGS_UPPER)? upper_digits : lower_digits;
|
||||
digits = (flags & FLAGS_UPPER) ? upper_digits : lower_digits;
|
||||
is_alt = TRUE;
|
||||
num = (size_t) iptr->val.ptr;
|
||||
is_neg = FALSE;
|
||||
|
@ -156,7 +156,7 @@ static int mqtt_encode_len(char *buf, size_t len)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 0; (len > 0) && (i<4); i++) {
|
||||
for(i = 0; (len > 0) && (i < 4); i++) {
|
||||
unsigned char encoded;
|
||||
encoded = len % 0x80;
|
||||
len /= 0x80;
|
||||
@ -375,7 +375,7 @@ static CURLcode mqtt_recv_atleast(struct Curl_easy *data, size_t nbytes)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
rlen = Curl_dyn_len(&mq->recvbuf);
|
||||
}
|
||||
return (rlen >= nbytes)? CURLE_OK : CURLE_AGAIN;
|
||||
return (rlen >= nbytes) ? CURLE_OK : CURLE_AGAIN;
|
||||
}
|
||||
|
||||
static void mqtt_recv_consume(struct Curl_easy *data, size_t nbytes)
|
||||
@ -610,7 +610,7 @@ static void mqstate(struct Curl_easy *data,
|
||||
infof(data, "%s (from %s) (next is %s)",
|
||||
statenames[state],
|
||||
statenames[mqtt->state],
|
||||
(state == MQTT_FIRST)? statenames[nextstate] : "");
|
||||
(state == MQTT_FIRST) ? statenames[nextstate] : "");
|
||||
#endif
|
||||
mqtt->state = state;
|
||||
if(state == MQTT_FIRST)
|
||||
|
12
lib/multi.c
12
lib/multi.c
@ -2230,7 +2230,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
|
||||
if(!result) {
|
||||
if(dophase_done) {
|
||||
/* after DO, go DO_DONE or DO_MORE */
|
||||
multistate(data, data->conn->bits.do_more?
|
||||
multistate(data, data->conn->bits.do_more ?
|
||||
MSTATE_DOING_MORE : MSTATE_DID);
|
||||
rc = CURLM_CALL_MULTI_PERFORM;
|
||||
} /* dophase_done */
|
||||
@ -2254,7 +2254,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
|
||||
if(control) {
|
||||
/* if positive, advance to DO_DONE
|
||||
if negative, go back to DOING */
|
||||
multistate(data, control == 1?
|
||||
multistate(data, control == 1 ?
|
||||
MSTATE_DID : MSTATE_DOING);
|
||||
rc = CURLM_CALL_MULTI_PERFORM;
|
||||
}
|
||||
@ -2584,8 +2584,8 @@ statemachine_end:
|
||||
streamclose(data->conn, "Aborted by callback");
|
||||
|
||||
/* if not yet in DONE state, go there, otherwise COMPLETED */
|
||||
multistate(data, (data->mstate < MSTATE_DONE)?
|
||||
MSTATE_DONE: MSTATE_COMPLETED);
|
||||
multistate(data, (data->mstate < MSTATE_DONE) ?
|
||||
MSTATE_DONE : MSTATE_COMPLETED);
|
||||
rc = CURLM_CALL_MULTI_PERFORM;
|
||||
}
|
||||
}
|
||||
@ -2866,7 +2866,7 @@ CURLMcode Curl_multi_pollset_ev(struct Curl_multi *multi,
|
||||
if(entry) {
|
||||
/* check if new for this transfer */
|
||||
unsigned int j;
|
||||
for(j = 0; j< last_ps->num; j++) {
|
||||
for(j = 0; j < last_ps->num; j++) {
|
||||
if(s == last_ps->sockets[j]) {
|
||||
last_action = last_ps->actions[j];
|
||||
break;
|
||||
@ -3379,7 +3379,7 @@ static CURLMcode multi_timeout(struct Curl_multi *multi,
|
||||
multi->timetree = Curl_splay(tv_zero, multi->timetree);
|
||||
/* this will not return NULL from a non-emtpy tree, but some compilers
|
||||
* are not convinced of that. Analyzers are hard. */
|
||||
*expire_time = multi->timetree? multi->timetree->key : tv_zero;
|
||||
*expire_time = multi->timetree ? multi->timetree->key : tv_zero;
|
||||
|
||||
/* 'multi->timetree' will be non-NULL here but the compilers sometimes
|
||||
yell at us if we assume so */
|
||||
|
@ -276,7 +276,8 @@ static CURLcode oldap_url_parse(struct Curl_easy *data, LDAPURLDesc **ludp)
|
||||
if(rc != LDAP_URL_SUCCESS) {
|
||||
const char *msg = "url parsing problem";
|
||||
|
||||
result = rc == LDAP_URL_ERR_MEM? CURLE_OUT_OF_MEMORY: CURLE_URL_MALFORMAT;
|
||||
result = rc == LDAP_URL_ERR_MEM ? CURLE_OUT_OF_MEMORY :
|
||||
CURLE_URL_MALFORMAT;
|
||||
rc -= LDAP_URL_SUCCESS;
|
||||
if((size_t) rc < sizeof(url_errs) / sizeof(url_errs[0]))
|
||||
msg = url_errs[rc];
|
||||
@ -313,7 +314,7 @@ static CURLcode oldap_parse_login_options(struct connectdata *conn)
|
||||
ptr++;
|
||||
}
|
||||
|
||||
return result == CURLE_URL_MALFORMAT? CURLE_SETOPT_OPTION_SYNTAX: result;
|
||||
return result == CURLE_URL_MALFORMAT ? CURLE_SETOPT_OPTION_SYNTAX : result;
|
||||
}
|
||||
|
||||
static CURLcode oldap_setup_connection(struct Curl_easy *data,
|
||||
@ -430,8 +431,8 @@ static CURLcode oldap_perform_bind(struct Curl_easy *data, ldapstate newstate)
|
||||
oldap_state(data, newstate);
|
||||
else
|
||||
result = oldap_map_error(rc,
|
||||
data->state.aptr.user?
|
||||
CURLE_LOGIN_DENIED: CURLE_LDAP_CANNOT_BIND);
|
||||
data->state.aptr.user ?
|
||||
CURLE_LOGIN_DENIED : CURLE_LDAP_CANNOT_BIND);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -552,9 +553,9 @@ static CURLcode oldap_connect(struct Curl_easy *data, bool *done)
|
||||
|
||||
hosturl = aprintf("%s://%s%s%s:%d",
|
||||
conn->handler->scheme,
|
||||
conn->bits.ipv6_ip? "[": "",
|
||||
conn->bits.ipv6_ip ? "[" : "",
|
||||
conn->host.name,
|
||||
conn->bits.ipv6_ip? "]": "",
|
||||
conn->bits.ipv6_ip ? "]" : "",
|
||||
conn->remote_port);
|
||||
if(!hosturl)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
@ -1134,7 +1135,7 @@ static ssize_t oldap_recv(struct Curl_easy *data, int sockindex, char *buf,
|
||||
|
||||
ldap_msgfree(msg);
|
||||
*err = result;
|
||||
return result? -1: 0;
|
||||
return result ? -1 : 0;
|
||||
}
|
||||
|
||||
#ifdef USE_SSL
|
||||
|
@ -218,7 +218,7 @@ static int checkday(const char *check, size_t len)
|
||||
what = &Curl_wkday[0];
|
||||
else
|
||||
return -1; /* too short */
|
||||
for(i = 0; i<7; i++) {
|
||||
for(i = 0; i < 7; i++) {
|
||||
size_t ilen = strlen(what[0]);
|
||||
if((ilen == len) &&
|
||||
strncasecompare(check, what[0], len))
|
||||
@ -235,7 +235,7 @@ static int checkmonth(const char *check, size_t len)
|
||||
if(len != 3)
|
||||
return -1; /* not a month */
|
||||
|
||||
for(i = 0; i<12; i++) {
|
||||
for(i = 0; i < 12; i++) {
|
||||
if(strncasecompare(check, what[0], 3))
|
||||
return i;
|
||||
what++;
|
||||
@ -253,7 +253,7 @@ static int checktz(const char *check, size_t len)
|
||||
if(len > 4) /* longer than any valid timezone */
|
||||
return -1;
|
||||
|
||||
for(i = 0; i< sizeof(tz)/sizeof(tz[0]); i++) {
|
||||
for(i = 0; i < sizeof(tz)/sizeof(tz[0]); i++) {
|
||||
size_t ilen = strlen(what->name);
|
||||
if((ilen == len) &&
|
||||
strncasecompare(check, what->name, len))
|
||||
@ -441,7 +441,7 @@ static int parsedate(const char *date, time_t *output)
|
||||
if((tzoff == -1) &&
|
||||
((end - date) == 4) &&
|
||||
(val <= 1400) &&
|
||||
(indate< date) &&
|
||||
(indate < date) &&
|
||||
((date[-1] == '+' || date[-1] == '-'))) {
|
||||
/* four digits and a value less than or equal to 1400 (to take into
|
||||
account all sorts of funny time zone diffs) and it is preceded
|
||||
@ -456,7 +456,7 @@ static int parsedate(const char *date, time_t *output)
|
||||
|
||||
/* the + and - prefix indicates the local time compared to GMT,
|
||||
this we need their reversed math to get what we want */
|
||||
tzoff = date[-1]=='+'?-tzoff:tzoff;
|
||||
tzoff = date[-1]=='+' ? -tzoff : tzoff;
|
||||
}
|
||||
|
||||
if(((end - date) == 8) &&
|
||||
@ -471,7 +471,7 @@ static int parsedate(const char *date, time_t *output)
|
||||
}
|
||||
|
||||
if(!found && (dignext == DATE_MDAY) && (mdaynum == -1)) {
|
||||
if((val > 0) && (val<32)) {
|
||||
if((val > 0) && (val < 32)) {
|
||||
mdaynum = val;
|
||||
found = TRUE;
|
||||
}
|
||||
|
@ -52,8 +52,8 @@ timediff_t Curl_pp_state_timeout(struct Curl_easy *data,
|
||||
{
|
||||
struct connectdata *conn = data->conn;
|
||||
timediff_t timeout_ms; /* in milliseconds */
|
||||
timediff_t response_time = (data->set.server_response_timeout)?
|
||||
data->set.server_response_timeout: pp->response_time;
|
||||
timediff_t response_time = (data->set.server_response_timeout) ?
|
||||
data->set.server_response_timeout : pp->response_time;
|
||||
|
||||
/* if CURLOPT_SERVER_RESPONSE_TIMEOUT is set, use that to determine
|
||||
remaining time, or use pp->response because SERVER_RESPONSE_TIMEOUT is
|
||||
|
@ -428,7 +428,7 @@ static bool progress_calc(struct Curl_easy *data, struct curltime now)
|
||||
array. With N_ENTRIES filled in, we have about N_ENTRIES-1 seconds of
|
||||
transfer. Imagine, after one second we have filled in two entries,
|
||||
after two seconds we have filled in three entries etc. */
|
||||
countindex = ((p->speeder_c >= CURR_TIME)? CURR_TIME:p->speeder_c) - 1;
|
||||
countindex = ((p->speeder_c >= CURR_TIME) ? CURR_TIME : p->speeder_c) - 1;
|
||||
|
||||
/* first of all, we do not do this if there is no counted seconds yet */
|
||||
if(countindex) {
|
||||
@ -439,7 +439,7 @@ static bool progress_calc(struct Curl_easy *data, struct curltime now)
|
||||
/* Get the index position to compare with the 'nowindex' position.
|
||||
Get the oldest entry possible. While we have less than CURR_TIME
|
||||
entries, the first entry will remain the oldest. */
|
||||
checkindex = (p->speeder_c >= CURR_TIME)? p->speeder_c%CURR_TIME:0;
|
||||
checkindex = (p->speeder_c >= CURR_TIME) ? p->speeder_c%CURR_TIME : 0;
|
||||
|
||||
/* Figure out the exact time for the time span */
|
||||
span_ms = Curl_timediff(now, p->speeder_time[checkindex]);
|
||||
@ -530,14 +530,14 @@ static void progress_meter(struct Curl_easy *data)
|
||||
/* Since both happen at the same time, total expected duration is max. */
|
||||
total_estm.secs = CURLMAX(ul_estm.secs, dl_estm.secs);
|
||||
/* create the three time strings */
|
||||
time2str(time_left, total_estm.secs > 0?(total_estm.secs - cur_secs):0);
|
||||
time2str(time_left, total_estm.secs > 0 ? (total_estm.secs - cur_secs) : 0);
|
||||
time2str(time_total, total_estm.secs);
|
||||
time2str(time_spent, cur_secs);
|
||||
|
||||
/* Get the total amount of data expected to get transferred */
|
||||
total_expected_size =
|
||||
((p->flags & PGRS_UL_SIZE_KNOWN)? p->ul.total_size:p->ul.cur_size) +
|
||||
((p->flags & PGRS_DL_SIZE_KNOWN)? p->dl.total_size:p->dl.cur_size);
|
||||
((p->flags & PGRS_UL_SIZE_KNOWN) ? p->ul.total_size : p->ul.cur_size) +
|
||||
((p->flags & PGRS_DL_SIZE_KNOWN) ? p->dl.total_size : p->dl.cur_size);
|
||||
|
||||
/* We have transferred this much so far */
|
||||
total_cur_size = p->dl.cur_size + p->ul.cur_size;
|
||||
|
@ -81,7 +81,7 @@ const psl_ctx_t *Curl_psl_use(struct Curl_easy *easy)
|
||||
psl = psl_latest(NULL);
|
||||
dynamic = psl != NULL;
|
||||
/* Take care of possible time computation overflow. */
|
||||
expires = now < TIME_T_MAX - PSL_TTL? now + PSL_TTL: TIME_T_MAX;
|
||||
expires = now < TIME_T_MAX - PSL_TTL ? now + PSL_TTL : TIME_T_MAX;
|
||||
|
||||
/* Only get the built-in PSL if we do not already have the "latest". */
|
||||
if(!psl && !pslcache->dynamic)
|
||||
|
@ -283,7 +283,7 @@ CURLcode Curl_req_set_upload_done(struct Curl_easy *data)
|
||||
data->req.writebytecount);
|
||||
else if(!data->req.download_done) {
|
||||
DEBUGASSERT(Curl_bufq_is_empty(&data->req.sendbuf));
|
||||
infof(data, Curl_creader_total_length(data)?
|
||||
infof(data, Curl_creader_total_length(data) ?
|
||||
"We are completely uploaded and fine" :
|
||||
"Request completely sent off");
|
||||
}
|
||||
|
@ -359,8 +359,8 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
|
||||
/* Accept Headers for DESCRIBE requests */
|
||||
if(rtspreq == RTSPREQ_DESCRIBE) {
|
||||
/* Accept Header */
|
||||
p_accept = Curl_checkheaders(data, STRCONST("Accept"))?
|
||||
NULL:"Accept: application/sdp\r\n";
|
||||
p_accept = Curl_checkheaders(data, STRCONST("Accept")) ?
|
||||
NULL : "Accept: application/sdp\r\n";
|
||||
|
||||
/* Accept-Encoding header */
|
||||
if(!Curl_checkheaders(data, STRCONST("Accept-Encoding")) &&
|
||||
@ -615,7 +615,7 @@ static CURLcode rtp_write_body_junk(struct Curl_easy *data,
|
||||
in_body = (data->req.headerline && !rtspc->in_header) &&
|
||||
(data->req.size >= 0) &&
|
||||
(data->req.bytecount < data->req.size);
|
||||
body_remain = in_body? (data->req.size - data->req.bytecount) : 0;
|
||||
body_remain = in_body ? (data->req.size - data->req.bytecount) : 0;
|
||||
DEBUGASSERT(body_remain >= 0);
|
||||
if(body_remain) {
|
||||
if((curl_off_t)blen > body_remain)
|
||||
@ -858,7 +858,7 @@ static CURLcode rtsp_rtp_write_resp(struct Curl_easy *data,
|
||||
data->req.size));
|
||||
if(!result && (is_eos || blen)) {
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY|
|
||||
(is_eos? CLIENTWRITE_EOS:0),
|
||||
(is_eos ? CLIENTWRITE_EOS : 0),
|
||||
(char *)buf, blen);
|
||||
}
|
||||
|
||||
|
@ -575,7 +575,7 @@ bool Curl_creader_def_needs_rewind(struct Curl_easy *data,
|
||||
curl_off_t Curl_creader_def_total_length(struct Curl_easy *data,
|
||||
struct Curl_creader *reader)
|
||||
{
|
||||
return reader->next?
|
||||
return reader->next ?
|
||||
reader->next->crt->total_length(data, reader->next) : -1;
|
||||
}
|
||||
|
||||
@ -1376,7 +1376,7 @@ out:
|
||||
curl_off_t Curl_creader_total_length(struct Curl_easy *data)
|
||||
{
|
||||
struct Curl_creader *r = data->req.reader_stack;
|
||||
return r? r->crt->total_length(data, r) : -1;
|
||||
return r ? r->crt->total_length(data, r) : -1;
|
||||
}
|
||||
|
||||
curl_off_t Curl_creader_client_length(struct Curl_easy *data)
|
||||
@ -1384,7 +1384,7 @@ curl_off_t Curl_creader_client_length(struct Curl_easy *data)
|
||||
struct Curl_creader *r = data->req.reader_stack;
|
||||
while(r && r->phase != CURL_CR_CLIENT)
|
||||
r = r->next;
|
||||
return r? r->crt->total_length(data, r) : -1;
|
||||
return r ? r->crt->total_length(data, r) : -1;
|
||||
}
|
||||
|
||||
CURLcode Curl_creader_resume_from(struct Curl_easy *data, curl_off_t offset)
|
||||
@ -1392,7 +1392,7 @@ CURLcode Curl_creader_resume_from(struct Curl_easy *data, curl_off_t offset)
|
||||
struct Curl_creader *r = data->req.reader_stack;
|
||||
while(r && r->phase != CURL_CR_CLIENT)
|
||||
r = r->next;
|
||||
return r? r->crt->resume_from(data, r, offset) : CURLE_READ_ERROR;
|
||||
return r ? r->crt->resume_from(data, r, offset) : CURLE_READ_ERROR;
|
||||
}
|
||||
|
||||
CURLcode Curl_creader_unpause(struct Curl_easy *data)
|
||||
|
@ -193,7 +193,7 @@ static CURLcode protocol2num(const char *str, curl_prot_t *val)
|
||||
size_t tlen;
|
||||
|
||||
str = strchr(str, ',');
|
||||
tlen = str? (size_t) (str - token): strlen(token);
|
||||
tlen = str ? (size_t) (str - token) : strlen(token);
|
||||
if(tlen) {
|
||||
const struct Curl_handler *h = Curl_getn_scheme_handler(token, tlen);
|
||||
|
||||
@ -2319,7 +2319,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
||||
#endif
|
||||
#ifdef USE_LIBPSL
|
||||
if(data->psl == &data->share->psl)
|
||||
data->psl = data->multi? &data->multi->psl: NULL;
|
||||
data->psl = data->multi ? &data->multi->psl : NULL;
|
||||
#endif
|
||||
|
||||
data->share->dirty--;
|
||||
@ -2337,7 +2337,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
||||
|
||||
data->share->dirty++;
|
||||
|
||||
if(data->share->specifier & (1<< CURL_LOCK_DATA_DNS)) {
|
||||
if(data->share->specifier & (1 << CURL_LOCK_DATA_DNS)) {
|
||||
/* use shared host cache */
|
||||
data->dns.hostcache = &data->share->hostcache;
|
||||
data->dns.hostcachetype = HCACHE_SHARED;
|
||||
@ -3236,7 +3236,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
||||
}
|
||||
#endif
|
||||
case CURLOPT_QUICK_EXIT:
|
||||
data->set.quick_exit = (0 != va_arg(param, long)) ? 1L:0L;
|
||||
data->set.quick_exit = (0 != va_arg(param, long)) ? 1L : 0L;
|
||||
break;
|
||||
default:
|
||||
/* unknown tag and its companion, just ignore: */
|
||||
|
10
lib/share.c
10
lib/share.c
@ -44,7 +44,7 @@ curl_share_init(void)
|
||||
struct Curl_share *share = calloc(1, sizeof(struct Curl_share));
|
||||
if(share) {
|
||||
share->magic = CURL_GOOD_SHARE;
|
||||
share->specifier |= (1<<CURL_LOCK_DATA_SHARE);
|
||||
share->specifier |= (1 << CURL_LOCK_DATA_SHARE);
|
||||
Curl_init_dnscache(&share->hostcache, 23);
|
||||
}
|
||||
|
||||
@ -139,13 +139,13 @@ curl_share_setopt(struct Curl_share *share, CURLSHoption option, ...)
|
||||
res = CURLSHE_BAD_OPTION;
|
||||
}
|
||||
if(!res)
|
||||
share->specifier |= (unsigned int)(1<<type);
|
||||
share->specifier |= (unsigned int)(1 << type);
|
||||
break;
|
||||
|
||||
case CURLSHOPT_UNSHARE:
|
||||
/* this is a type this share will no longer share */
|
||||
type = va_arg(param, int);
|
||||
share->specifier &= ~(unsigned int)(1<<type);
|
||||
share->specifier &= ~(unsigned int)(1 << type);
|
||||
switch(type) {
|
||||
case CURL_LOCK_DATA_DNS:
|
||||
break;
|
||||
@ -271,7 +271,7 @@ Curl_share_lock(struct Curl_easy *data, curl_lock_data type,
|
||||
if(!share)
|
||||
return CURLSHE_INVALID;
|
||||
|
||||
if(share->specifier & (unsigned int)(1<<type)) {
|
||||
if(share->specifier & (unsigned int)(1 << type)) {
|
||||
if(share->lockfunc) /* only call this if set! */
|
||||
share->lockfunc(data, type, accesstype, share->clientdata);
|
||||
}
|
||||
@ -288,7 +288,7 @@ Curl_share_unlock(struct Curl_easy *data, curl_lock_data type)
|
||||
if(!share)
|
||||
return CURLSHE_INVALID;
|
||||
|
||||
if(share->specifier & (unsigned int)(1<<type)) {
|
||||
if(share->specifier & (unsigned int)(1 << type)) {
|
||||
if(share->unlockfunc) /* only call this if set! */
|
||||
share->unlockfunc (data, type, share->clientdata);
|
||||
}
|
||||
|
@ -512,7 +512,7 @@ CONNECT_REQ_INIT:
|
||||
/* Result */
|
||||
switch(socksreq[1]) {
|
||||
case 90:
|
||||
infof(data, "SOCKS4%s request granted.", protocol4a?"a":"");
|
||||
infof(data, "SOCKS4%s request granted.", protocol4a ? "a" : "");
|
||||
break;
|
||||
case 91:
|
||||
failf(data,
|
||||
|
@ -349,7 +349,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
|
||||
gss_enc = 1;
|
||||
|
||||
infof(data, "SOCKS5 server supports GSS-API %s data protection.",
|
||||
(gss_enc == 0)?"no":((gss_enc==1)?"integrity":"confidentiality"));
|
||||
(gss_enc == 0) ? "no" :
|
||||
((gss_enc == 1) ? "integrity" : "confidentiality"));
|
||||
/* force for the moment to no data protection */
|
||||
gss_enc = 0;
|
||||
/*
|
||||
@ -525,8 +526,9 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
|
||||
(void)curlx_nonblock(sock, TRUE);
|
||||
|
||||
infof(data, "SOCKS5 access with%s protection granted.",
|
||||
(socksreq[0] == 0)?"out GSS-API data":
|
||||
((socksreq[0] == 1)?" GSS-API integrity":" GSS-API confidentiality"));
|
||||
(socksreq[0] == 0) ? "out GSS-API data":
|
||||
((socksreq[0] == 1) ? " GSS-API integrity" :
|
||||
" GSS-API confidentiality"));
|
||||
|
||||
conn->socks5_gssapi_enctype = socksreq[0];
|
||||
if(socksreq[0] == 0)
|
||||
|
@ -355,7 +355,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
|
||||
gss_enc = 1;
|
||||
|
||||
infof(data, "SOCKS5 server supports GSS-API %s data protection.",
|
||||
(gss_enc == 0)?"no":((gss_enc == 1)?"integrity":"confidentiality") );
|
||||
(gss_enc == 0) ? "no" :
|
||||
((gss_enc == 1) ? "integrity":"confidentiality") );
|
||||
/* force to no data protection, avoid encryption/decryption for now */
|
||||
gss_enc = 0;
|
||||
/*
|
||||
@ -606,8 +607,9 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
|
||||
(void)curlx_nonblock(sock, TRUE);
|
||||
|
||||
infof(data, "SOCKS5 access with%s protection granted.",
|
||||
(socksreq[0] == 0)?"out GSS-API data":
|
||||
((socksreq[0] == 1)?" GSS-API integrity":" GSS-API confidentiality"));
|
||||
(socksreq[0] == 0) ? "out GSS-API data":
|
||||
((socksreq[0] == 1) ? " GSS-API integrity" :
|
||||
" GSS-API confidentiality"));
|
||||
|
||||
/* For later use if encryption is required
|
||||
conn->socks5_gssapi_enctype = socksreq[0];
|
||||
|
@ -671,7 +671,7 @@ static void printsub(struct Curl_easy *data,
|
||||
if(data->set.verbose) {
|
||||
unsigned int i = 0;
|
||||
if(direction) {
|
||||
infof(data, "%s IAC SB ", (direction == '<')? "RCVD":"SENT");
|
||||
infof(data, "%s IAC SB ", (direction == '<') ? "RCVD" : "SENT");
|
||||
if(length >= 3) {
|
||||
int j;
|
||||
|
||||
@ -721,8 +721,8 @@ static void printsub(struct Curl_easy *data,
|
||||
switch(pointer[0]) {
|
||||
case CURL_TELOPT_NAWS:
|
||||
if(length > 4)
|
||||
infof(data, "Width: %d ; Height: %d", (pointer[1]<<8) | pointer[2],
|
||||
(pointer[3]<<8) | pointer[4]);
|
||||
infof(data, "Width: %d ; Height: %d", (pointer[1] << 8) | pointer[2],
|
||||
(pointer[3] << 8) | pointer[4]);
|
||||
break;
|
||||
default:
|
||||
switch(pointer[1]) {
|
||||
|
18
lib/tftp.c
18
lib/tftp.c
@ -228,15 +228,15 @@ static CURLcode tftp_set_timeouts(struct tftp_state_data *state)
|
||||
state->retry_max = (int)timeout/5;
|
||||
|
||||
/* But bound the total number */
|
||||
if(state->retry_max<3)
|
||||
if(state->retry_max < 3)
|
||||
state->retry_max = 3;
|
||||
|
||||
if(state->retry_max>50)
|
||||
if(state->retry_max > 50)
|
||||
state->retry_max = 50;
|
||||
|
||||
/* Compute the re-ACK interval to suit the timeout */
|
||||
state->retry_time = (int)(timeout/state->retry_max);
|
||||
if(state->retry_time<1)
|
||||
if(state->retry_time < 1)
|
||||
state->retry_time = 1;
|
||||
|
||||
infof(state->data,
|
||||
@ -443,7 +443,7 @@ static CURLcode tftp_send_first(struct tftp_state_data *state,
|
||||
case TFTP_EVENT_TIMEOUT: /* Resend the first packet out */
|
||||
/* Increment the retry counter, quit if over the limit */
|
||||
state->retries++;
|
||||
if(state->retries>state->retry_max) {
|
||||
if(state->retries > state->retry_max) {
|
||||
state->error = TFTP_ERR_NORESPONSE;
|
||||
state->state = TFTP_STATE_FIN;
|
||||
return result;
|
||||
@ -664,7 +664,7 @@ static CURLcode tftp_rx(struct tftp_state_data *state,
|
||||
4, SEND_4TH_ARG,
|
||||
(struct sockaddr *)&state->remote_addr,
|
||||
state->remote_addrlen);
|
||||
if(sbytes<0) {
|
||||
if(sbytes < 0) {
|
||||
failf(data, "%s", Curl_strerror(SOCKERRNO, buffer, sizeof(buffer)));
|
||||
return CURLE_SEND_ERROR;
|
||||
}
|
||||
@ -729,7 +729,7 @@ static CURLcode tftp_tx(struct tftp_state_data *state, tftp_event_t event)
|
||||
rblock, state->block);
|
||||
state->retries++;
|
||||
/* Bail out if over the maximum */
|
||||
if(state->retries>state->retry_max) {
|
||||
if(state->retries > state->retry_max) {
|
||||
failf(data, "tftp_tx: giving up waiting for block %d ack",
|
||||
state->block);
|
||||
result = CURLE_SEND_ERROR;
|
||||
@ -741,7 +741,7 @@ static CURLcode tftp_tx(struct tftp_state_data *state, tftp_event_t event)
|
||||
(struct sockaddr *)&state->remote_addr,
|
||||
state->remote_addrlen);
|
||||
/* Check all sbytes were sent */
|
||||
if(sbytes<0) {
|
||||
if(sbytes < 0) {
|
||||
failf(data, "%s", Curl_strerror(SOCKERRNO,
|
||||
buffer, sizeof(buffer)));
|
||||
result = CURLE_SEND_ERROR;
|
||||
@ -786,7 +786,7 @@ static CURLcode tftp_tx(struct tftp_state_data *state, tftp_event_t event)
|
||||
(struct sockaddr *)&state->remote_addr,
|
||||
state->remote_addrlen);
|
||||
/* Check all sbytes were sent */
|
||||
if(sbytes<0) {
|
||||
if(sbytes < 0) {
|
||||
failf(data, "%s", Curl_strerror(SOCKERRNO, buffer, sizeof(buffer)));
|
||||
return CURLE_SEND_ERROR;
|
||||
}
|
||||
@ -812,7 +812,7 @@ static CURLcode tftp_tx(struct tftp_state_data *state, tftp_event_t event)
|
||||
(struct sockaddr *)&state->remote_addr,
|
||||
state->remote_addrlen);
|
||||
/* Check all sbytes were sent */
|
||||
if(sbytes<0) {
|
||||
if(sbytes < 0) {
|
||||
failf(data, "%s", Curl_strerror(SOCKERRNO, buffer, sizeof(buffer)));
|
||||
return CURLE_SEND_ERROR;
|
||||
}
|
||||
|
@ -967,7 +967,7 @@ CURLcode Curl_follow(struct Curl_easy *data,
|
||||
!(data->set.keep_post & CURL_REDIR_POST_303))) {
|
||||
data->state.httpreq = HTTPREQ_GET;
|
||||
infof(data, "Switch to %s",
|
||||
data->req.no_body?"HEAD":"GET");
|
||||
data->req.no_body ? "HEAD" : "GET");
|
||||
}
|
||||
break;
|
||||
case 304: /* Not Modified */
|
||||
@ -1096,7 +1096,7 @@ static void xfer_setup(
|
||||
conn->sockfd = sockindex == -1 ?
|
||||
CURL_SOCKET_BAD : conn->sock[sockindex];
|
||||
conn->writesockfd = writesockindex == -1 ?
|
||||
CURL_SOCKET_BAD:conn->sock[writesockindex];
|
||||
CURL_SOCKET_BAD : conn->sock[writesockindex];
|
||||
}
|
||||
|
||||
k->getheader = getheader;
|
||||
@ -1134,8 +1134,8 @@ void Curl_xfer_setup1(struct Curl_easy *data,
|
||||
curl_off_t recv_size,
|
||||
bool getheader)
|
||||
{
|
||||
int recv_index = (send_recv & CURL_XFER_RECV)? FIRSTSOCKET : -1;
|
||||
int send_index = (send_recv & CURL_XFER_SEND)? FIRSTSOCKET : -1;
|
||||
int recv_index = (send_recv & CURL_XFER_RECV) ? FIRSTSOCKET : -1;
|
||||
int send_index = (send_recv & CURL_XFER_SEND) ? FIRSTSOCKET : -1;
|
||||
DEBUGASSERT((recv_index >= 0) || (recv_size == -1));
|
||||
xfer_setup(data, recv_index, recv_size, getheader, send_index, FALSE);
|
||||
}
|
||||
@ -1145,8 +1145,8 @@ void Curl_xfer_setup2(struct Curl_easy *data,
|
||||
curl_off_t recv_size,
|
||||
bool shutdown)
|
||||
{
|
||||
int recv_index = (send_recv & CURL_XFER_RECV)? SECONDARYSOCKET : -1;
|
||||
int send_index = (send_recv & CURL_XFER_SEND)? SECONDARYSOCKET : -1;
|
||||
int recv_index = (send_recv & CURL_XFER_RECV) ? SECONDARYSOCKET : -1;
|
||||
int send_index = (send_recv & CURL_XFER_SEND) ? SECONDARYSOCKET : -1;
|
||||
DEBUGASSERT((recv_index >= 0) || (recv_size == -1));
|
||||
xfer_setup(data, recv_index, recv_size, FALSE, send_index, shutdown);
|
||||
}
|
||||
|
@ -3529,7 +3529,7 @@ static CURLcode create_conn(struct Curl_easy *data,
|
||||
|
||||
#ifndef CURL_DISABLE_PROXY
|
||||
infof(data, "Re-using existing connection with %s %s",
|
||||
conn->bits.proxy?"proxy":"host",
|
||||
conn->bits.proxy ? "proxy" : "host",
|
||||
conn->socks_proxy.host.name ? conn->socks_proxy.host.dispname :
|
||||
conn->http_proxy.host.name ? conn->http_proxy.host.dispname :
|
||||
conn->host.dispname);
|
||||
|
24
lib/urlapi.c
24
lib/urlapi.c
@ -181,7 +181,7 @@ static CURLUcode urlencode_str(struct dynbuf *o, const char *url,
|
||||
|
||||
if(urlchar_needs_escaping(*iptr)) {
|
||||
char out[3]={'%'};
|
||||
out[1] = hexdigits[*iptr>>4];
|
||||
out[1] = hexdigits[*iptr >> 4];
|
||||
out[2] = hexdigits[*iptr & 0xf];
|
||||
result = Curl_dyn_addn(o, out, 3);
|
||||
}
|
||||
@ -467,7 +467,7 @@ static CURLUcode parse_hostname_login(struct Curl_URL *u,
|
||||
ccode = Curl_parse_login_details(login, ptr - login - 1,
|
||||
&userp, &passwdp,
|
||||
(h && (h->flags & PROTOPT_URLOPTIONS)) ?
|
||||
&optionsp:NULL);
|
||||
&optionsp : NULL);
|
||||
if(ccode) {
|
||||
result = CURLUE_BAD_LOGIN;
|
||||
goto out;
|
||||
@ -1419,8 +1419,8 @@ CURLUcode curl_url_get(const CURLU *u, CURLUPart what,
|
||||
const char *ptr;
|
||||
CURLUcode ifmissing = CURLUE_UNKNOWN_PART;
|
||||
char portbuf[7];
|
||||
bool urldecode = (flags & CURLU_URLDECODE)?1:0;
|
||||
bool urlencode = (flags & CURLU_URLENCODE)?1:0;
|
||||
bool urldecode = (flags & CURLU_URLDECODE) ? 1 : 0;
|
||||
bool urlencode = (flags & CURLU_URLENCODE) ? 1 : 0;
|
||||
bool punycode = FALSE;
|
||||
bool depunyfy = FALSE;
|
||||
bool plusdecode = FALSE;
|
||||
@ -1454,8 +1454,8 @@ CURLUcode curl_url_get(const CURLU *u, CURLUPart what,
|
||||
case CURLUPART_HOST:
|
||||
ptr = u->host;
|
||||
ifmissing = CURLUE_NO_HOST;
|
||||
punycode = (flags & CURLU_PUNYCODE)?1:0;
|
||||
depunyfy = (flags & CURLU_PUNY2IDN)?1:0;
|
||||
punycode = (flags & CURLU_PUNYCODE) ? 1 : 0;
|
||||
depunyfy = (flags & CURLU_PUNY2IDN) ? 1 : 0;
|
||||
break;
|
||||
case CURLUPART_ZONEID:
|
||||
ptr = u->zoneid;
|
||||
@ -1514,8 +1514,8 @@ CURLUcode curl_url_get(const CURLU *u, CURLUPart what,
|
||||
bool show_query =
|
||||
(u->query && u->query[0]) ||
|
||||
(u->query_present && flags & CURLU_GET_EMPTY);
|
||||
punycode = (flags & CURLU_PUNYCODE)?1:0;
|
||||
depunyfy = (flags & CURLU_PUNY2IDN)?1:0;
|
||||
punycode = (flags & CURLU_PUNYCODE) ? 1 : 0;
|
||||
depunyfy = (flags & CURLU_PUNY2IDN) ? 1 : 0;
|
||||
if(u->scheme && strcasecompare("file", u->scheme)) {
|
||||
url = aprintf("file://%s%s%s",
|
||||
u->path,
|
||||
@ -1617,7 +1617,7 @@ CURLUcode curl_url_get(const CURLU *u, CURLUPart what,
|
||||
show_query ? "?": "",
|
||||
u->query ? u->query : "",
|
||||
show_fragment ? "#": "",
|
||||
u->fragment? u->fragment : "");
|
||||
u->fragment ? u->fragment : "");
|
||||
free(allochost);
|
||||
}
|
||||
if(!url)
|
||||
@ -1708,7 +1708,7 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
|
||||
const char *part, unsigned int flags)
|
||||
{
|
||||
char **storep = NULL;
|
||||
bool urlencode = (flags & CURLU_URLENCODE)? 1 : 0;
|
||||
bool urlencode = (flags & CURLU_URLENCODE) ? 1 : 0;
|
||||
bool plusencode = FALSE;
|
||||
bool urlskipslash = FALSE;
|
||||
bool leadingslash = FALSE;
|
||||
@ -1845,7 +1845,7 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
|
||||
break;
|
||||
case CURLUPART_QUERY:
|
||||
plusencode = urlencode;
|
||||
appendquery = (flags & CURLU_APPENDQUERY)?1:0;
|
||||
appendquery = (flags & CURLU_APPENDQUERY) ? 1 : 0;
|
||||
equalsencode = appendquery;
|
||||
storep = &u->query;
|
||||
u->query_present = TRUE;
|
||||
@ -1927,7 +1927,7 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
|
||||
}
|
||||
else {
|
||||
char out[3]={'%'};
|
||||
out[1] = hexdigits[*i>>4];
|
||||
out[1] = hexdigits[*i >> 4];
|
||||
out[2] = hexdigits[*i & 0xf];
|
||||
result = Curl_dyn_addn(&enc, out, 3);
|
||||
if(result)
|
||||
|
@ -158,7 +158,7 @@ CURLcode Curl_auth_create_gssapi_user_message(struct Curl_easy *data,
|
||||
gss_release_buffer(&unused_status, &output_token);
|
||||
}
|
||||
else
|
||||
Curl_bufref_set(out, mutual_auth? "": NULL, 0, NULL);
|
||||
Curl_bufref_set(out, mutual_auth ? "": NULL, 0, NULL);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ static void ntlm_print_flags(FILE *handle, unsigned long flags)
|
||||
fprintf(handle, "NTLMFLAG_NEGOTIATE_OEM ");
|
||||
if(flags & NTLMFLAG_REQUEST_TARGET)
|
||||
fprintf(handle, "NTLMFLAG_REQUEST_TARGET ");
|
||||
if(flags & (1<<3))
|
||||
if(flags & (1 << 3))
|
||||
fprintf(handle, "NTLMFLAG_UNKNOWN_3 ");
|
||||
if(flags & NTLMFLAG_NEGOTIATE_SIGN)
|
||||
fprintf(handle, "NTLMFLAG_NEGOTIATE_SIGN ");
|
||||
@ -81,7 +81,7 @@ static void ntlm_print_flags(FILE *handle, unsigned long flags)
|
||||
fprintf(handle, "NTLMFLAG_NEGOTIATE_LM_KEY ");
|
||||
if(flags & NTLMFLAG_NEGOTIATE_NTLM_KEY)
|
||||
fprintf(handle, "NTLMFLAG_NEGOTIATE_NTLM_KEY ");
|
||||
if(flags & (1<<10))
|
||||
if(flags & (1 << 10))
|
||||
fprintf(handle, "NTLMFLAG_UNKNOWN_10 ");
|
||||
if(flags & NTLMFLAG_NEGOTIATE_ANONYMOUS)
|
||||
fprintf(handle, "NTLMFLAG_NEGOTIATE_ANONYMOUS ");
|
||||
@ -109,15 +109,15 @@ static void ntlm_print_flags(FILE *handle, unsigned long flags)
|
||||
fprintf(handle, "NTLMFLAG_REQUEST_NONNT_SESSION_KEY ");
|
||||
if(flags & NTLMFLAG_NEGOTIATE_TARGET_INFO)
|
||||
fprintf(handle, "NTLMFLAG_NEGOTIATE_TARGET_INFO ");
|
||||
if(flags & (1<<24))
|
||||
if(flags & (1 << 24))
|
||||
fprintf(handle, "NTLMFLAG_UNKNOWN_24 ");
|
||||
if(flags & (1<<25))
|
||||
if(flags & (1 << 25))
|
||||
fprintf(handle, "NTLMFLAG_UNKNOWN_25 ");
|
||||
if(flags & (1<<26))
|
||||
if(flags & (1 << 26))
|
||||
fprintf(handle, "NTLMFLAG_UNKNOWN_26 ");
|
||||
if(flags & (1<<27))
|
||||
if(flags & (1 << 27))
|
||||
fprintf(handle, "NTLMFLAG_UNKNOWN_27 ");
|
||||
if(flags & (1<<28))
|
||||
if(flags & (1 << 28))
|
||||
fprintf(handle, "NTLMFLAG_UNKNOWN_28 ");
|
||||
if(flags & NTLMFLAG_NEGOTIATE_128)
|
||||
fprintf(handle, "NTLMFLAG_NEGOTIATE_128 ");
|
||||
|
@ -1020,7 +1020,7 @@ static CURLcode cf_msh3_query(struct Curl_cfilter *cf,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return cf->next?
|
||||
return cf->next ?
|
||||
cf->next->cft->query(cf->next, data, query, pres1, pres2) :
|
||||
CURLE_UNKNOWN_OPTION;
|
||||
}
|
||||
@ -1092,7 +1092,7 @@ CURLcode Curl_cf_msh3_create(struct Curl_cfilter **pcf,
|
||||
result = Curl_cf_create(&cf, &Curl_cft_http3, ctx);
|
||||
|
||||
out:
|
||||
*pcf = (!result)? cf : NULL;
|
||||
*pcf = (!result) ? cf : NULL;
|
||||
if(result) {
|
||||
Curl_safefree(cf);
|
||||
cf_msh3_ctx_free(ctx);
|
||||
@ -1105,7 +1105,7 @@ bool Curl_conn_is_msh3(const struct Curl_easy *data,
|
||||
const struct connectdata *conn,
|
||||
int sockindex)
|
||||
{
|
||||
struct Curl_cfilter *cf = conn? conn->cfilter[sockindex] : NULL;
|
||||
struct Curl_cfilter *cf = conn ? conn->cfilter[sockindex] : NULL;
|
||||
|
||||
(void)data;
|
||||
for(; cf; cf = cf->next) {
|
||||
|
@ -1199,7 +1199,7 @@ static ssize_t recv_closed_stream(struct Curl_cfilter *cf,
|
||||
(void)cf;
|
||||
if(stream->reset) {
|
||||
failf(data, "HTTP/3 stream %" FMT_PRId64 " reset by server", stream->id);
|
||||
*err = data->req.bytecount? CURLE_PARTIAL_FILE : CURLE_HTTP3;
|
||||
*err = data->req.bytecount ? CURLE_PARTIAL_FILE : CURLE_HTTP3;
|
||||
goto out;
|
||||
}
|
||||
else if(!stream->resp_hds_complete) {
|
||||
@ -1277,7 +1277,7 @@ out:
|
||||
}
|
||||
}
|
||||
CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] cf_recv(blen=%zu) -> %zd, %d",
|
||||
stream? stream->id : -1, blen, nread, *err);
|
||||
stream ? stream->id : -1, blen, nread, *err);
|
||||
CF_DATA_RESTORE(cf, save);
|
||||
return nread;
|
||||
}
|
||||
@ -1375,7 +1375,7 @@ cb_h3_read_req_body(nghttp3_conn *conn, int64_t stream_id,
|
||||
CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] read req body -> "
|
||||
"%d vecs%s with %zu (buffered=%zu, left=%" FMT_OFF_T ")",
|
||||
stream->id, (int)nvecs,
|
||||
*pflags == NGHTTP3_DATA_FLAG_EOF?" EOF":"",
|
||||
*pflags == NGHTTP3_DATA_FLAG_EOF ? " EOF" : "",
|
||||
nwritten, Curl_bufq_len(&stream->sendbuf),
|
||||
stream->upload_left);
|
||||
return (nghttp3_ssize)nvecs;
|
||||
@ -1612,7 +1612,7 @@ out:
|
||||
sent = -1;
|
||||
}
|
||||
CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] cf_send(len=%zu) -> %zd, %d",
|
||||
stream? stream->id : -1, len, sent, *err);
|
||||
stream ? stream->id : -1, len, sent, *err);
|
||||
CF_DATA_RESTORE(cf, save);
|
||||
return sent;
|
||||
}
|
||||
@ -2142,9 +2142,9 @@ static int quic_ossl_new_session_cb(SSL *ssl, SSL_SESSION *ssl_sessionid)
|
||||
ngtcp2_crypto_conn_ref *cref;
|
||||
|
||||
cref = (ngtcp2_crypto_conn_ref *)SSL_get_app_data(ssl);
|
||||
cf = cref? cref->user_data : NULL;
|
||||
ctx = cf? cf->ctx : NULL;
|
||||
data = cf? CF_DATA_CURRENT(cf) : NULL;
|
||||
cf = cref ? cref->user_data : NULL;
|
||||
ctx = cf ? cf->ctx : NULL;
|
||||
data = cf ? CF_DATA_CURRENT(cf) : NULL;
|
||||
if(cf && data && ctx) {
|
||||
Curl_ossl_add_session(cf, data, &ctx->peer, ssl_sessionid);
|
||||
return 1;
|
||||
@ -2394,7 +2394,7 @@ static CURLcode cf_ngtcp2_query(struct Curl_cfilter *cf,
|
||||
if(ctx->max_bidi_streams > ctx->used_bidi_streams)
|
||||
avail_bidi_streams = ctx->max_bidi_streams - ctx->used_bidi_streams;
|
||||
max_streams += avail_bidi_streams;
|
||||
*pres1 = (max_streams > INT_MAX)? INT_MAX : (int)max_streams;
|
||||
*pres1 = (max_streams > INT_MAX) ? INT_MAX : (int)max_streams;
|
||||
}
|
||||
else /* transport params not arrived yet? take our default. */
|
||||
*pres1 = (int)Curl_multi_max_concurrent_streams(data->multi);
|
||||
@ -2407,7 +2407,7 @@ static CURLcode cf_ngtcp2_query(struct Curl_cfilter *cf,
|
||||
case CF_QUERY_CONNECT_REPLY_MS:
|
||||
if(ctx->q.got_first_byte) {
|
||||
timediff_t ms = Curl_timediff(ctx->q.first_byte_at, ctx->started_at);
|
||||
*pres1 = (ms < INT_MAX)? (int)ms : INT_MAX;
|
||||
*pres1 = (ms < INT_MAX) ? (int)ms : INT_MAX;
|
||||
}
|
||||
else
|
||||
*pres1 = -1;
|
||||
@ -2427,7 +2427,7 @@ static CURLcode cf_ngtcp2_query(struct Curl_cfilter *cf,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return cf->next?
|
||||
return cf->next ?
|
||||
cf->next->cft->query(cf->next, data, query, pres1, pres2) :
|
||||
CURLE_UNKNOWN_OPTION;
|
||||
}
|
||||
@ -2534,7 +2534,7 @@ CURLcode Curl_cf_ngtcp2_create(struct Curl_cfilter **pcf,
|
||||
cf->next = udp_cf;
|
||||
|
||||
out:
|
||||
*pcf = (!result)? cf : NULL;
|
||||
*pcf = (!result) ? cf : NULL;
|
||||
if(result) {
|
||||
if(udp_cf)
|
||||
Curl_conn_cf_discard_sub(cf, udp_cf, data, TRUE);
|
||||
@ -2548,7 +2548,7 @@ bool Curl_conn_is_ngtcp2(const struct Curl_easy *data,
|
||||
const struct connectdata *conn,
|
||||
int sockindex)
|
||||
{
|
||||
struct Curl_cfilter *cf = conn? conn->cfilter[sockindex] : NULL;
|
||||
struct Curl_cfilter *cf = conn ? conn->cfilter[sockindex] : NULL;
|
||||
|
||||
(void)data;
|
||||
for(; cf; cf = cf->next) {
|
||||
|
@ -1037,7 +1037,7 @@ cb_h3_read_req_body(nghttp3_conn *conn, int64_t stream_id,
|
||||
CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] read req body -> "
|
||||
"%d vecs%s with %zu (buffered=%zu, left=%" FMT_OFF_T ")",
|
||||
stream->s.id, (int)nvecs,
|
||||
*pflags == NGHTTP3_DATA_FLAG_EOF?" EOF":"",
|
||||
*pflags == NGHTTP3_DATA_FLAG_EOF ? " EOF" : "",
|
||||
nwritten, Curl_bufq_len(&stream->sendbuf),
|
||||
stream->upload_left);
|
||||
return (nghttp3_ssize)nvecs;
|
||||
@ -1531,7 +1531,7 @@ static CURLcode h3_send_streams(struct Curl_cfilter *cf,
|
||||
for(i = 0; (i < n) && !blocked; ++i) {
|
||||
/* Without stream->s.ssl, we closed that already, so
|
||||
* pretend the write did succeed. */
|
||||
uint64_t flags = (eos && ((i + 1) == n))? SSL_WRITE_FLAG_CONCLUDE : 0;
|
||||
uint64_t flags = (eos && ((i + 1) == n)) ? SSL_WRITE_FLAG_CONCLUDE : 0;
|
||||
written = vec[i].len;
|
||||
ok = !s->ssl || SSL_write_ex2(s->ssl, vec[i].base, vec[i].len, flags,
|
||||
&written);
|
||||
@ -1985,7 +1985,7 @@ static ssize_t cf_osslq_send(struct Curl_cfilter *cf, struct Curl_easy *data,
|
||||
out:
|
||||
result = check_and_set_expiry(cf, data);
|
||||
CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] cf_send(len=%zu) -> %zd, %d",
|
||||
stream? stream->s.id : -1, len, nwritten, *err);
|
||||
stream ? stream->s.id : -1, len, nwritten, *err);
|
||||
CF_DATA_RESTORE(cf, save);
|
||||
return nwritten;
|
||||
}
|
||||
@ -2002,7 +2002,7 @@ static ssize_t recv_closed_stream(struct Curl_cfilter *cf,
|
||||
failf(data,
|
||||
"HTTP/3 stream %" FMT_PRId64 " reset by server",
|
||||
stream->s.id);
|
||||
*err = data->req.bytecount? CURLE_PARTIAL_FILE : CURLE_HTTP3;
|
||||
*err = data->req.bytecount ? CURLE_PARTIAL_FILE : CURLE_HTTP3;
|
||||
goto out;
|
||||
}
|
||||
else if(!stream->resp_hds_complete) {
|
||||
@ -2096,7 +2096,7 @@ out:
|
||||
}
|
||||
}
|
||||
CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] cf_recv(len=%zu) -> %zd, %d",
|
||||
stream? stream->s.id : -1, len, nread, *err);
|
||||
stream ? stream->s.id : -1, len, nread, *err);
|
||||
CF_DATA_RESTORE(cf, save);
|
||||
return nread;
|
||||
}
|
||||
@ -2266,7 +2266,7 @@ static CURLcode cf_osslq_query(struct Curl_cfilter *cf,
|
||||
}
|
||||
/* we report avail + in_use */
|
||||
v += CONN_INUSE(cf->conn);
|
||||
*pres1 = (v > INT_MAX)? INT_MAX : (int)v;
|
||||
*pres1 = (v > INT_MAX) ? INT_MAX : (int)v;
|
||||
#else
|
||||
*pres1 = 100;
|
||||
#endif
|
||||
@ -2276,7 +2276,7 @@ static CURLcode cf_osslq_query(struct Curl_cfilter *cf,
|
||||
case CF_QUERY_CONNECT_REPLY_MS:
|
||||
if(ctx->got_first_byte) {
|
||||
timediff_t ms = Curl_timediff(ctx->first_byte_at, ctx->started_at);
|
||||
*pres1 = (ms < INT_MAX)? (int)ms : INT_MAX;
|
||||
*pres1 = (ms < INT_MAX) ? (int)ms : INT_MAX;
|
||||
}
|
||||
else
|
||||
*pres1 = -1;
|
||||
@ -2296,7 +2296,7 @@ static CURLcode cf_osslq_query(struct Curl_cfilter *cf,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return cf->next?
|
||||
return cf->next ?
|
||||
cf->next->cft->query(cf->next, data, query, pres1, pres2) :
|
||||
CURLE_UNKNOWN_OPTION;
|
||||
}
|
||||
@ -2351,7 +2351,7 @@ CURLcode Curl_cf_osslq_create(struct Curl_cfilter **pcf,
|
||||
cf->next = udp_cf;
|
||||
|
||||
out:
|
||||
*pcf = (!result)? cf : NULL;
|
||||
*pcf = (!result) ? cf : NULL;
|
||||
if(result) {
|
||||
if(udp_cf)
|
||||
Curl_conn_cf_discard_sub(cf, udp_cf, data, TRUE);
|
||||
@ -2365,7 +2365,7 @@ bool Curl_conn_is_osslq(const struct Curl_easy *data,
|
||||
const struct connectdata *conn,
|
||||
int sockindex)
|
||||
{
|
||||
struct Curl_cfilter *cf = conn? conn->cfilter[sockindex] : NULL;
|
||||
struct Curl_cfilter *cf = conn ? conn->cfilter[sockindex] : NULL;
|
||||
|
||||
(void)data;
|
||||
for(; cf; cf = cf->next) {
|
||||
|
@ -818,7 +818,7 @@ static ssize_t recv_closed_stream(struct Curl_cfilter *cf,
|
||||
if(stream->reset) {
|
||||
failf(data,
|
||||
"HTTP/3 stream %" FMT_PRIu64 " reset by server", stream->id);
|
||||
*err = data->req.bytecount? CURLE_PARTIAL_FILE : CURLE_HTTP3;
|
||||
*err = data->req.bytecount ? CURLE_PARTIAL_FILE : CURLE_HTTP3;
|
||||
CURL_TRC_CF(data, cf, "[%" FMT_PRIu64 "] cf_recv, was reset -> %d",
|
||||
stream->id, *err);
|
||||
}
|
||||
@ -1146,7 +1146,7 @@ out:
|
||||
nwritten = -1;
|
||||
}
|
||||
CURL_TRC_CF(data, cf, "[%" FMT_PRIu64 "] cf_send(len=%zu) -> %zd, %d",
|
||||
stream? stream->id : (curl_uint64_t)~0, len, nwritten, *err);
|
||||
stream ? stream->id : (curl_uint64_t)~0, len, nwritten, *err);
|
||||
return nwritten;
|
||||
}
|
||||
|
||||
@ -1546,7 +1546,7 @@ static CURLcode cf_quiche_query(struct Curl_cfilter *cf,
|
||||
if(!ctx->goaway) {
|
||||
max_streams += quiche_conn_peer_streams_left_bidi(ctx->qconn);
|
||||
}
|
||||
*pres1 = (max_streams > INT_MAX)? INT_MAX : (int)max_streams;
|
||||
*pres1 = (max_streams > INT_MAX) ? INT_MAX : (int)max_streams;
|
||||
CURL_TRC_CF(data, cf, "query conn[%" FMT_OFF_T "]: "
|
||||
"MAX_CONCURRENT -> %d (%zu in use)",
|
||||
cf->conn->connection_id, *pres1, CONN_INUSE(cf->conn));
|
||||
@ -1555,7 +1555,7 @@ static CURLcode cf_quiche_query(struct Curl_cfilter *cf,
|
||||
case CF_QUERY_CONNECT_REPLY_MS:
|
||||
if(ctx->q.got_first_byte) {
|
||||
timediff_t ms = Curl_timediff(ctx->q.first_byte_at, ctx->started_at);
|
||||
*pres1 = (ms < INT_MAX)? (int)ms : INT_MAX;
|
||||
*pres1 = (ms < INT_MAX) ? (int)ms : INT_MAX;
|
||||
}
|
||||
else
|
||||
*pres1 = -1;
|
||||
@ -1575,7 +1575,7 @@ static CURLcode cf_quiche_query(struct Curl_cfilter *cf,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return cf->next?
|
||||
return cf->next ?
|
||||
cf->next->cft->query(cf->next, data, query, pres1, pres2) :
|
||||
CURLE_UNKNOWN_OPTION;
|
||||
}
|
||||
@ -1667,7 +1667,7 @@ CURLcode Curl_cf_quiche_create(struct Curl_cfilter **pcf,
|
||||
cf->next = udp_cf;
|
||||
|
||||
out:
|
||||
*pcf = (!result)? cf : NULL;
|
||||
*pcf = (!result) ? cf : NULL;
|
||||
if(result) {
|
||||
if(udp_cf)
|
||||
Curl_conn_cf_discard_sub(cf, udp_cf, data, TRUE);
|
||||
@ -1682,7 +1682,7 @@ bool Curl_conn_is_quiche(const struct Curl_easy *data,
|
||||
const struct connectdata *conn,
|
||||
int sockindex)
|
||||
{
|
||||
struct Curl_cfilter *cf = conn? conn->cfilter[sockindex] : NULL;
|
||||
struct Curl_cfilter *cf = conn ? conn->cfilter[sockindex] : NULL;
|
||||
|
||||
(void)data;
|
||||
for(; cf; cf = cf->next) {
|
||||
|
@ -397,7 +397,7 @@ static int sshkeycallback(struct Curl_easy *easy,
|
||||
(void)clientp;
|
||||
|
||||
/* we only allow perfect matches, and we reject everything else */
|
||||
return (match != CURLKHMATCH_OK)?CURLKHSTAT_REJECT:CURLKHSTAT_FINE;
|
||||
return (match != CURLKHMATCH_OK) ? CURLKHSTAT_REJECT : CURLKHSTAT_FINE;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -534,8 +534,8 @@ static CURLcode ssh_knownhost(struct Curl_easy *data)
|
||||
#ifdef HAVE_LIBSSH2_KNOWNHOST_CHECKP
|
||||
keycheck = libssh2_knownhost_checkp(sshc->kh,
|
||||
conn->host.name,
|
||||
(conn->remote_port != PORT_SSH)?
|
||||
conn->remote_port:-1,
|
||||
(conn->remote_port != PORT_SSH) ?
|
||||
conn->remote_port : -1,
|
||||
remotekey, keylen,
|
||||
LIBSSH2_KNOWNHOST_TYPE_PLAIN|
|
||||
LIBSSH2_KNOWNHOST_KEYENC_RAW|
|
||||
@ -552,8 +552,8 @@ static CURLcode ssh_knownhost(struct Curl_easy *data)
|
||||
#endif
|
||||
|
||||
infof(data, "SSH host check: %d, key: %s", keycheck,
|
||||
(keycheck <= LIBSSH2_KNOWNHOST_CHECK_MISMATCH)?
|
||||
host->key:"<none>");
|
||||
(keycheck <= LIBSSH2_KNOWNHOST_CHECK_MISMATCH) ?
|
||||
host->key : "<none>");
|
||||
|
||||
/* setup 'knownkey' */
|
||||
if(keycheck <= LIBSSH2_KNOWNHOST_CHECK_MISMATCH) {
|
||||
@ -2106,7 +2106,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
|
||||
if(sshc->secondCreateDirs) {
|
||||
state(data, SSH_SFTP_CLOSE);
|
||||
sshc->actualcode = sftperr != LIBSSH2_FX_OK ?
|
||||
sftp_libssh2_error_to_CURLE(sftperr):CURLE_SSH;
|
||||
sftp_libssh2_error_to_CURLE(sftperr) : CURLE_SSH;
|
||||
failf(data, "Creating the dir/file failed: %s",
|
||||
sftp_libssh2_strerror(sftperr));
|
||||
break;
|
||||
@ -2124,7 +2124,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
|
||||
}
|
||||
state(data, SSH_SFTP_CLOSE);
|
||||
sshc->actualcode = sftperr != LIBSSH2_FX_OK ?
|
||||
sftp_libssh2_error_to_CURLE(sftperr):CURLE_SSH;
|
||||
sftp_libssh2_error_to_CURLE(sftperr) : CURLE_SSH;
|
||||
if(!sshc->actualcode) {
|
||||
/* Sometimes, for some reason libssh2_sftp_last_error() returns zero
|
||||
even though libssh2_sftp_open() failed previously! We need to
|
||||
@ -2134,7 +2134,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
|
||||
}
|
||||
failf(data, "Upload failed: %s (%lu/%d)",
|
||||
sftperr != LIBSSH2_FX_OK ?
|
||||
sftp_libssh2_strerror(sftperr):"ssh error",
|
||||
sftp_libssh2_strerror(sftperr) : "ssh error",
|
||||
sftperr, rc);
|
||||
break;
|
||||
}
|
||||
@ -3078,8 +3078,8 @@ static void ssh_block2waitfor(struct Curl_easy *data, bool block)
|
||||
dir = libssh2_session_block_directions(sshc->ssh_session);
|
||||
if(dir) {
|
||||
/* translate the libssh2 define bits into our own bit defines */
|
||||
conn->waitfor = ((dir&LIBSSH2_SESSION_BLOCK_INBOUND)?KEEP_RECV:0) |
|
||||
((dir&LIBSSH2_SESSION_BLOCK_OUTBOUND)?KEEP_SEND:0);
|
||||
conn->waitfor = ((dir&LIBSSH2_SESSION_BLOCK_INBOUND) ? KEEP_RECV : 0) |
|
||||
((dir&LIBSSH2_SESSION_BLOCK_OUTBOUND) ? KEEP_SEND : 0);
|
||||
}
|
||||
}
|
||||
if(!dir)
|
||||
@ -3156,7 +3156,7 @@ static CURLcode ssh_block_statemach(struct Curl_easy *data,
|
||||
fd_write = sock;
|
||||
/* wait for the socket to become ready */
|
||||
(void)Curl_socket_check(fd_read, CURL_SOCKET_BAD, fd_write,
|
||||
left>1000?1000:left);
|
||||
left > 1000 ? 1000 : left);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,8 +256,8 @@ static ssize_t wsftp_send(struct Curl_easy *data, int sockindex,
|
||||
(void)sockindex;
|
||||
(void)eos;
|
||||
|
||||
offset[0] = (word32)sshc->offset&0xFFFFFFFF;
|
||||
offset[1] = (word32)(sshc->offset>>32)&0xFFFFFFFF;
|
||||
offset[0] = (word32)sshc->offset & 0xFFFFFFFF;
|
||||
offset[1] = (word32)(sshc->offset >> 32) & 0xFFFFFFFF;
|
||||
|
||||
rc = wolfSSH_SFTP_SendWritePacket(sshc->ssh_session, sshc->handle,
|
||||
sshc->handleSz,
|
||||
@ -300,8 +300,8 @@ static ssize_t wsftp_recv(struct Curl_easy *data, int sockindex,
|
||||
word32 offset[2];
|
||||
(void)sockindex;
|
||||
|
||||
offset[0] = (word32)sshc->offset&0xFFFFFFFF;
|
||||
offset[1] = (word32)(sshc->offset>>32)&0xFFFFFFFF;
|
||||
offset[0] = (word32)sshc->offset & 0xFFFFFFFF;
|
||||
offset[1] = (word32)(sshc->offset >> 32) & 0xFFFFFFFF;
|
||||
|
||||
rc = wolfSSH_SFTP_SendReadPacket(sshc->ssh_session, sshc->handle,
|
||||
sshc->handleSz,
|
||||
@ -763,7 +763,7 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
|
||||
return CURLE_SSH;
|
||||
}
|
||||
|
||||
size = ((curl_off_t)attrs.sz[1] <<32) | attrs.sz[0];
|
||||
size = ((curl_off_t)attrs.sz[1] << 32) | attrs.sz[0];
|
||||
|
||||
data->req.size = size;
|
||||
data->req.maxdownload = size;
|
||||
@ -1028,7 +1028,7 @@ static CURLcode wssh_block_statemach(struct Curl_easy *data,
|
||||
|
||||
/* wait for the socket to become ready */
|
||||
(void)Curl_socket_check(fd_read, CURL_SOCKET_BAD, fd_write,
|
||||
left>1000?1000:left); /* ignore result */
|
||||
left > 1000 ? 1000 : left); /* ignore result */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -821,7 +821,7 @@ static CURLcode bearssl_connect_step3(struct Curl_cfilter *cf,
|
||||
|
||||
proto = br_ssl_engine_get_selected_protocol(&backend->ctx.eng);
|
||||
Curl_alpn_set_negotiated(cf, data, (const unsigned char *)proto,
|
||||
proto? strlen(proto) : 0);
|
||||
proto ? strlen(proto) : 0);
|
||||
}
|
||||
|
||||
if(ssl_config->primary.cache_session) {
|
||||
@ -941,15 +941,14 @@ static CURLcode bearssl_connect_common(struct Curl_cfilter *cf,
|
||||
|
||||
/* if ssl is expecting something, check if it is available. */
|
||||
if(connssl->io_need) {
|
||||
|
||||
curl_socket_t writefd = (connssl->io_need & CURL_SSL_IO_NEED_SEND)?
|
||||
sockfd:CURL_SOCKET_BAD;
|
||||
curl_socket_t readfd = (connssl->io_need & CURL_SSL_IO_NEED_RECV)?
|
||||
sockfd:CURL_SOCKET_BAD;
|
||||
curl_socket_t writefd = (connssl->io_need & CURL_SSL_IO_NEED_SEND) ?
|
||||
sockfd : CURL_SOCKET_BAD;
|
||||
curl_socket_t readfd = (connssl->io_need & CURL_SSL_IO_NEED_RECV) ?
|
||||
sockfd : CURL_SOCKET_BAD;
|
||||
|
||||
CURL_TRC_CF(data, cf, "connect_common, check socket");
|
||||
what = Curl_socket_check(readfd, CURL_SOCKET_BAD, writefd,
|
||||
nonblocking?0:timeout_ms);
|
||||
nonblocking ? 0 : timeout_ms);
|
||||
CURL_TRC_CF(data, cf, "connect_common, check socket -> %d", what);
|
||||
if(what < 0) {
|
||||
/* fatal error */
|
||||
|
@ -108,7 +108,7 @@ static ssize_t gtls_push(void *s, const void *buf, size_t blen)
|
||||
backend->gtls.io_result = result;
|
||||
if(nwritten < 0) {
|
||||
gnutls_transport_set_errno(backend->gtls.session,
|
||||
(CURLE_AGAIN == result)? EAGAIN : EINVAL);
|
||||
(CURLE_AGAIN == result) ? EAGAIN : EINVAL);
|
||||
nwritten = -1;
|
||||
}
|
||||
return nwritten;
|
||||
@ -140,7 +140,7 @@ static ssize_t gtls_pull(void *s, void *buf, size_t blen)
|
||||
backend->gtls.io_result = result;
|
||||
if(nread < 0) {
|
||||
gnutls_transport_set_errno(backend->gtls.session,
|
||||
(CURLE_AGAIN == result)? EAGAIN : EINVAL);
|
||||
(CURLE_AGAIN == result) ? EAGAIN : EINVAL);
|
||||
nread = -1;
|
||||
}
|
||||
else if(nread == 0)
|
||||
@ -159,7 +159,7 @@ static int gtls_init(void)
|
||||
{
|
||||
int ret = 1;
|
||||
if(!gtls_inited) {
|
||||
ret = gnutls_global_init()?0:1;
|
||||
ret = gnutls_global_init() ? 0 : 1;
|
||||
#ifdef GTLSDEBUG
|
||||
gnutls_global_set_log_function(tls_log_func);
|
||||
gnutls_global_set_log_level(2);
|
||||
@ -193,7 +193,7 @@ static void showtime(struct Curl_easy *data,
|
||||
sizeof(str),
|
||||
" %s: %s, %02d %s %4d %02d:%02d:%02d GMT",
|
||||
text,
|
||||
Curl_wkday[tm->tm_wday?tm->tm_wday-1:6],
|
||||
Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6],
|
||||
tm->tm_mday,
|
||||
Curl_month[tm->tm_mon],
|
||||
tm->tm_year + 1900,
|
||||
@ -269,14 +269,14 @@ static CURLcode handshake(struct Curl_cfilter *cf,
|
||||
/* if ssl is expecting something, check if it is available. */
|
||||
if(connssl->io_need) {
|
||||
int what;
|
||||
curl_socket_t writefd = (connssl->io_need & CURL_SSL_IO_NEED_SEND)?
|
||||
sockfd:CURL_SOCKET_BAD;
|
||||
curl_socket_t readfd = (connssl->io_need & CURL_SSL_IO_NEED_RECV)?
|
||||
sockfd:CURL_SOCKET_BAD;
|
||||
curl_socket_t writefd = (connssl->io_need & CURL_SSL_IO_NEED_SEND) ?
|
||||
sockfd : CURL_SOCKET_BAD;
|
||||
curl_socket_t readfd = (connssl->io_need & CURL_SSL_IO_NEED_RECV) ?
|
||||
sockfd : CURL_SOCKET_BAD;
|
||||
|
||||
what = Curl_socket_check(readfd, CURL_SOCKET_BAD, writefd,
|
||||
nonblocking?0:
|
||||
timeout_ms?timeout_ms:1000);
|
||||
nonblocking ? 0 :
|
||||
timeout_ms ? timeout_ms : 1000);
|
||||
if(what < 0) {
|
||||
/* fatal error */
|
||||
failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO);
|
||||
@ -308,8 +308,8 @@ static CURLcode handshake(struct Curl_cfilter *cf,
|
||||
|
||||
if((rc == GNUTLS_E_AGAIN) || (rc == GNUTLS_E_INTERRUPTED)) {
|
||||
connssl->io_need =
|
||||
gnutls_record_get_direction(session)?
|
||||
CURL_SSL_IO_NEED_SEND:CURL_SSL_IO_NEED_RECV;
|
||||
gnutls_record_get_direction(session) ?
|
||||
CURL_SSL_IO_NEED_SEND : CURL_SSL_IO_NEED_RECV;
|
||||
continue;
|
||||
}
|
||||
else if((rc < 0) && !gnutls_error_is_fatal(rc)) {
|
||||
@ -770,7 +770,7 @@ static int gtls_handshake_cb(gnutls_session_t session, unsigned int htype,
|
||||
struct Curl_easy *data = CF_DATA_CURRENT(cf);
|
||||
if(data) {
|
||||
CURL_TRC_CF(data, cf, "handshake: %s message type %d",
|
||||
incoming? "incoming" : "outgoing", htype);
|
||||
incoming ? "incoming" : "outgoing", htype);
|
||||
switch(htype) {
|
||||
case GNUTLS_HANDSHAKE_NEW_SESSION_TICKET: {
|
||||
gtls_update_session_id(cf, data, session);
|
||||
@ -1313,7 +1313,7 @@ Curl_gtls_verifyserver(struct Curl_easy *data,
|
||||
cause = "attached OCSP status response is invalid";
|
||||
failf(data, "server verification failed: %s. (CAfile: %s "
|
||||
"CRLfile: %s)", cause,
|
||||
config->CAfile ? config->CAfile: "none",
|
||||
config->CAfile ? config->CAfile : "none",
|
||||
ssl_config->primary.CRLfile ?
|
||||
ssl_config->primary.CRLfile : "none");
|
||||
return CURLE_PEER_FAILED_VERIFICATION;
|
||||
@ -1440,12 +1440,12 @@ Curl_gtls_verifyserver(struct Curl_easy *data,
|
||||
unload_file(issuerp);
|
||||
if(rc <= 0) {
|
||||
failf(data, "server certificate issuer check failed (IssuerCert: %s)",
|
||||
config->issuercert?config->issuercert:"none");
|
||||
config->issuercert ? config->issuercert : "none");
|
||||
gnutls_x509_crt_deinit(x509_cert);
|
||||
return CURLE_SSL_ISSUER_ERROR;
|
||||
}
|
||||
infof(data, " server certificate issuer check OK (Issuer Cert: %s)",
|
||||
config->issuercert?config->issuercert:"none");
|
||||
config->issuercert ? config->issuercert : "none");
|
||||
}
|
||||
|
||||
size = sizeof(certname);
|
||||
@ -1650,8 +1650,8 @@ static CURLcode gtls_verifyserver(struct Curl_cfilter *cf,
|
||||
struct ssl_primary_config *conn_config = Curl_ssl_cf_get_primary_config(cf);
|
||||
struct ssl_config_data *ssl_config = Curl_ssl_cf_get_config(cf, data);
|
||||
#ifndef CURL_DISABLE_PROXY
|
||||
const char *pinned_key = Curl_ssl_cf_is_proxy(cf)?
|
||||
data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY]:
|
||||
const char *pinned_key = Curl_ssl_cf_is_proxy(cf) ?
|
||||
data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY] :
|
||||
data->set.str[STRING_SSL_PINNEDPUBLICKEY];
|
||||
#else
|
||||
const char *pinned_key = data->set.str[STRING_SSL_PINNEDPUBLICKEY];
|
||||
@ -1800,9 +1800,9 @@ static ssize_t gtls_send(struct Curl_cfilter *cf,
|
||||
rc = (ssize_t)total_written;
|
||||
goto out;
|
||||
}
|
||||
*curlcode = (rc == GNUTLS_E_AGAIN)?
|
||||
*curlcode = (rc == GNUTLS_E_AGAIN) ?
|
||||
CURLE_AGAIN :
|
||||
(backend->gtls.io_result? backend->gtls.io_result : CURLE_SEND_ERROR);
|
||||
(backend->gtls.io_result ? backend->gtls.io_result : CURLE_SEND_ERROR);
|
||||
|
||||
rc = -1;
|
||||
goto out;
|
||||
@ -1851,7 +1851,7 @@ static CURLcode gtls_shutdown(struct Curl_cfilter *cf,
|
||||
int ret = gnutls_bye(backend->gtls.session, GNUTLS_SHUT_RDWR);
|
||||
if((ret == GNUTLS_E_AGAIN) || (ret == GNUTLS_E_INTERRUPTED)) {
|
||||
CURL_TRC_CF(data, cf, "SSL shutdown, gnutls_bye EAGAIN");
|
||||
connssl->io_need = gnutls_record_get_direction(backend->gtls.session)?
|
||||
connssl->io_need = gnutls_record_get_direction(backend->gtls.session) ?
|
||||
CURL_SSL_IO_NEED_SEND : CURL_SSL_IO_NEED_RECV;
|
||||
backend->gtls.sent_shutdown = FALSE;
|
||||
result = CURLE_OK;
|
||||
@ -1881,7 +1881,7 @@ static CURLcode gtls_shutdown(struct Curl_cfilter *cf,
|
||||
*done = TRUE;
|
||||
}
|
||||
else if((nread == GNUTLS_E_AGAIN) || (nread == GNUTLS_E_INTERRUPTED)) {
|
||||
connssl->io_need = gnutls_record_get_direction(backend->gtls.session)?
|
||||
connssl->io_need = gnutls_record_get_direction(backend->gtls.session) ?
|
||||
CURL_SSL_IO_NEED_SEND : CURL_SSL_IO_NEED_RECV;
|
||||
}
|
||||
else {
|
||||
@ -1957,9 +1957,8 @@ static ssize_t gtls_recv(struct Curl_cfilter *cf,
|
||||
|
||||
if(ret < 0) {
|
||||
failf(data, "GnuTLS recv error (%d): %s",
|
||||
|
||||
(int)ret, gnutls_strerror((int)ret));
|
||||
*curlcode = backend->gtls.io_result?
|
||||
*curlcode = backend->gtls.io_result ?
|
||||
backend->gtls.io_result : CURLE_RECV_ERROR;
|
||||
ret = -1;
|
||||
goto out;
|
||||
@ -1981,7 +1980,7 @@ static CURLcode gtls_random(struct Curl_easy *data,
|
||||
int rc;
|
||||
(void)data;
|
||||
rc = gnutls_rnd(GNUTLS_RND_RANDOM, entropy, length);
|
||||
return rc?CURLE_FAILED_INIT:CURLE_OK;
|
||||
return rc ? CURLE_FAILED_INIT : CURLE_OK;
|
||||
}
|
||||
|
||||
static CURLcode gtls_sha256sum(const unsigned char *tmp, /* input */
|
||||
|
@ -638,7 +638,7 @@ mbed_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
|
||||
ret = mbedtls_x509_crt_parse(&backend->cacert, newblob,
|
||||
ca_info_blob->len + 1);
|
||||
free(newblob);
|
||||
if(ret<0) {
|
||||
if(ret < 0) {
|
||||
mbedtls_strerror(ret, errorbuf, sizeof(errorbuf));
|
||||
failf(data, "Error importing ca cert blob - mbedTLS: (-0x%04X) %s",
|
||||
-ret, errorbuf);
|
||||
@ -650,7 +650,7 @@ mbed_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
|
||||
#ifdef MBEDTLS_FS_IO
|
||||
ret = mbedtls_x509_crt_parse_file(&backend->cacert, ssl_cafile);
|
||||
|
||||
if(ret<0) {
|
||||
if(ret < 0) {
|
||||
mbedtls_strerror(ret, errorbuf, sizeof(errorbuf));
|
||||
failf(data, "Error reading ca cert file %s - mbedTLS: (-0x%04X) %s",
|
||||
ssl_cafile, -ret, errorbuf);
|
||||
@ -666,7 +666,7 @@ mbed_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
|
||||
#ifdef MBEDTLS_FS_IO
|
||||
ret = mbedtls_x509_crt_parse_path(&backend->cacert, ssl_capath);
|
||||
|
||||
if(ret<0) {
|
||||
if(ret < 0) {
|
||||
mbedtls_strerror(ret, errorbuf, sizeof(errorbuf));
|
||||
failf(data, "Error reading ca cert path %s - mbedTLS: (-0x%04X) %s",
|
||||
ssl_capath, -ret, errorbuf);
|
||||
@ -911,7 +911,7 @@ mbed_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
|
||||
&backend->clicert, &backend->pk);
|
||||
}
|
||||
|
||||
if(mbedtls_ssl_set_hostname(&backend->ssl, connssl->peer.sni?
|
||||
if(mbedtls_ssl_set_hostname(&backend->ssl, connssl->peer.sni ?
|
||||
connssl->peer.sni : connssl->peer.hostname)) {
|
||||
/* mbedtls_ssl_set_hostname() sets the name to use in CN/SAN checks and
|
||||
the name to set in the SNI extension. So even if curl connects to a
|
||||
@ -975,8 +975,8 @@ mbed_connect_step2(struct Curl_cfilter *cf, struct Curl_easy *data)
|
||||
struct mbed_ssl_backend_data *backend =
|
||||
(struct mbed_ssl_backend_data *)connssl->backend;
|
||||
#ifndef CURL_DISABLE_PROXY
|
||||
const char * const pinnedpubkey = Curl_ssl_cf_is_proxy(cf)?
|
||||
data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY]:
|
||||
const char * const pinnedpubkey = Curl_ssl_cf_is_proxy(cf) ?
|
||||
data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY] :
|
||||
data->set.str[STRING_SSL_PINNEDPUBLICKEY];
|
||||
#else
|
||||
const char * const pinnedpubkey = data->set.str[STRING_SSL_PINNEDPUBLICKEY];
|
||||
@ -1103,7 +1103,7 @@ pinnedpubkey_error:
|
||||
const char *proto = mbedtls_ssl_get_alpn_protocol(&backend->ssl);
|
||||
|
||||
Curl_alpn_set_negotiated(cf, data, (const unsigned char *)proto,
|
||||
proto? strlen(proto) : 0);
|
||||
proto ? strlen(proto) : 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1186,7 +1186,7 @@ static ssize_t mbed_send(struct Curl_cfilter *cf, struct Curl_easy *data,
|
||||
#ifdef TLS13_SUPPORT
|
||||
|| (ret == MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET)
|
||||
#endif
|
||||
)? CURLE_AGAIN : CURLE_SEND_ERROR;
|
||||
) ? CURLE_AGAIN : CURLE_SEND_ERROR;
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
@ -1357,8 +1357,8 @@ static size_t mbedtls_version(char *buffer, size_t size)
|
||||
#ifdef MBEDTLS_VERSION_C
|
||||
/* if mbedtls_version_get_number() is available it is better */
|
||||
unsigned int version = mbedtls_version_get_number();
|
||||
return msnprintf(buffer, size, "mbedTLS/%u.%u.%u", version>>24,
|
||||
(version>>16)&0xff, (version>>8)&0xff);
|
||||
return msnprintf(buffer, size, "mbedTLS/%u.%u.%u", version >> 24,
|
||||
(version >> 16) & 0xff, (version >> 8) & 0xff);
|
||||
#else
|
||||
return msnprintf(buffer, size, "mbedTLS/%s", MBEDTLS_VERSION_STRING);
|
||||
#endif
|
||||
@ -1452,11 +1452,10 @@ mbed_connect_common(struct Curl_cfilter *cf, struct Curl_easy *data,
|
||||
|
||||
/* if ssl is expecting something, check if it is available. */
|
||||
if(connssl->io_need) {
|
||||
|
||||
curl_socket_t writefd = (connssl->io_need & CURL_SSL_IO_NEED_SEND)?
|
||||
sockfd:CURL_SOCKET_BAD;
|
||||
curl_socket_t readfd = (connssl->io_need & CURL_SSL_IO_NEED_RECV)?
|
||||
sockfd:CURL_SOCKET_BAD;
|
||||
curl_socket_t writefd = (connssl->io_need & CURL_SSL_IO_NEED_SEND) ?
|
||||
sockfd : CURL_SOCKET_BAD;
|
||||
curl_socket_t readfd = (connssl->io_need & CURL_SSL_IO_NEED_RECV) ?
|
||||
sockfd : CURL_SOCKET_BAD;
|
||||
|
||||
what = Curl_socket_check(readfd, CURL_SOCKET_BAD, writefd,
|
||||
nonblocking ? 0 : timeout_ms);
|
||||
|
@ -1558,7 +1558,8 @@ fail:
|
||||
SSL_CTX_use_PrivateKey_file(ctx, key_file, file_type);
|
||||
if(cert_use_result != 1) {
|
||||
failf(data, "unable to set private key file: '%s' type %s",
|
||||
key_file?key_file:"(memory blob)", key_type?key_type:"PEM");
|
||||
key_file ? key_file : "(memory blob)",
|
||||
key_type ? key_type : "PEM");
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
@ -2685,7 +2686,7 @@ static void ossl_trace(int direction, int ssl_ver, int content_type,
|
||||
|
||||
txt_len = msnprintf(ssl_buf, sizeof(ssl_buf),
|
||||
"%s (%s), %s, %s (%d):\n",
|
||||
verstr, direction?"OUT":"IN",
|
||||
verstr, direction ? "OUT" : "IN",
|
||||
tls_rt_name, msg_name, msg_type);
|
||||
if(0 <= txt_len && (unsigned)txt_len < sizeof(ssl_buf)) {
|
||||
Curl_debug(data, CURLINFO_TEXT, ssl_buf, (size_t)txt_len);
|
||||
@ -2941,8 +2942,8 @@ static int ossl_new_session_cb(SSL *ssl, SSL_SESSION *ssl_sessionid)
|
||||
struct ssl_connect_data *connssl;
|
||||
|
||||
cf = (struct Curl_cfilter*) SSL_get_app_data(ssl);
|
||||
connssl = cf? cf->ctx : NULL;
|
||||
data = connssl? CF_DATA_CURRENT(cf) : NULL;
|
||||
connssl = cf ? cf->ctx : NULL;
|
||||
data = connssl ? CF_DATA_CURRENT(cf) : NULL;
|
||||
Curl_ossl_add_session(cf, data, &connssl->peer, ssl_sessionid);
|
||||
return 0;
|
||||
}
|
||||
@ -3167,7 +3168,7 @@ static CURLcode populate_x509_store(struct Curl_cfilter *cf,
|
||||
bool imported_ca_info_blob = false;
|
||||
|
||||
CURL_TRC_CF(data, cf, "populate_x509_store, path=%s, blob=%d",
|
||||
ssl_cafile? ssl_cafile : "none", !!ca_info_blob);
|
||||
ssl_cafile ? ssl_cafile : "none", !!ca_info_blob);
|
||||
if(!store)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
@ -3371,7 +3372,7 @@ static X509_STORE *get_cached_x509_store(struct Curl_cfilter *cf,
|
||||
X509_STORE *store = NULL;
|
||||
|
||||
DEBUGASSERT(multi);
|
||||
share = multi? Curl_hash_pick(&multi->proto_hash,
|
||||
share = multi ? Curl_hash_pick(&multi->proto_hash,
|
||||
(void *)MPROTO_OSSL_X509_KEY,
|
||||
sizeof(MPROTO_OSSL_X509_KEY)-1) : NULL;
|
||||
if(share && share->store &&
|
||||
@ -4312,7 +4313,7 @@ static CURLcode ossl_connect_step2(struct Curl_cfilter *cf,
|
||||
infof(data, "SSL connection using %s / %s / %s / %s",
|
||||
SSL_get_version(octx->ssl),
|
||||
SSL_get_cipher(octx->ssl),
|
||||
negotiated_group_name? negotiated_group_name : "[blank]",
|
||||
negotiated_group_name ? negotiated_group_name : "[blank]",
|
||||
OBJ_nid2sn(psigtype_nid));
|
||||
|
||||
#ifdef USE_ECH
|
||||
@ -4566,11 +4567,11 @@ CURLcode Curl_oss_check_peer_cert(struct Curl_cfilter *cf,
|
||||
}
|
||||
|
||||
infof(data, "%s certificate:",
|
||||
Curl_ssl_cf_is_proxy(cf)? "Proxy" : "Server");
|
||||
Curl_ssl_cf_is_proxy(cf) ? "Proxy" : "Server");
|
||||
|
||||
rc = x509_name_oneline(X509_get_subject_name(octx->server_cert),
|
||||
buffer, sizeof(buffer));
|
||||
infof(data, " subject: %s", rc?"[NONE]":buffer);
|
||||
infof(data, " subject: %s", rc ? "[NONE]" : buffer);
|
||||
|
||||
#ifndef CURL_DISABLE_VERBOSE_STRINGS
|
||||
{
|
||||
@ -4735,8 +4736,8 @@ CURLcode Curl_oss_check_peer_cert(struct Curl_cfilter *cf,
|
||||
result = CURLE_OK;
|
||||
|
||||
#ifndef CURL_DISABLE_PROXY
|
||||
ptr = Curl_ssl_cf_is_proxy(cf)?
|
||||
data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY]:
|
||||
ptr = Curl_ssl_cf_is_proxy(cf) ?
|
||||
data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY] :
|
||||
data->set.str[STRING_SSL_PINNEDPUBLICKEY];
|
||||
#else
|
||||
ptr = data->set.str[STRING_SSL_PINNEDPUBLICKEY];
|
||||
@ -4822,11 +4823,10 @@ static CURLcode ossl_connect_common(struct Curl_cfilter *cf,
|
||||
|
||||
/* if ssl is expecting something, check if it is available. */
|
||||
if(!nonblocking && connssl->io_need) {
|
||||
|
||||
curl_socket_t writefd = (connssl->io_need & CURL_SSL_IO_NEED_SEND)?
|
||||
sockfd:CURL_SOCKET_BAD;
|
||||
curl_socket_t readfd = (connssl->io_need & CURL_SSL_IO_NEED_RECV)?
|
||||
sockfd:CURL_SOCKET_BAD;
|
||||
curl_socket_t writefd = (connssl->io_need & CURL_SSL_IO_NEED_SEND) ?
|
||||
sockfd : CURL_SOCKET_BAD;
|
||||
curl_socket_t readfd = (connssl->io_need & CURL_SSL_IO_NEED_RECV) ?
|
||||
sockfd : CURL_SOCKET_BAD;
|
||||
|
||||
what = Curl_socket_check(readfd, CURL_SOCKET_BAD, writefd,
|
||||
timeout_ms);
|
||||
@ -5209,9 +5209,9 @@ static size_t ossl_version(char *buffer, size_t size)
|
||||
#else
|
||||
return msnprintf(buffer, size, "%s/%lx.%lx.%lx",
|
||||
OSSL_PACKAGE,
|
||||
(LIBRESSL_VERSION_NUMBER>>28)&0xf,
|
||||
(LIBRESSL_VERSION_NUMBER>>20)&0xff,
|
||||
(LIBRESSL_VERSION_NUMBER>>12)&0xff);
|
||||
(LIBRESSL_VERSION_NUMBER >> 28) & 0xf,
|
||||
(LIBRESSL_VERSION_NUMBER >> 20) & 0xff,
|
||||
(LIBRESSL_VERSION_NUMBER >> 12) & 0xff);
|
||||
#endif
|
||||
#elif defined(OPENSSL_IS_BORINGSSL)
|
||||
#ifdef CURL_BORINGSSL_VERSION
|
||||
@ -5262,9 +5262,9 @@ static size_t ossl_version(char *buffer, size_t size)
|
||||
#endif
|
||||
,
|
||||
OSSL_PACKAGE,
|
||||
(ssleay_value>>28)&0xf,
|
||||
(ssleay_value>>20)&0xff,
|
||||
(ssleay_value>>12)&0xff,
|
||||
(ssleay_value >> 28) & 0xf,
|
||||
(ssleay_value >> 20) & 0xff,
|
||||
(ssleay_value >> 12) & 0xff,
|
||||
sub);
|
||||
#endif /* OPENSSL_IS_BORINGSSL */
|
||||
}
|
||||
|
@ -878,7 +878,7 @@ cr_connect_common(struct Curl_cfilter *cf,
|
||||
return CURLE_OPERATION_TIMEDOUT;
|
||||
}
|
||||
|
||||
socket_check_timeout = blocking?timeout_ms:0;
|
||||
socket_check_timeout = blocking ? timeout_ms : 0;
|
||||
|
||||
what = Curl_socket_check(readfd, CURL_SOCKET_BAD, writefd,
|
||||
socket_check_timeout);
|
||||
|
@ -1153,7 +1153,7 @@ schannel_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
|
||||
|
||||
/* A hostname associated with the credential is needed by
|
||||
InitializeSecurityContext for SNI and other reasons. */
|
||||
snihost = connssl->peer.sni? connssl->peer.sni : connssl->peer.hostname;
|
||||
snihost = connssl->peer.sni ? connssl->peer.sni : connssl->peer.hostname;
|
||||
backend->cred->sni_hostname = curlx_convert_UTF8_to_tchar(snihost);
|
||||
if(!backend->cred->sni_hostname)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
@ -1332,7 +1332,7 @@ schannel_connect_step2(struct Curl_cfilter *cf, struct Curl_easy *data)
|
||||
|
||||
DEBUGASSERT(backend);
|
||||
|
||||
doread = (connssl->io_need & CURL_SSL_IO_NEED_SEND)? FALSE : TRUE;
|
||||
doread = (connssl->io_need & CURL_SSL_IO_NEED_SEND) ? FALSE : TRUE;
|
||||
connssl->io_need = CURL_SSL_IO_NEED_NONE;
|
||||
|
||||
DEBUGF(infof(data,
|
||||
@ -1571,8 +1571,8 @@ schannel_connect_step2(struct Curl_cfilter *cf, struct Curl_easy *data)
|
||||
}
|
||||
|
||||
#ifndef CURL_DISABLE_PROXY
|
||||
pubkey_ptr = Curl_ssl_cf_is_proxy(cf)?
|
||||
data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY]:
|
||||
pubkey_ptr = Curl_ssl_cf_is_proxy(cf) ?
|
||||
data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY] :
|
||||
data->set.str[STRING_SSL_PINNEDPUBLICKEY];
|
||||
#else
|
||||
pubkey_ptr = data->set.str[STRING_SSL_PINNEDPUBLICKEY];
|
||||
@ -1863,9 +1863,9 @@ schannel_connect_common(struct Curl_cfilter *cf,
|
||||
/* if ssl is expecting something, check if it is available. */
|
||||
if(connssl->io_need) {
|
||||
|
||||
curl_socket_t writefd = (connssl->io_need & CURL_SSL_IO_NEED_SEND)?
|
||||
curl_socket_t writefd = (connssl->io_need & CURL_SSL_IO_NEED_SEND) ?
|
||||
sockfd : CURL_SOCKET_BAD;
|
||||
curl_socket_t readfd = (connssl->io_need & CURL_SSL_IO_NEED_RECV)?
|
||||
curl_socket_t readfd = (connssl->io_need & CURL_SSL_IO_NEED_RECV) ?
|
||||
sockfd : CURL_SOCKET_BAD;
|
||||
|
||||
what = Curl_socket_check(readfd, CURL_SOCKET_BAD, writefd,
|
||||
|
@ -116,7 +116,7 @@ static CURLcode add_certs_data_to_store(HCERTSTORE trust_store,
|
||||
const char *current_ca_file_ptr = ca_buffer;
|
||||
const char *ca_buffer_limit = ca_buffer + ca_buffer_size;
|
||||
|
||||
while(more_certs && (current_ca_file_ptr<ca_buffer_limit)) {
|
||||
while(more_certs && (current_ca_file_ptr < ca_buffer_limit)) {
|
||||
const char *begin_cert_ptr = c_memmem(current_ca_file_ptr,
|
||||
ca_buffer_limit-current_ca_file_ptr,
|
||||
BEGIN_CERT,
|
||||
|
@ -532,7 +532,7 @@ static OSStatus CopyIdentityWithLabel(char *label,
|
||||
keys_list_count = CFArrayGetCount(keys_list);
|
||||
*out_cert_and_key = NULL;
|
||||
status = 1;
|
||||
for(i = 0; i<keys_list_count; i++) {
|
||||
for(i = 0; i < keys_list_count; i++) {
|
||||
OSStatus err = noErr;
|
||||
SecCertificateRef cert = NULL;
|
||||
SecIdentityRef identity =
|
||||
@ -1285,7 +1285,7 @@ static CURLcode sectransp_connect_step1(struct Curl_cfilter *cf,
|
||||
* Both hostname check and SNI require SSLSetPeerDomainName().
|
||||
* Also: the verifyhost setting influences SNI usage */
|
||||
if(conn_config->verifyhost) {
|
||||
char *server = connssl->peer.sni?
|
||||
char *server = connssl->peer.sni ?
|
||||
connssl->peer.sni : connssl->peer.hostname;
|
||||
err = SSLSetPeerDomainName(backend->ssl_ctx, server, strlen(server));
|
||||
|
||||
@ -2328,10 +2328,10 @@ sectransp_connect_common(struct Curl_cfilter *cf, struct Curl_easy *data,
|
||||
/* if ssl is expecting something, check if it is available. */
|
||||
if(connssl->io_need) {
|
||||
|
||||
curl_socket_t writefd = (connssl->io_need & CURL_SSL_IO_NEED_SEND)?
|
||||
sockfd:CURL_SOCKET_BAD;
|
||||
curl_socket_t readfd = (connssl->io_need & CURL_SSL_IO_NEED_RECV)?
|
||||
sockfd:CURL_SOCKET_BAD;
|
||||
curl_socket_t writefd = (connssl->io_need & CURL_SSL_IO_NEED_SEND) ?
|
||||
sockfd : CURL_SOCKET_BAD;
|
||||
curl_socket_t readfd = (connssl->io_need & CURL_SSL_IO_NEED_RECV) ?
|
||||
sockfd : CURL_SOCKET_BAD;
|
||||
|
||||
what = Curl_socket_check(readfd, CURL_SOCKET_BAD, writefd,
|
||||
nonblocking ? 0 : timeout_ms);
|
||||
|
@ -371,8 +371,8 @@ void Curl_ssl_conn_config_update(struct Curl_easy *data, bool for_proxy)
|
||||
if(data->conn) {
|
||||
struct ssl_primary_config *src, *dest;
|
||||
#ifndef CURL_DISABLE_PROXY
|
||||
src = for_proxy? &data->set.proxy_ssl.primary : &data->set.ssl.primary;
|
||||
dest = for_proxy? &data->conn->proxy_ssl_config : &data->conn->ssl_config;
|
||||
src = for_proxy ? &data->set.proxy_ssl.primary : &data->set.ssl.primary;
|
||||
dest = for_proxy ? &data->conn->proxy_ssl_config : &data->conn->ssl_config;
|
||||
#else
|
||||
(void)for_proxy;
|
||||
src = &data->set.ssl.primary;
|
||||
@ -581,7 +581,7 @@ bool Curl_ssl_getsessionid(struct Curl_cfilter *cf,
|
||||
}
|
||||
|
||||
CURL_TRC_CF(data, cf, "%s cached session ID for %s://%s:%d",
|
||||
no_match? "No": "Found",
|
||||
no_match ? "No" : "Found",
|
||||
cf->conn->handler->scheme, peer->hostname, peer->port);
|
||||
return no_match;
|
||||
}
|
||||
@ -857,7 +857,7 @@ void Curl_ssl_free_certinfo(struct Curl_easy *data)
|
||||
if(ci->num_of_certs) {
|
||||
/* free all individual lists used */
|
||||
int i;
|
||||
for(i = 0; i<ci->num_of_certs; i++) {
|
||||
for(i = 0; i < ci->num_of_certs; i++) {
|
||||
curl_slist_free_all(ci->certinfo[i]);
|
||||
ci->certinfo[i] = NULL;
|
||||
}
|
||||
@ -1851,7 +1851,7 @@ static CURLcode ssl_cf_query(struct Curl_cfilter *cf,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return cf->next?
|
||||
return cf->next ?
|
||||
cf->next->cft->query(cf->next, data, query, pres1, pres2) :
|
||||
CURLE_UNKNOWN_OPTION;
|
||||
}
|
||||
@ -1881,7 +1881,7 @@ static bool cf_ssl_is_alive(struct Curl_cfilter *cf, struct Curl_easy *data,
|
||||
return FALSE;
|
||||
}
|
||||
/* ssl backend does not know */
|
||||
return cf->next?
|
||||
return cf->next ?
|
||||
cf->next->cft->is_alive(cf->next, data, input_pending) :
|
||||
FALSE; /* pessimistic in absence of data */
|
||||
}
|
||||
@ -2029,7 +2029,7 @@ CURLcode Curl_cf_ssl_proxy_insert_after(struct Curl_cfilter *cf_at,
|
||||
bool Curl_ssl_supports(struct Curl_easy *data, unsigned int ssl_option)
|
||||
{
|
||||
(void)data;
|
||||
return (Curl_ssl->supports & ssl_option)? TRUE : FALSE;
|
||||
return (Curl_ssl->supports & ssl_option) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
static struct Curl_cfilter *get_ssl_filter(struct Curl_cfilter *cf)
|
||||
@ -2124,7 +2124,7 @@ CURLcode Curl_ssl_cfilter_remove(struct Curl_easy *data,
|
||||
struct Curl_cfilter *cf, *head;
|
||||
CURLcode result = CURLE_OK;
|
||||
|
||||
head = data->conn? data->conn->cfilter[sockindex] : NULL;
|
||||
head = data->conn ? data->conn->cfilter[sockindex] : NULL;
|
||||
for(cf = head; cf; cf = cf->next) {
|
||||
if(cf->cft == &Curl_cft_ssl) {
|
||||
bool done;
|
||||
@ -2154,7 +2154,7 @@ Curl_ssl_cf_get_config(struct Curl_cfilter *cf, struct Curl_easy *data)
|
||||
(void)cf;
|
||||
return &data->set.ssl;
|
||||
#else
|
||||
return Curl_ssl_cf_is_proxy(cf)? &data->set.proxy_ssl : &data->set.ssl;
|
||||
return Curl_ssl_cf_is_proxy(cf) ? &data->set.proxy_ssl : &data->set.ssl;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -2164,7 +2164,7 @@ Curl_ssl_cf_get_primary_config(struct Curl_cfilter *cf)
|
||||
#ifdef CURL_DISABLE_PROXY
|
||||
return &cf->conn->ssl_config;
|
||||
#else
|
||||
return Curl_ssl_cf_is_proxy(cf)?
|
||||
return Curl_ssl_cf_is_proxy(cf) ?
|
||||
&cf->conn->proxy_ssl_config : &cf->conn->ssl_config;
|
||||
#endif
|
||||
}
|
||||
@ -2222,7 +2222,7 @@ CURLcode Curl_alpn_set_negotiated(struct Curl_cfilter *cf,
|
||||
{
|
||||
unsigned char *palpn =
|
||||
#ifndef CURL_DISABLE_PROXY
|
||||
(cf->conn->bits.tunnel_proxy && Curl_ssl_cf_is_proxy(cf))?
|
||||
(cf->conn->bits.tunnel_proxy && Curl_ssl_cf_is_proxy(cf)) ?
|
||||
&cf->conn->proxy_alpn : &cf->conn->alpn
|
||||
#else
|
||||
&cf->conn->alpn
|
||||
|
@ -421,7 +421,7 @@ static CURLcode populate_x509_store(struct Curl_cfilter *cf,
|
||||
/* load trusted cacert from file if not blob */
|
||||
|
||||
CURL_TRC_CF(data, cf, "populate_x509_store, path=%s, blob=%d",
|
||||
ssl_cafile? ssl_cafile : "none", !!ca_info_blob);
|
||||
ssl_cafile ? ssl_cafile : "none", !!ca_info_blob);
|
||||
if(!store)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
@ -517,7 +517,7 @@ static X509_STORE *get_cached_x509_store(struct Curl_cfilter *cf,
|
||||
WOLFSSL_X509_STORE *store = NULL;
|
||||
|
||||
DEBUGASSERT(multi);
|
||||
share = multi? Curl_hash_pick(&multi->proto_hash,
|
||||
share = multi ? Curl_hash_pick(&multi->proto_hash,
|
||||
(void *)MPROTO_WSSL_X509_KEY,
|
||||
sizeof(MPROTO_WSSL_X509_KEY)-1) : NULL;
|
||||
if(share && share->store &&
|
||||
@ -960,7 +960,7 @@ wolfssl_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
|
||||
* anyway. In the latter case the result of the verification is checked with
|
||||
* SSL_get_verify_result() below. */
|
||||
wolfSSL_CTX_set_verify(backend->ctx,
|
||||
conn_config->verifypeer?SSL_VERIFY_PEER:
|
||||
conn_config->verifypeer ? SSL_VERIFY_PEER :
|
||||
SSL_VERIFY_NONE, NULL);
|
||||
|
||||
#ifdef HAVE_SNI
|
||||
@ -1200,8 +1200,8 @@ wolfssl_connect_step2(struct Curl_cfilter *cf, struct Curl_easy *data)
|
||||
(struct wolfssl_ctx *)connssl->backend;
|
||||
struct ssl_primary_config *conn_config = Curl_ssl_cf_get_primary_config(cf);
|
||||
#ifndef CURL_DISABLE_PROXY
|
||||
const char * const pinnedpubkey = Curl_ssl_cf_is_proxy(cf)?
|
||||
data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY]:
|
||||
const char * const pinnedpubkey = Curl_ssl_cf_is_proxy(cf) ?
|
||||
data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY] :
|
||||
data->set.str[STRING_SSL_PINNEDPUBLICKEY];
|
||||
#else
|
||||
const char * const pinnedpubkey = data->set.str[STRING_SSL_PINNEDPUBLICKEY];
|
||||
@ -1213,7 +1213,7 @@ wolfssl_connect_step2(struct Curl_cfilter *cf, struct Curl_easy *data)
|
||||
|
||||
/* Enable RFC2818 checks */
|
||||
if(conn_config->verifyhost) {
|
||||
char *snihost = connssl->peer.sni?
|
||||
char *snihost = connssl->peer.sni ?
|
||||
connssl->peer.sni : connssl->peer.hostname;
|
||||
if(wolfSSL_check_domain_name(backend->handle, snihost) == SSL_FAILURE)
|
||||
return CURLE_SSL_CONNECT_ERROR;
|
||||
@ -1762,7 +1762,6 @@ wolfssl_connect_common(struct Curl_cfilter *cf,
|
||||
CURLcode result;
|
||||
struct ssl_connect_data *connssl = cf->ctx;
|
||||
curl_socket_t sockfd = Curl_conn_cf_get_socket(cf, data);
|
||||
int what;
|
||||
|
||||
/* check if the connection has already been established */
|
||||
if(ssl_connection_complete == connssl->state) {
|
||||
@ -1798,14 +1797,12 @@ wolfssl_connect_common(struct Curl_cfilter *cf,
|
||||
|
||||
/* if ssl is expecting something, check if it is available. */
|
||||
if(connssl->io_need) {
|
||||
|
||||
curl_socket_t writefd = (connssl->io_need & CURL_SSL_IO_NEED_SEND)?
|
||||
sockfd:CURL_SOCKET_BAD;
|
||||
curl_socket_t readfd = (connssl->io_need & CURL_SSL_IO_NEED_RECV)?
|
||||
sockfd:CURL_SOCKET_BAD;
|
||||
|
||||
what = Curl_socket_check(readfd, CURL_SOCKET_BAD, writefd,
|
||||
nonblocking?0:timeout_ms);
|
||||
curl_socket_t writefd = (connssl->io_need & CURL_SSL_IO_NEED_SEND) ?
|
||||
sockfd : CURL_SOCKET_BAD;
|
||||
curl_socket_t readfd = (connssl->io_need & CURL_SSL_IO_NEED_RECV) ?
|
||||
sockfd : CURL_SOCKET_BAD;
|
||||
int what = Curl_socket_check(readfd, CURL_SOCKET_BAD, writefd,
|
||||
nonblocking ? 0 : timeout_ms);
|
||||
if(what < 0) {
|
||||
/* fatal error */
|
||||
failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO);
|
||||
|
@ -270,7 +270,7 @@ static CURLcode bool2str(struct dynbuf *store,
|
||||
{
|
||||
if(end - beg != 1)
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
return Curl_dyn_add(store, *beg? "TRUE": "FALSE");
|
||||
return Curl_dyn_add(store, *beg ? "TRUE": "FALSE");
|
||||
}
|
||||
|
||||
/*
|
||||
@ -323,7 +323,7 @@ static CURLcode int2str(struct dynbuf *store,
|
||||
do
|
||||
val = (val << 8) | *(const unsigned char *) beg++;
|
||||
while(beg < end);
|
||||
return Curl_dyn_addf(store, "%s%x", val >= 10? "0x": "", val);
|
||||
return Curl_dyn_addf(store, "%s%x", val >= 10 ? "0x" : "", val);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -551,7 +551,7 @@ static CURLcode GTime2str(struct dynbuf *store,
|
||||
"%.4s-%.2s-%.2s %.2s:%.2s:%c%c%s%.*s%s%.*s",
|
||||
beg, beg + 4, beg + 6,
|
||||
beg + 8, beg + 10, sec1, sec2,
|
||||
fracl? ".": "", (int)fracl, fracp,
|
||||
fracl ? ".": "", (int)fracl, fracp,
|
||||
sep, (int)tzl, tzp);
|
||||
}
|
||||
|
||||
|
14
lib/ws.c
14
lib/ws.c
@ -117,20 +117,20 @@ static void ws_dec_info(struct ws_decoder *dec, struct Curl_easy *data,
|
||||
case 1:
|
||||
CURL_TRC_WRITE(data, "websocket, decoded %s [%s%s]", msg,
|
||||
ws_frame_name_of_op(dec->head[0]),
|
||||
(dec->head[0] & WSBIT_FIN)? "" : " NON-FINAL");
|
||||
(dec->head[0] & WSBIT_FIN) ? "" : " NON-FINAL");
|
||||
break;
|
||||
default:
|
||||
if(dec->head_len < dec->head_total) {
|
||||
CURL_TRC_WRITE(data, "websocket, decoded %s [%s%s](%d/%d)", msg,
|
||||
ws_frame_name_of_op(dec->head[0]),
|
||||
(dec->head[0] & WSBIT_FIN)? "" : " NON-FINAL",
|
||||
(dec->head[0] & WSBIT_FIN) ? "" : " NON-FINAL",
|
||||
dec->head_len, dec->head_total);
|
||||
}
|
||||
else {
|
||||
CURL_TRC_WRITE(data, "websocket, decoded %s [%s%s payload=%"
|
||||
FMT_OFF_T "/%" FMT_OFF_T "]",
|
||||
msg, ws_frame_name_of_op(dec->head[0]),
|
||||
(dec->head[0] & WSBIT_FIN)? "" : " NON-FINAL",
|
||||
(dec->head[0] & WSBIT_FIN) ? "" : " NON-FINAL",
|
||||
dec->payload_offset, dec->payload_len);
|
||||
}
|
||||
break;
|
||||
@ -285,7 +285,7 @@ static CURLcode ws_dec_pass_payload(struct ws_decoder *dec,
|
||||
FMT_OFF_T " remain", nwritten, remain);
|
||||
}
|
||||
|
||||
return remain? CURLE_AGAIN : CURLE_OK;
|
||||
return remain ? CURLE_AGAIN : CURLE_OK;
|
||||
}
|
||||
|
||||
static CURLcode ws_dec_pass(struct ws_decoder *dec,
|
||||
@ -496,7 +496,7 @@ static void ws_enc_info(struct ws_encoder *enc, struct Curl_easy *data,
|
||||
msg, ws_frame_name_of_op(enc->firstbyte),
|
||||
(enc->firstbyte & WSBIT_OPCODE_MASK) == WSBIT_OPCODE_CONT ?
|
||||
" CONT" : "",
|
||||
(enc->firstbyte & WSBIT_FIN)? "" : " NON-FIN",
|
||||
(enc->firstbyte & WSBIT_FIN) ? "" : " NON-FIN",
|
||||
enc->payload_len - enc->payload_remain, enc->payload_len);
|
||||
}
|
||||
|
||||
@ -1021,7 +1021,7 @@ static CURLcode ws_flush(struct Curl_easy *data, struct websocket *ws,
|
||||
while(Curl_bufq_peek(&ws->sendbuf, &out, &outlen)) {
|
||||
if(blocking) {
|
||||
result = ws_send_raw_blocking(data, ws, (char *)out, outlen);
|
||||
n = result? 0 : outlen;
|
||||
n = result ? 0 : outlen;
|
||||
}
|
||||
else if(data->set.connect_only || Curl_is_in_callback(data))
|
||||
result = Curl_senddata(data, out, outlen, &n);
|
||||
@ -1080,7 +1080,7 @@ static CURLcode ws_send_raw_blocking(CURL *data, struct websocket *ws,
|
||||
if(sock == CURL_SOCKET_BAD)
|
||||
return CURLE_SEND_ERROR;
|
||||
ev = Curl_socket_check(CURL_SOCKET_BAD, CURL_SOCKET_BAD, sock,
|
||||
left_ms? left_ms : 500);
|
||||
left_ms ? left_ms : 500);
|
||||
if(ev < 0) {
|
||||
failf(data, "Error while waiting for socket becoming writable");
|
||||
return CURLE_SEND_ERROR;
|
||||
|
@ -127,8 +127,8 @@ convert(char *d, size_t dlen, int dccsid,
|
||||
dccsid = ASCII_CCSID;
|
||||
|
||||
if(sccsid == dccsid) {
|
||||
lslen = slen >= 0? slen: strlen(s) + 1;
|
||||
i = lslen < dlen? lslen: dlen;
|
||||
lslen = slen >= 0 ? slen: strlen(s) + 1;
|
||||
i = lslen < dlen ? lslen: dlen;
|
||||
|
||||
if(s != d && i > 0)
|
||||
memcpy(d, s, i);
|
||||
@ -170,7 +170,7 @@ static char *dynconvert(int dccsid, const char *s, int slen, int sccsid)
|
||||
|
||||
/* Like convert, but the destination is allocated and returned. */
|
||||
|
||||
dlen = (size_t) (slen < 0? strlen(s): slen) + 1;
|
||||
dlen = (size_t) (slen < 0 ? strlen(s): slen) + 1;
|
||||
dlen *= MAX_CONV_EXPANSION; /* Allow some expansion. */
|
||||
d = malloc(dlen);
|
||||
|
||||
@ -294,7 +294,7 @@ curl_easy_escape_ccsid(CURL *handle, const char *string, int length,
|
||||
return (char *) NULL;
|
||||
}
|
||||
|
||||
s = dynconvert(ASCII_CCSID, string, length? length: -1, sccsid);
|
||||
s = dynconvert(ASCII_CCSID, string, length ? length: -1, sccsid);
|
||||
|
||||
if(!s)
|
||||
return (char *) NULL;
|
||||
@ -324,7 +324,7 @@ curl_easy_unescape_ccsid(CURL *handle, const char *string, int length,
|
||||
return (char *) NULL;
|
||||
}
|
||||
|
||||
s = dynconvert(ASCII_CCSID, string, length? length: -1, sccsid);
|
||||
s = dynconvert(ASCII_CCSID, string, length ? length: -1, sccsid);
|
||||
|
||||
if(!s)
|
||||
return (char *) NULL;
|
||||
@ -1046,7 +1046,7 @@ Curl_formget_callback_ccsid(void *arg, const char *buf, size_t len)
|
||||
|
||||
ret = (*p->append)(p->arg, b, l);
|
||||
free(b);
|
||||
return ret == l? len: -1;
|
||||
return ret == l ? len: -1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -640,8 +640,8 @@ Curl_ldap_search_s_a(void *ld, char *base, int scope, char *filter,
|
||||
}
|
||||
|
||||
if(status == LDAP_SUCCESS)
|
||||
status = ldap_search_s(ld, ebase? ebase: "", scope,
|
||||
efilter? efilter: "(objectclass=*)",
|
||||
status = ldap_search_s(ld, ebase ? ebase: "", scope,
|
||||
efilter ? efilter: "(objectclass=*)",
|
||||
eattrs, attrsonly, res);
|
||||
|
||||
if(eattrs) {
|
||||
|
@ -128,7 +128,7 @@ static void showtable(int try, int init, int shift)
|
||||
}
|
||||
}
|
||||
if(!match) {
|
||||
if(!nulls || (nulls>10)) {
|
||||
if(!nulls || (nulls > 10)) {
|
||||
printf("\n ");
|
||||
nulls = 0;
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ static void fly(struct ProgressData *bar, bool moved)
|
||||
if(bar->tick >= 200)
|
||||
bar->tick -= 200;
|
||||
|
||||
bar->bar += (moved?bar->barmove:0);
|
||||
bar->bar += (moved ? bar->barmove : 0);
|
||||
if(bar->bar >= (bar->width - 6)) {
|
||||
bar->barmove = -1;
|
||||
bar->bar = bar->width - 6;
|
||||
|
@ -152,5 +152,5 @@ int tool_readbusy_cb(void *clientp,
|
||||
tool_go_sleep(25);
|
||||
}
|
||||
|
||||
return per->noprogress? 0 : CURL_PROGRESSFUNC_CONTINUE;
|
||||
return per->noprogress ? 0 : CURL_PROGRESSFUNC_CONTINUE;
|
||||
}
|
||||
|
@ -2242,9 +2242,8 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
|
||||
case C_HEAD: /* --head */
|
||||
config->no_body = toggle;
|
||||
config->show_headers = toggle;
|
||||
if(SetHTTPrequest(config,
|
||||
(config->no_body)?TOOL_HTTPREQ_HEAD:TOOL_HTTPREQ_GET,
|
||||
&config->httpreq))
|
||||
if(SetHTTPrequest(config, (config->no_body) ? TOOL_HTTPREQ_HEAD :
|
||||
TOOL_HTTPREQ_GET, &config->httpreq))
|
||||
err = PARAM_BAD_USE;
|
||||
break;
|
||||
case C_REMOTE_HEADER_NAME: /* --remote-header-name */
|
||||
@ -2303,7 +2302,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
|
||||
config->nobuffer = longopt ? !toggle : TRUE;
|
||||
break;
|
||||
case C_REMOTE_NAME_ALL: /* --remote-name-all */
|
||||
config->default_node_flags = toggle?GETOUT_USEREMOTE:0;
|
||||
config->default_node_flags = toggle ? GETOUT_USEREMOTE : 0;
|
||||
break;
|
||||
case C_OUTPUT_DIR: /* --output-dir */
|
||||
err = getstr(&config->output_dir, nextarg, DENY_BLANK);
|
||||
|
@ -813,7 +813,7 @@ static CURLcode url_proto(char **url,
|
||||
curl_url_cleanup(uh);
|
||||
}
|
||||
|
||||
*scheme = (char *) (proto? proto: "???"); /* Never match if not found. */
|
||||
*scheme = (char *) (proto ? proto : "???"); /* Never match if not found. */
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -839,9 +839,8 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
||||
/* Use the postfields data for an HTTP get */
|
||||
httpgetfields = state->httpgetfields = config->postfields;
|
||||
config->postfields = NULL;
|
||||
if(SetHTTPrequest(config,
|
||||
(config->no_body?TOOL_HTTPREQ_HEAD:TOOL_HTTPREQ_GET),
|
||||
&config->httpreq)) {
|
||||
if(SetHTTPrequest(config, (config->no_body ? TOOL_HTTPREQ_HEAD :
|
||||
TOOL_HTTPREQ_GET), &config->httpreq)) {
|
||||
result = CURLE_FAILED_INIT;
|
||||
}
|
||||
}
|
||||
@ -900,8 +899,8 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
||||
if(!config->globoff && infiles && !inglob) {
|
||||
/* Unless explicitly shut off */
|
||||
result = glob_url(&inglob, infiles, &state->infilenum,
|
||||
(!global->silent || global->showerror)?
|
||||
tool_stderr:NULL);
|
||||
(!global->silent || global->showerror) ?
|
||||
tool_stderr : NULL);
|
||||
if(result)
|
||||
break;
|
||||
config->state.inglob = inglob;
|
||||
@ -936,8 +935,8 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
||||
/* Unless explicitly shut off, we expand '{...}' and '[...]'
|
||||
expressions and return total number of URLs in pattern set */
|
||||
result = glob_url(&state->urls, urlnode->url, &state->urlnum,
|
||||
(!global->silent || global->showerror)?
|
||||
tool_stderr:NULL);
|
||||
(!global->silent || global->showerror) ?
|
||||
tool_stderr : NULL);
|
||||
if(result)
|
||||
break;
|
||||
urlnum = state->urlnum;
|
||||
@ -1284,7 +1283,7 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
||||
* If the user has also selected --anyauth or --proxy-anyauth
|
||||
* we should warn them.
|
||||
*/
|
||||
if(config->proxyanyauth || (authbits>1)) {
|
||||
if(config->proxyanyauth || (authbits > 1)) {
|
||||
warnf(global,
|
||||
"Using --anyauth or --proxy-anyauth with upload from stdin"
|
||||
" involves a big risk of it not working. Use a temporary"
|
||||
@ -1433,7 +1432,7 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
||||
|
||||
my_setopt_str(curl, CURLOPT_URL, per->this_url);
|
||||
my_setopt(curl, CURLOPT_NOPROGRESS,
|
||||
global->noprogress || global->silent?1L:0L);
|
||||
global->noprogress || global->silent ? 1L : 0L);
|
||||
if(config->no_body)
|
||||
my_setopt(curl, CURLOPT_NOBODY, 1L);
|
||||
|
||||
@ -1456,7 +1455,8 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
||||
my_setopt_str(curl, CURLOPT_PROXYUSERPWD, config->proxyuserpwd);
|
||||
|
||||
/* new in libcurl 7.3 */
|
||||
my_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, config->proxytunnel?1L:0L);
|
||||
my_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, config->proxytunnel ?
|
||||
1L : 0L);
|
||||
|
||||
/* new in libcurl 7.52.0 */
|
||||
if(config->preproxy)
|
||||
@ -1483,13 +1483,13 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
||||
my_setopt_str(curl, CURLOPT_NOPROXY, config->noproxy);
|
||||
|
||||
my_setopt(curl, CURLOPT_SUPPRESS_CONNECT_HEADERS,
|
||||
config->suppress_connect_headers?1L:0L);
|
||||
config->suppress_connect_headers ? 1L : 0L);
|
||||
|
||||
my_setopt(curl, CURLOPT_FAILONERROR, config->failonerror?1L:0L);
|
||||
my_setopt(curl, CURLOPT_FAILONERROR, config->failonerror ? 1L : 0L);
|
||||
my_setopt(curl, CURLOPT_REQUEST_TARGET, config->request_target);
|
||||
my_setopt(curl, CURLOPT_UPLOAD, per->uploadfile?1L:0L);
|
||||
my_setopt(curl, CURLOPT_DIRLISTONLY, config->dirlistonly?1L:0L);
|
||||
my_setopt(curl, CURLOPT_APPEND, config->ftp_append?1L:0L);
|
||||
my_setopt(curl, CURLOPT_UPLOAD, per->uploadfile ? 1L : 0L);
|
||||
my_setopt(curl, CURLOPT_DIRLISTONLY, config->dirlistonly ? 1L : 0L);
|
||||
my_setopt(curl, CURLOPT_APPEND, config->ftp_append ? 1L : 0L);
|
||||
|
||||
if(config->netrc_opt)
|
||||
my_setopt_enum(curl, CURLOPT_NETRC, (long)CURL_NETRC_OPTIONAL);
|
||||
@ -1501,7 +1501,7 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
||||
if(config->netrc_file)
|
||||
my_setopt_str(curl, CURLOPT_NETRC_FILE, config->netrc_file);
|
||||
|
||||
my_setopt(curl, CURLOPT_TRANSFERTEXT, config->use_ascii?1L:0L);
|
||||
my_setopt(curl, CURLOPT_TRANSFERTEXT, config->use_ascii ? 1L : 0L);
|
||||
if(config->login_options)
|
||||
my_setopt_str(curl, CURLOPT_LOGIN_OPTIONS, config->login_options);
|
||||
my_setopt_str(curl, CURLOPT_USERPWD, config->userpwd);
|
||||
@ -1564,11 +1564,11 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
||||
long postRedir = 0;
|
||||
|
||||
my_setopt(curl, CURLOPT_FOLLOWLOCATION,
|
||||
config->followlocation?1L:0L);
|
||||
config->followlocation ? 1L : 0L);
|
||||
my_setopt(curl, CURLOPT_UNRESTRICTED_AUTH,
|
||||
config->unrestricted_auth?1L:0L);
|
||||
config->unrestricted_auth ? 1L : 0L);
|
||||
my_setopt_str(curl, CURLOPT_AWS_SIGV4, config->aws_sigv4);
|
||||
my_setopt(curl, CURLOPT_AUTOREFERER, config->autoreferer?1L:0L);
|
||||
my_setopt(curl, CURLOPT_AUTOREFERER, config->autoreferer ? 1L : 0L);
|
||||
|
||||
/* new in libcurl 7.36.0 */
|
||||
if(config->proxyheaders) {
|
||||
@ -1972,7 +1972,7 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
||||
my_setopt(curl, CURLOPT_FILETIME, 1L);
|
||||
}
|
||||
|
||||
my_setopt(curl, CURLOPT_CRLF, config->crlf?1L:0L);
|
||||
my_setopt(curl, CURLOPT_CRLF, config->crlf ? 1L : 0L);
|
||||
my_setopt_slist(curl, CURLOPT_QUOTE, config->quote);
|
||||
my_setopt_slist(curl, CURLOPT_POSTQUOTE, config->postquote);
|
||||
my_setopt_slist(curl, CURLOPT_PREQUOTE, config->prequote);
|
||||
@ -2014,7 +2014,8 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
||||
my_setopt_str(curl, CURLOPT_COOKIEJAR, config->cookiejar);
|
||||
|
||||
/* new in libcurl 7.9.7 */
|
||||
my_setopt(curl, CURLOPT_COOKIESESSION, config->cookiesession?1L:0L);
|
||||
my_setopt(curl, CURLOPT_COOKIESESSION, config->cookiesession ?
|
||||
1L : 0L);
|
||||
|
||||
my_setopt_enum(curl, CURLOPT_TIMECONDITION, (long)config->timecond);
|
||||
my_setopt(curl, CURLOPT_TIMEVALUE_LARGE, config->condtime);
|
||||
@ -2118,9 +2119,8 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
||||
/* new in curl 7.10.7, extended in 7.19.4. Modified to use
|
||||
CREATE_DIR_RETRY in 7.49.0 */
|
||||
my_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS,
|
||||
(long)(config->ftp_create_dirs?
|
||||
CURLFTP_CREATE_DIR_RETRY:
|
||||
CURLFTP_CREATE_DIR_NONE));
|
||||
(long)(config->ftp_create_dirs ?
|
||||
CURLFTP_CREATE_DIR_RETRY : CURLFTP_CREATE_DIR_NONE));
|
||||
|
||||
/* new in curl 7.10.8 */
|
||||
if(config->max_filesize)
|
||||
@ -2167,10 +2167,12 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
||||
|
||||
/* curl 7.13.0 */
|
||||
my_setopt_str(curl, CURLOPT_FTP_ACCOUNT, config->ftp_account);
|
||||
my_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, config->ignorecl?1L:0L);
|
||||
my_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, config->ignorecl ?
|
||||
1L : 0L);
|
||||
|
||||
/* curl 7.14.2 */
|
||||
my_setopt(curl, CURLOPT_FTP_SKIP_PASV_IP, config->ftp_skip_ip?1L:0L);
|
||||
my_setopt(curl, CURLOPT_FTP_SKIP_PASV_IP, config->ftp_skip_ip ?
|
||||
1L : 0L);
|
||||
|
||||
/* curl 7.15.1 */
|
||||
if(proto_ftp)
|
||||
|
@ -645,7 +645,7 @@ CURLcode glob_match_url(char **result, char *filename, struct URLGlob *glob)
|
||||
unsigned long i;
|
||||
num--; /* make it zero based */
|
||||
/* find the correct glob entry */
|
||||
for(i = 0; i<glob->size; i++) {
|
||||
for(i = 0; i < glob->size; i++) {
|
||||
if(glob->pattern[i].globindex == (int)num) {
|
||||
pat = &glob->pattern[i];
|
||||
break;
|
||||
|
@ -140,7 +140,7 @@ long tvdiff(struct timeval newer, struct timeval older)
|
||||
int struplocompare(const char *p1, const char *p2)
|
||||
{
|
||||
if(!p1)
|
||||
return p2? -1: 0;
|
||||
return p2 ? -1 : 0;
|
||||
if(!p2)
|
||||
return 1;
|
||||
#ifdef HAVE_STRCASECMP
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user