tests/libtest: follow our code style guidelines better

... checksrc of all test code is pending.
This commit is contained in:
Daniel Stenberg 2016-04-03 11:57:34 +02:00
parent c7e4266a2e
commit 365322b8bc
71 changed files with 675 additions and 654 deletions

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -46,7 +46,8 @@ int test(char *URL)
/* Create fake DNS entries for serverX.example.com for all handles */ /* Create fake DNS entries for serverX.example.com for all handles */
for(i=0; i < NUM_HANDLES; i++) { for(i=0; i < NUM_HANDLES; i++) {
snprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s", i + 1, port, address); snprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s",
i + 1, port, address);
printf("%s\n", dnsentry); printf("%s\n", dnsentry);
slist2 = curl_slist_append(slist, dnsentry); slist2 = curl_slist_append(slist, dnsentry);
if(!slist2) { if(!slist2) {

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -44,7 +44,8 @@ int test(char *URL)
/* Create fake DNS entries for serverX.example.com for all handles */ /* Create fake DNS entries for serverX.example.com for all handles */
for(i=0; i < NUM_URLS; i++) { for(i=0; i < NUM_URLS; i++) {
snprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s", i + 1, port, address); snprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s", i + 1,
port, address);
printf("%s\n", dnsentry); printf("%s\n", dnsentry);
slist2 = curl_slist_append(slist, dnsentry); slist2 = curl_slist_append(slist, dnsentry);
if(!slist2) { if(!slist2) {

View File

@ -49,7 +49,8 @@ int test(char *URL)
return TEST_ERR_MAJOR_BAD; return TEST_ERR_MAJOR_BAD;
} }
snprintf(dnsentry, sizeof(dnsentry), "server.example.curl:%s:%s", port, address); snprintf(dnsentry, sizeof(dnsentry), "server.example.curl:%s:%s",
port, address);
printf("%s\n", dnsentry); printf("%s\n", dnsentry);
slist = curl_slist_append(slist, dnsentry); slist = curl_slist_append(slist, dnsentry);

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -39,7 +39,8 @@
#define sleep(s) Sleep(s * 1000) #define sleep(s) Sleep(s * 1000)
#endif #endif
static int debug_callback(CURL *curl, curl_infotype info, char *msg, size_t len, void *ptr) static int debug_callback(CURL *curl, curl_infotype info, char *msg,
size_t len, void *ptr)
{ {
(void)curl; (void)curl;
(void)ptr; (void)ptr;
@ -121,7 +122,8 @@ int test(char *URL)
int i; int i;
int count = 2; int count = 2;
snprintf(dns_entry, sizeof(dns_entry), "testserver.example.com:%s:%s", port, address); snprintf(dns_entry, sizeof(dns_entry), "testserver.example.com:%s:%s",
port, address);
start_test_timing(); start_test_timing();
@ -130,7 +132,8 @@ int test(char *URL)
for(i = 1; i <= count; i++) { for(i = 1; i <= count; i++) {
char target_url[256]; char target_url[256];
snprintf(target_url, sizeof(target_url), "http://testserver.example.com:%s/%s%04d", port, path, i); snprintf(target_url, sizeof(target_url),
"http://testserver.example.com:%s/%s%04d", port, path, i);
/* second request must succeed like the first one */ /* second request must succeed like the first one */
if((res = do_one_request(multi, target_url, dns_entry))) if((res = do_one_request(multi, target_url, dns_entry)))

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2014, Vijay Panghal, <vpanghal@maginatics.com>, et al. * Copyright (C) 2014, Vijay Panghal, <vpanghal@maginatics.com>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2014, Vijay Panghal, <vpanghal@maginatics.com>, et al. * Copyright (C) 1998 - 2016, Vijay Panghal, <vpanghal@maginatics.com>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2014, Vijay Panghal, <vpanghal@maginatics.com>, et al. * Copyright (C) 1998 - 2016, Vijay Panghal, <vpanghal@maginatics.com>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -49,7 +49,8 @@ int test(char *URL)
/* set the options (I left out a few, you'll get the point anyway) */ /* set the options (I left out a few, you'll get the point anyway) */
curl_easy_setopt(easy, CURLOPT_URL, URL); curl_easy_setopt(easy, CURLOPT_URL, URL);
curl_easy_setopt(easy, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)testDataSize); curl_easy_setopt(easy, CURLOPT_POSTFIELDSIZE_LARGE,
(curl_off_t)testDataSize);
curl_easy_setopt(easy, CURLOPT_POSTFIELDS, testData); curl_easy_setopt(easy, CURLOPT_POSTFIELDS, testData);
/* we start some action by calling perform right away */ /* we start some action by calling perform right away */
@ -87,8 +88,7 @@ int test(char *URL)
/* get file descriptors from the transfers */ /* get file descriptors from the transfers */
mc = curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); mc = curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
if(mc != CURLM_OK) if(mc != CURLM_OK) {
{
fprintf(stderr, "curl_multi_fdset() failed, code %d.\n", mc); fprintf(stderr, "curl_multi_fdset() failed, code %d.\n", mc);
break; break;
} }

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -108,8 +108,8 @@ int test(char *URL)
&time_starttransfer); &time_starttransfer);
curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &time_total); curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &time_total);
/* since the timing will always vary we only compare relative differences /* since the timing will always vary we only compare relative
between these 5 times */ differences between these 5 times */
if(time_namelookup > time_connect) { if(time_namelookup > time_connect) {
fprintf(moo, "namelookup vs connect: %f %f\n", fprintf(moo, "namelookup vs connect: %f %f\n",
time_namelookup, time_connect); time_namelookup, time_connect);

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -56,7 +56,7 @@ int test(char *URL)
hd_src = fopen(libtest_arg2, "rb"); hd_src = fopen(libtest_arg2, "rb");
if(NULL == hd_src) { if(NULL == hd_src) {
error = ERRNO; error = ERRNO;
fprintf(stderr, "fopen() failed with error: %d %s\n", fprintf(stderr, "fopen failed with error: %d %s\n",
error, strerror(error)); error, strerror(error));
fprintf(stderr, "Error opening file: %s\n", libtest_arg2); fprintf(stderr, "Error opening file: %s\n", libtest_arg2);
return TEST_ERR_MAJOR_BAD; /* if this happens things are major weird */ return TEST_ERR_MAJOR_BAD; /* if this happens things are major weird */
@ -87,7 +87,8 @@ int test(char *URL)
} }
/* get a curl handle */ /* get a curl handle */
if ((curl = curl_easy_init()) == NULL) { curl = curl_easy_init();
if(!curl) {
fprintf(stderr, "curl_easy_init() failed\n"); fprintf(stderr, "curl_easy_init() failed\n");
curl_global_cleanup(); curl_global_cleanup();
fclose(hd_src); fclose(hd_src);
@ -96,14 +97,16 @@ int test(char *URL)
/* build a list of commands to pass to libcurl */ /* build a list of commands to pass to libcurl */
if ((hl = curl_slist_append(headerlist, buf_1)) == NULL) { hl = curl_slist_append(headerlist, buf_1);
if(!hl) {
fprintf(stderr, "curl_slist_append() failed\n"); fprintf(stderr, "curl_slist_append() failed\n");
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
curl_global_cleanup(); curl_global_cleanup();
fclose(hd_src); fclose(hd_src);
return TEST_ERR_MAJOR_BAD; return TEST_ERR_MAJOR_BAD;
} }
if ((headerlist = curl_slist_append(hl, buf_2)) == NULL) { headerlist = curl_slist_append(hl, buf_2);
if(!headerlist) {
fprintf(stderr, "curl_slist_append() failed\n"); fprintf(stderr, "curl_slist_append() failed\n");
curl_slist_free_all(hl); curl_slist_free_all(hl);
curl_easy_cleanup(curl); curl_easy_cleanup(curl);

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -40,8 +40,8 @@ struct userdata {
int lock[3]; int lock[3];
/* lock callback */ /* lock callback */
static void my_lock(CURL *handle, curl_lock_data data, curl_lock_access laccess, static void my_lock(CURL *handle, curl_lock_data data,
void *useptr ) curl_lock_access laccess, void *useptr)
{ {
const char *what; const char *what;
struct userdata *user = (struct userdata *)useptr; struct userdata *user = (struct userdata *)useptr;
@ -133,7 +133,8 @@ static void *fire(void *ptr)
CURL *curl; CURL *curl;
int i=0; int i=0;
if ((curl = curl_easy_init()) == NULL) { curl = curl_easy_init();
if(!curl) {
fprintf(stderr, "curl_easy_init() failed\n"); fprintf(stderr, "curl_easy_init() failed\n");
return NULL; return NULL;
} }
@ -147,7 +148,7 @@ static void *fire(void *ptr)
printf("PERFORM\n"); printf("PERFORM\n");
code = curl_easy_perform(curl); code = curl_easy_perform(curl);
if( code != CURLE_OK ) { if(code) {
fprintf(stderr, "perform url '%s' repeat %d failed, curlcode %d\n", fprintf(stderr, "perform url '%s' repeat %d failed, curlcode %d\n",
tdata->url, i, (int)code); tdata->url, i, (int)code);
} }
@ -269,7 +270,6 @@ int test(char *URL)
fire(&tdata); fire(&tdata);
curl_free(tdata.url); curl_free(tdata.url);
} }
@ -322,23 +322,20 @@ int test(char *URL)
test_setopt(curl, CURLOPT_COOKIELIST, "RELOAD"); test_setopt(curl, CURLOPT_COOKIELIST, "RELOAD");
code = curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &cookies); code = curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &cookies);
if ( code != CURLE_OK ) if(code != CURLE_OK) {
{
fprintf(stderr, "curl_easy_getinfo() failed\n"); fprintf(stderr, "curl_easy_getinfo() failed\n");
res = TEST_ERR_MAJOR_BAD; res = TEST_ERR_MAJOR_BAD;
goto test_cleanup; goto test_cleanup;
} }
printf("loaded cookies:\n"); printf("loaded cookies:\n");
if ( !cookies ) if(!cookies) {
{
fprintf(stderr, " reloading cookies from '%s' failed\n", JAR); fprintf(stderr, " reloading cookies from '%s' failed\n", JAR);
res = TEST_ERR_MAJOR_BAD; res = TEST_ERR_MAJOR_BAD;
goto test_cleanup; goto test_cleanup;
} }
printf("-----------------\n"); printf("-----------------\n");
next_cookie = cookies; next_cookie = cookies;
while ( next_cookie ) while(next_cookie) {
{
printf(" %s\n", next_cookie->data); printf(" %s\n", next_cookie->data);
next_cookie = next_cookie->next; next_cookie = next_cookie->next;
} }
@ -348,11 +345,11 @@ int test(char *URL)
/* try to free share, expect to fail because share is in use*/ /* try to free share, expect to fail because share is in use*/
printf("try SHARE_CLEANUP...\n"); printf("try SHARE_CLEANUP...\n");
scode = curl_share_cleanup(share); scode = curl_share_cleanup(share);
if ( scode==CURLSHE_OK ) if(scode==CURLSHE_OK ) {
{
fprintf(stderr, "curl_share_cleanup succeed but error expected\n"); fprintf(stderr, "curl_share_cleanup succeed but error expected\n");
share = NULL; share = NULL;
} else { }
else {
printf("SHARE_CLEANUP failed, correct\n"); printf("SHARE_CLEANUP failed, correct\n");
} }

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -59,7 +59,8 @@ static void store_errmsg(const char *msg, int err)
if(!err) if(!err)
snprintf(msgbuff, sizeof(msgbuff), "%s", msg); snprintf(msgbuff, sizeof(msgbuff), "%s", msg);
else else
snprintf(msgbuff, sizeof(msgbuff), "%s, errno %d, %s", msg, err, strerror(err)); snprintf(msgbuff, sizeof(msgbuff), "%s, errno %d, %s", msg,
err, strerror(err));
} }
static void close_file_descriptors(void) static void close_file_descriptors(void)
@ -83,9 +84,9 @@ static int fopen_works(void)
fpa[i] = NULL; fpa[i] = NULL;
} }
for(i = 0; i < 3; i++) { for(i = 0; i < 3; i++) {
fpa[i] = fopen(DEV_NULL, "r"); fpa[i] = fopen(DEV_NULL, FOPEN_READTEXT);
if(fpa[i] == NULL) { if(fpa[i] == NULL) {
store_errmsg("fopen() failed", ERRNO); store_errmsg("fopen failed", ERRNO);
fprintf(stderr, "%s\n", msgbuff); fprintf(stderr, "%s\n", msgbuff);
ret = 0; ret = 0;
break; break;
@ -350,7 +351,8 @@ static int rlimit(int keep_open)
fprintf(stderr, "%s\n", strbuff); fprintf(stderr, "%s\n", strbuff);
snprintf(strbuff1, sizeof(strbuff), fmt, num_open.rlim_cur); snprintf(strbuff1, sizeof(strbuff), fmt, num_open.rlim_cur);
snprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s", strbuff1); snprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s",
strbuff1);
fprintf(stderr, "%s\n", strbuff); fprintf(stderr, "%s\n", strbuff);
num_open.rlim_max = NUM_NEEDED; num_open.rlim_max = NUM_NEEDED;
@ -434,11 +436,11 @@ static int rlimit(int keep_open)
if(!fopen_works()) { if(!fopen_works()) {
snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max); snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
snprintf(strbuff, sizeof(strbuff), snprintf(strbuff, sizeof(strbuff),
"stdio fopen() fails with %s fds open()", "fopen fails with %s fds open()",
strbuff1); strbuff1);
fprintf(stderr, "%s\n", msgbuff); fprintf(stderr, "%s\n", msgbuff);
snprintf(strbuff, sizeof(strbuff), snprintf(strbuff, sizeof(strbuff),
"stdio fopen() fails with lots of fds open()"); "fopen fails with lots of fds open()");
store_errmsg(strbuff, 0); store_errmsg(strbuff, 0);
close_file_descriptors(); close_file_descriptors();
free(memchunk); free(memchunk);

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -56,7 +56,7 @@ int test(char *URL)
hd_src = fopen(libtest_arg2, "rb"); hd_src = fopen(libtest_arg2, "rb");
if(NULL == hd_src) { if(NULL == hd_src) {
error = ERRNO; error = ERRNO;
fprintf(stderr, "fopen() failed with error: %d (%s)\n", fprintf(stderr, "fopen failed with error: %d (%s)\n",
error, strerror(error)); error, strerror(error));
fprintf(stderr, "Error opening file: (%s)\n", libtest_arg2); fprintf(stderr, "Error opening file: (%s)\n", libtest_arg2);
return TEST_ERR_FOPEN; return TEST_ERR_FOPEN;

View File

@ -85,9 +85,9 @@ static int fopen_works(void)
fpa[i] = NULL; fpa[i] = NULL;
} }
for(i = 0; i < 3; i++) { for(i = 0; i < 3; i++) {
fpa[i] = fopen(DEV_NULL, "r"); fpa[i] = fopen(DEV_NULL, FOPEN_READTEXT);
if(fpa[i] == NULL) { if(fpa[i] == NULL) {
store_errmsg("fopen() failed", ERRNO); store_errmsg("fopen failed", ERRNO);
fprintf(stderr, "%s\n", msgbuff); fprintf(stderr, "%s\n", msgbuff);
ret = 0; ret = 0;
break; break;
@ -345,14 +345,16 @@ static int rlimit(int keep_open)
fprintf(stderr, "%s\n", strbuff); fprintf(stderr, "%s\n", strbuff);
snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur); snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
snprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s", strbuff1); snprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s",
strbuff1);
fprintf(stderr, "%s\n", strbuff); fprintf(stderr, "%s\n", strbuff);
num_open.rlim_max = num_open.rlim_cur - SAFETY_MARGIN; num_open.rlim_max = num_open.rlim_cur - SAFETY_MARGIN;
num_open.rlim_cur -= num_open.rlim_max; num_open.rlim_cur -= num_open.rlim_max;
snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur); snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
snprintf(strbuff, sizeof(strbuff), "closing %s file descriptors", strbuff1); snprintf(strbuff, sizeof(strbuff), "closing %s file descriptors",
strbuff1);
fprintf(stderr, "%s\n", strbuff); fprintf(stderr, "%s\n", strbuff);
for(num_open.rlim_cur = num_open.rlim_max; for(num_open.rlim_cur = num_open.rlim_max;
@ -399,7 +401,8 @@ static int rlimit(int keep_open)
num_open.rlim_cur = FD_SETSIZE - SAFETY_MARGIN; num_open.rlim_cur = FD_SETSIZE - SAFETY_MARGIN;
if(num_open.rlim_max > num_open.rlim_cur) { if(num_open.rlim_max > num_open.rlim_cur) {
snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d", FD_SETSIZE); snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
FD_SETSIZE);
store_errmsg(strbuff, 0); store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff); fprintf(stderr, "%s\n", msgbuff);
close_file_descriptors(); close_file_descriptors();
@ -413,7 +416,8 @@ static int rlimit(int keep_open)
rl.rlim_cur++) { rl.rlim_cur++) {
if((fd[rl.rlim_cur] > 0) && if((fd[rl.rlim_cur] > 0) &&
((unsigned int)fd[rl.rlim_cur] > num_open.rlim_cur)) { ((unsigned int)fd[rl.rlim_cur] > num_open.rlim_cur)) {
snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d", FD_SETSIZE); snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
FD_SETSIZE);
store_errmsg(strbuff, 0); store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff); fprintf(stderr, "%s\n", msgbuff);
close_file_descriptors(); close_file_descriptors();
@ -435,10 +439,10 @@ static int rlimit(int keep_open)
if(!fopen_works()) { if(!fopen_works()) {
snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max); snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
snprintf(strbuff, sizeof(strbuff), "stdio fopen() fails with %s fds open()", snprintf(strbuff, sizeof(strbuff), "fopen fails with %s fds open",
strbuff1); strbuff1);
fprintf(stderr, "%s\n", msgbuff); fprintf(stderr, "%s\n", msgbuff);
snprintf(strbuff, sizeof(strbuff), "stdio fopen() fails with lots of fds open()"); snprintf(strbuff, sizeof(strbuff), "fopen fails with lots of fds open");
store_errmsg(strbuff, 0); store_errmsg(strbuff, 0);
close_file_descriptors(); close_file_descriptors();
free(memchunk); free(memchunk);

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -58,13 +58,12 @@ int test(char *URL)
* even though no directories are stored in the ftpconn->dirs array (after a * even though no directories are stored in the ftpconn->dirs array (after a
* call to freedirs). * call to freedirs).
*/ */
newURL = malloc(strlen(URL) + 3); newURL = aprintf("%s./", URL);
if(newURL == NULL) { if(newURL == NULL) {
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
curl_global_cleanup(); curl_global_cleanup();
return TEST_ERR_MAJOR_BAD; return TEST_ERR_MAJOR_BAD;
} }
newURL = strcat(strcpy(newURL, URL), "./");
slist = curl_slist_append (NULL, "SYST"); slist = curl_slist_append (NULL, "SYST");
if(slist == NULL) { if(slist == NULL) {

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -48,7 +48,7 @@ int test(char *URL)
hd_src = fopen(libtest_arg2, "rb"); hd_src = fopen(libtest_arg2, "rb");
if(NULL == hd_src) { if(NULL == hd_src) {
error = ERRNO; error = ERRNO;
fprintf(stderr, "fopen() failed with error: %d %s\n", fprintf(stderr, "fopen failed with error: %d %s\n",
error, strerror(error)); error, strerror(error));
fprintf(stderr, "Error opening file: %s\n", libtest_arg2); fprintf(stderr, "Error opening file: %s\n", libtest_arg2);
return -2; /* if this happens things are major weird */ return -2; /* if this happens things are major weird */

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2012, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2014, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -108,7 +108,8 @@ int test(char *URL)
test_setopt(curl, CURLOPT_IOCTLDATA, &counter); test_setopt(curl, CURLOPT_IOCTLDATA, &counter);
test_setopt(curl, CURLOPT_READFUNCTION, readcallback); test_setopt(curl, CURLOPT_READFUNCTION, readcallback);
test_setopt(curl, CURLOPT_READDATA, &counter); test_setopt(curl, CURLOPT_READDATA, &counter);
/* We CANNOT do the POST fine without setting the size (or choose chunked)! */ /* We CANNOT do the POST fine without setting the size (or choose
chunked)! */
test_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)strlen(UPLOADTHIS)); test_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)strlen(UPLOADTHIS));
#endif #endif
test_setopt(curl, CURLOPT_POST, 1L); test_setopt(curl, CURLOPT_POST, 1L);

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -121,12 +121,14 @@ int my_trace(CURL *handle, curl_infotype type,
static size_t current_offset = 0; static size_t current_offset = 0;
static char databuf[70000]; /* MUST be more than 64k OR MAX_INITIAL_POST_SIZE */ static char databuf[70000]; /* MUST be more than 64k OR
MAX_INITIAL_POST_SIZE */
static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream) static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
{ {
size_t amount = nmemb * size; /* Total bytes curl wants */ size_t amount = nmemb * size; /* Total bytes curl wants */
size_t available = sizeof(databuf) - current_offset; /* What we have to give */ size_t available = sizeof(databuf) - current_offset; /* What we have to
give */
size_t given = amount < available ? amount : available; /* What is given */ size_t given = amount < available ? amount : available; /* What is given */
(void)stream; (void)stream;
memcpy(ptr, databuf + current_offset, given); memcpy(ptr, databuf + current_offset, given);
@ -135,7 +137,8 @@ static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
} }
static size_t write_callback(void *ptr, size_t size, size_t nmemb, void *stream) static size_t write_callback(void *ptr, size_t size, size_t nmemb,
void *stream)
{ {
int amount = curlx_uztosi(size * nmemb); int amount = curlx_uztosi(size * nmemb);
printf("%.*s", amount, (char *)ptr); printf("%.*s", amount, (char *)ptr);
@ -206,7 +209,8 @@ int test(char *URL)
test_setopt(curl, CURLOPT_URL, URL); test_setopt(curl, CURLOPT_URL, URL);
/* Accept any auth. But for this bug configure proxy with DIGEST, basic might work too, not NTLM */ /* Accept any auth. But for this bug configure proxy with DIGEST, basic
might work too, not NTLM */
test_setopt(curl, CURLOPT_PROXYAUTH, (long)CURLAUTH_ANY); test_setopt(curl, CURLOPT_PROXYAUTH, (long)CURLAUTH_ANY);
res = curl_easy_perform(curl); res = curl_easy_perform(curl);

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -96,7 +96,8 @@ int test(char *URL)
easy_setopt(curl, CURLOPT_IOCTLDATA, &counter); easy_setopt(curl, CURLOPT_IOCTLDATA, &counter);
easy_setopt(curl, CURLOPT_READFUNCTION, readcallback); easy_setopt(curl, CURLOPT_READFUNCTION, readcallback);
easy_setopt(curl, CURLOPT_READDATA, &counter); easy_setopt(curl, CURLOPT_READDATA, &counter);
/* We CANNOT do the POST fine without setting the size (or choose chunked)! */ /* We CANNOT do the POST fine without setting the size (or choose
chunked)! */
easy_setopt(curl, CURLOPT_POSTFIELDSIZE, strlen(UPLOADTHIS)); easy_setopt(curl, CURLOPT_POSTFIELDSIZE, strlen(UPLOADTHIS));
easy_setopt(curl, CURLOPT_POST, 1L); easy_setopt(curl, CURLOPT_POST, 1L);

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2014, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2013, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -131,7 +131,8 @@ int test(char *URL)
} }
test_setopt(curl, CURLOPT_RTSPHEADER, custom_headers); test_setopt(curl, CURLOPT_RTSPHEADER, custom_headers);
test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_ANNOUNCE); test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_ANNOUNCE);
test_setopt(curl, CURLOPT_POSTFIELDS, "postyfield=postystuff&project=curl\n"); test_setopt(curl, CURLOPT_POSTFIELDS,
"postyfield=postystuff&project=curl\n");
res = curl_easy_perform(curl); res = curl_easy_perform(curl);
if(res) if(res)

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -86,7 +86,8 @@ int test(char *URL)
stream_uri = NULL; stream_uri = NULL;
test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_SETUP); test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_SETUP);
test_setopt(curl, CURLOPT_RTSP_TRANSPORT, "Fake/NotReal/JustATest;foo=baz"); test_setopt(curl, CURLOPT_RTSP_TRANSPORT,
"Fake/NotReal/JustATest;foo=baz");
res = curl_easy_perform(curl); res = curl_easy_perform(curl);
if(res) if(res)
goto test_cleanup; goto test_cleanup;

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2013, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2013, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -75,7 +75,8 @@ static size_t rtp_write(void *ptr, size_t size, size_t nmemb, void *stream) {
printf("RTP PAYLOAD CORRUPTED [%s]\n", data + i); printf("RTP PAYLOAD CORRUPTED [%s]\n", data + i);
return failure; return failure;
} }
} else { }
else {
if(memcmp(RTP_DATA, data + i, message_size - i) != 0) { if(memcmp(RTP_DATA, data + i, message_size - i) != 0) {
printf("RTP PAYLOAD END CORRUPTED (%d), [%s]\n", printf("RTP PAYLOAD END CORRUPTED (%d), [%s]\n",
message_size - i, data + i); message_size - i, data + i);

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2012, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -74,7 +74,8 @@ long chunk_bgn(const struct curl_fileinfo *finfo, void *ptr, int remains)
} }
if(finfo->filetype == CURLFILETYPE_FILE) { if(finfo->filetype == CURLFILETYPE_FILE) {
ch_d->print_content = 1; ch_d->print_content = 1;
printf("Content:\n-------------------------------------------------------------\n"); printf("Content:\n-----------------------"
"--------------------------------------\n");
} }
if(strcmp(finfo->filename, "someothertext.txt") == 0) { if(strcmp(finfo->filename, "someothertext.txt") == 0) {
printf("# THIS CONTENT WAS SKIPPED IN CHUNK_BGN CALLBACK #\n"); printf("# THIS CONTENT WAS SKIPPED IN CHUNK_BGN CALLBACK #\n");

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -28,7 +28,8 @@ static char data[]="this is a short string.\n";
static size_t data_size = sizeof(data) / sizeof(char); static size_t data_size = sizeof(data) / sizeof(char);
static int progress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) static int progress_callback(void *clientp, double dltotal, double dlnow,
double ultotal, double ulnow)
{ {
FILE *moo = fopen(libtest_arg2, "wb"); FILE *moo = fopen(libtest_arg2, "wb");
@ -40,7 +41,8 @@ static int progress_callback(void *clientp, double dltotal, double dlnow, double
if((size_t)ultotal == data_size && (size_t)ulnow == data_size) if((size_t)ultotal == data_size && (size_t)ulnow == data_size)
fprintf(moo, "PASSED, UL data matched data size\n"); fprintf(moo, "PASSED, UL data matched data size\n");
else else
fprintf(moo, "Progress callback called with UL %f out of %f\n", ulnow, ultotal); fprintf(moo, "Progress callback called with UL %f out of %f\n",
ulnow, ultotal);
fclose(moo); fclose(moo);
} }
return 0; return 0;

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2012, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -300,8 +300,7 @@ int test(char *URL)
multi_add_handle(m, curl); multi_add_handle(m, curl);
while (!checkForCompletion(m, &success)) while(!checkForCompletion(m, &success)) {
{
fd_set readSet, writeSet; fd_set readSet, writeSet;
curl_socket_t maxFd = 0; curl_socket_t maxFd = 0;
struct timeval tv = {10, 0}; struct timeval tv = {10, 0};
@ -311,14 +310,12 @@ int test(char *URL)
updateFdSet(&sockets.read, &readSet, &maxFd); updateFdSet(&sockets.read, &readSet, &maxFd);
updateFdSet(&sockets.write, &writeSet, &maxFd); updateFdSet(&sockets.write, &writeSet, &maxFd);
if (timeout.tv_sec != -1) if(timeout.tv_sec != -1) {
{
int usTimeout = getMicroSecondTimeout(&timeout); int usTimeout = getMicroSecondTimeout(&timeout);
tv.tv_sec = usTimeout / 1000000; tv.tv_sec = usTimeout / 1000000;
tv.tv_usec = usTimeout % 1000000; tv.tv_usec = usTimeout % 1000000;
} }
else if (maxFd <= 0) else if(maxFd <= 0) {
{
tv.tv_sec = 0; tv.tv_sec = 0;
tv.tv_usec = 100000; tv.tv_usec = 100000;
} }
@ -329,8 +326,7 @@ int test(char *URL)
checkFdSet(m, &sockets.read, &readSet, CURL_CSELECT_IN, "read"); checkFdSet(m, &sockets.read, &readSet, CURL_CSELECT_IN, "read");
checkFdSet(m, &sockets.write, &writeSet, CURL_CSELECT_OUT, "write"); checkFdSet(m, &sockets.write, &writeSet, CURL_CSELECT_OUT, "write");
if (timeout.tv_sec != -1 && getMicroSecondTimeout(&timeout) == 0) if(timeout.tv_sec != -1 && getMicroSecondTimeout(&timeout) == 0) {
{
/* Curl's timer has elapsed. */ /* Curl's timer has elapsed. */
notifyCurl(m, CURL_SOCKET_TIMEOUT, 0, "timeout"); notifyCurl(m, CURL_SOCKET_TIMEOUT, 0, "timeout");
} }
@ -338,8 +334,7 @@ int test(char *URL)
abort_on_test_timeout(); abort_on_test_timeout();
} }
if (!success) if(!success) {
{
fprintf(stderr, "Error uploading file.\n"); fprintf(stderr, "Error uploading file.\n");
res = TEST_ERR_MAJOR_BAD; res = TEST_ERR_MAJOR_BAD;
} }

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -36,8 +36,8 @@ struct userdata {
}; };
/* lock callback */ /* lock callback */
static void my_lock(CURL *handle, curl_lock_data data, curl_lock_access laccess, static void my_lock(CURL *handle, curl_lock_data data,
void *useptr ) curl_lock_access laccess, void *useptr)
{ {
const char *what; const char *what;
struct userdata *user = (struct userdata *)useptr; struct userdata *user = (struct userdata *)useptr;
@ -168,7 +168,8 @@ int test(char *URL)
} }
if(CURLSHE_OK == scode ) { if(CURLSHE_OK == scode ) {
printf( "CURL_LOCK_DATA_SSL_SESSION\n" ); printf( "CURL_LOCK_DATA_SSL_SESSION\n" );
scode = curl_share_setopt( share, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION); scode = curl_share_setopt( share, CURLSHOPT_SHARE,
CURL_LOCK_DATA_SSL_SESSION);
} }
if(CURLSHE_OK != scode ) { if(CURLSHE_OK != scode ) {
@ -214,11 +215,11 @@ int test(char *URL)
/* try to free share, expect to fail because share is in use*/ /* try to free share, expect to fail because share is in use*/
printf( "try SHARE_CLEANUP...\n" ); printf( "try SHARE_CLEANUP...\n" );
scode = curl_share_cleanup( share ); scode = curl_share_cleanup( share );
if ( scode==CURLSHE_OK ) if(scode==CURLSHE_OK) {
{
fprintf(stderr, "curl_share_cleanup succeed but error expected\n"); fprintf(stderr, "curl_share_cleanup succeed but error expected\n");
share = NULL; share = NULL;
} else { }
else {
printf( "SHARE_CLEANUP failed, correct\n" ); printf( "SHARE_CLEANUP failed, correct\n" );
} }

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2012, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -114,7 +114,8 @@ int test(char *URL)
multi_timeout(multi, &timeout); multi_timeout(multi, &timeout);
/* At this point, timeout is guaranteed to be greater or equal than -1. */ /* At this point, timeout is guaranteed to be greater or equal than
-1. */
if(timeout != -1L) { if(timeout != -1L) {
int itimeout = (timeout > (long)INT_MAX) ? INT_MAX : (int)timeout; int itimeout = (timeout > (long)INT_MAX) ? INT_MAX : (int)timeout;

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2012, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2012, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms

View File

@ -148,7 +148,8 @@ int test(char *url)
if(num_handles % 3 == 2) { if(num_handles % 3 == 2) {
snprintf(full_url, urllen, "%s0200", url); snprintf(full_url, urllen, "%s0200", url);
easy_setopt(easy[num_handles], CURLOPT_HTTPAUTH, CURLAUTH_NTLM); easy_setopt(easy[num_handles], CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
} else { }
else {
snprintf(full_url, urllen, "%s0100", url); snprintf(full_url, urllen, "%s0100", url);
easy_setopt(easy[num_handles], CURLOPT_HTTPAUTH, CURLAUTH_BASIC); easy_setopt(easy[num_handles], CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
} }