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