http
</server>
<tool>
-lib%TESTNUMBER
+lib1514
</tool>
<name>
HTTP 1.0 POST with read callback and unknown data size
</server>
# tool is what to use instead of 'curl'
<tool>
-lib%TESTNUMBER
+lib1518
</tool>
<name>
CURLFOLLOW_OBEYCODE with custom POST method, 302 => GET
</name>
<command>
-http://%HOSTIP:%HTTPPORT/%TESTNUMBER 1571
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER
</command>
</client>
CURLFOLLOW_OBEYCODE with custom POST method, 308 => custom
</name>
<command>
-http://%HOSTIP:%HTTPPORT/%TESTNUMBER 1571
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER
</command>
</client>
CURLFOLLOW_OBEYCODE with custom GET method, 301 => custom
</name>
<command>
-http://%HOSTIP:%HTTPPORT/%TESTNUMBER 1573
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER
</command>
</client>
CURLFOLLOW_FIRSTONLY with custom GET method, 301 => GET
</name>
<command>
-http://%HOSTIP:%HTTPPORT/%TESTNUMBER 1574
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER
</command>
</client>
CURLFOLLOW_FIRSTONLY with custom POST method, 308 => POST
</name>
<command>
-http://%HOSTIP:%HTTPPORT/%TESTNUMBER 1575
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER
</command>
</client>
CURLFOLLOW_OBEYCODE with custom PUT method, 302 => custom
</name>
<command>
-http://%HOSTIP:%HTTPPORT/%TESTNUMBER 1576
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER
</command>
</client>
CURLFOLLOW_FIRSTONLY with custom PUT method, 302 => PUT
</name>
<command>
-http://%HOSTIP:%HTTPPORT/%TESTNUMBER %TESTNUMBER
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER
</command>
</client>
CURLFOLLOW_OBEYCODE with custom POST301 method, 301 => custom
</name>
<command>
-http://%HOSTIP:%HTTPPORT/%TESTNUMBER 1581
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER
</command>
</client>
MQTT PUBLISH with CURLOPT_POST set (no payload)
</name>
<tool>
-lib%TESTNUMBER
+lib1916
</tool>
<command option="binary-trace">
"mqtt://%HOSTIP:%MQTTPORT/%20"
curl_easy_header with redirect but get headers from first request
</name>
<tool>
-lib%TESTNUMBER
+lib1940
</tool>
<command>
ftp
</server>
<tool>
-lib%TESTNUMBER
+lib526
</tool>
<name>
FTP RETR same file using different handles but same connection
ftp
</server>
<tool>
-lib%TESTNUMBER
+lib525
</tool>
<name>
FTP PORT upload using multi interface (weird cleanup function sequence)
ftp
</server>
<tool>
-lib%TESTNUMBER
+lib526
</tool>
<name>
FTP RETR same file using reset handles between each transfer
</server>
# tool is what to use instead of 'curl'
<tool>
-lib%TESTNUMBER
+lib544
</tool>
<name>
</server>
# tool to use
<tool>
-lib%TESTNUMBER
+lib547
</tool>
<features>
NTLM
</features>
# tool is what to use instead of 'curl'
<tool>
-lib%TESTNUMBER
+lib510
</tool>
<name>
</server>
# tool to invoke
<tool>
-lib%TESTNUMBER
+lib589
</tool>
<name>
</features>
# tool is what to use instead of 'curl'
<tool>
-lib%TESTNUMBER
+lib500
</tool>
<name>
ftp
</server>
<tool>
-lib585
+lib500
</tool>
<name>
FTP and open/close socket callbacks
</server>
# tool is what to use instead of 'curl'
<tool>
-lib%TESTNUMBER
+lib554
</tool>
<name>
</server>
# tool is what to use instead of 'curl'
<tool>
-lib585
+lib500
</tool>
<name>
</server>
# tool is what to use instead of 'curl'
<tool>
-lib585
+lib500
</tool>
<name>
</server>
# tool is what to use instead of 'curl'
<tool>
-lib%TESTNUMBER
+lib643
</tool>
<name>
</server>
# tool is what to use instead of 'curl'
<tool>
-lib%TESTNUMBER
+lib670
</tool>
<name>
</server>
# tool is what to use instead of 'curl'
<tool>
-lib%TESTNUMBER
+lib670
</tool>
<name>
</server>
# tool is what to use instead of 'curl'
<tool>
-lib%TESTNUMBER
+lib670
</tool>
<name>
http
</server>
<tool>
-lib%TESTNUMBER
+lib556
</tool>
<name>
CONNECT_ONLY and doing a second curl_easy_perform
LIBTESTPROGS = libauthretry libntlmconnect libprereq \
lib500 lib501 lib502 lib503 lib504 lib505 lib506 lib507 lib508 lib509 \
lib510 lib511 lib512 lib513 lib514 lib515 lib516 lib517 lib518 lib519 \
- lib520 lib521 lib523 lib524 lib525 lib526 lib527 lib529 lib530 lib532 \
+ lib520 lib521 lib523 lib524 lib525 lib526 lib530 \
lib533 lib536 lib537 lib539 lib540 lib541 lib542 lib543 \
- lib544 lib545 \
- lib547 lib548 lib549 lib552 lib553 lib554 lib555 lib556 lib557 lib558 \
- lib559 lib560 lib562 lib564 lib565 lib566 lib567 lib568 lib569 lib570 \
+ lib544 \
+ lib547 lib549 lib552 lib553 lib554 lib555 lib556 lib557 lib558 \
+ lib559 lib560 lib562 lib564 lib566 lib567 lib568 lib569 lib570 \
lib571 lib572 lib573 lib574 lib575 lib576 lib578 lib579 lib582 \
- lib583 lib584 lib585 lib586 lib587 lib589 lib590 lib591 lib597 lib598 \
+ lib583 lib586 lib589 lib590 lib591 lib597 lib598 \
lib599 \
- lib643 lib645 lib650 lib651 lib652 lib653 lib654 lib655 lib658 \
+ lib643 lib650 lib651 lib652 lib653 lib654 lib655 lib658 \
lib659 lib661 lib666 lib667 lib668 \
- lib670 lib671 lib672 lib673 lib674 lib676 lib677 lib678 lib694 lib695 \
- lib696 \
+ lib670 lib674 lib676 lib677 lib678 lib694 lib695 \
lib751 \
lib1156 \
lib1301 \
lib1509 lib1510 lib1511 lib1512 lib1513 lib1514 lib1515 lib1517 \
lib1518 lib1520 lib1521 lib1522 lib1523 \
lib1525 lib1526 lib1527 lib1528 lib1529 lib1530 lib1531 lib1532 lib1533 \
- lib1534 lib1535 lib1536 lib1537 lib1538 lib1539 \
- lib1540 lib1541 lib1542 lib1543 lib1545 \
+ lib1534 lib1535 lib1536 lib1537 lib1538 \
+ lib1540 lib1541 lib1542 lib1545 \
lib1550 lib1551 lib1552 lib1553 lib1554 lib1555 lib1556 lib1557 \
lib1558 lib1559 lib1560 lib1564 lib1565 lib1567 lib1568 lib1569 lib1571 \
lib1576 \
\
lib1900 lib1901 \
lib1903 lib1905 lib1906 lib1907 lib1908 lib1910 lib1911 lib1912 lib1913 \
- lib1915 lib1916 lib1917 lib1918 lib1919 \
+ lib1915 lib1916 lib1918 lib1919 \
lib1933 lib1934 lib1935 lib1936 lib1937 lib1938 lib1939 lib1940 \
- lib1945 lib1946 lib1947 lib1948 lib1955 lib1956 lib1957 lib1958 lib1959 \
+ lib1945 lib1947 lib1948 lib1955 lib1956 lib1957 lib1958 lib1959 \
lib1960 lib1964 \
lib1970 lib1971 lib1972 lib1973 lib1974 lib1975 lib1977 lib1978 \
lib2301 lib2302 lib2304 lib2306 lib2308 lib2309 \
lib526_SOURCES = lib526.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib526_LDADD = $(TESTUTIL_LIBS)
-lib526_CPPFLAGS = $(AM_CPPFLAGS) -DLIB526
-
-lib527_SOURCES = lib526.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib527_LDADD = $(TESTUTIL_LIBS)
-lib527_CPPFLAGS = $(AM_CPPFLAGS) -DLIB527
-
-lib529_SOURCES = lib525.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) $(MULTIBYTE)
-lib529_LDADD = $(TESTUTIL_LIBS)
-lib529_CPPFLAGS = $(AM_CPPFLAGS) -DLIB529
lib530_SOURCES = lib530.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib530_LDADD = $(TESTUTIL_LIBS)
-lib532_SOURCES = lib526.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib532_LDADD = $(TESTUTIL_LIBS)
-lib532_CPPFLAGS = $(AM_CPPFLAGS) -DLIB532
-
lib533_SOURCES = lib533.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib533_LDADD = $(TESTUTIL_LIBS)
lib544_SOURCES = lib544.c $(SUPPORTFILES)
-lib545_SOURCES = lib544.c $(SUPPORTFILES)
-lib545_CPPFLAGS = $(AM_CPPFLAGS) -DLIB545
-
lib547_SOURCES = lib547.c $(SUPPORTFILES)
-lib548_SOURCES = lib547.c $(SUPPORTFILES)
-lib548_CPPFLAGS = $(AM_CPPFLAGS) -DLIB548
-
lib549_SOURCES = lib549.c $(SUPPORTFILES)
lib552_SOURCES = lib552.c $(SUPPORTFILES) $(WARNLESS)
lib564_SOURCES = lib564.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib564_LDADD = $(TESTUTIL_LIBS)
-lib565_SOURCES = lib510.c $(SUPPORTFILES)
-lib565_CPPFLAGS = $(AM_CPPFLAGS) -DLIB565
-
lib566_SOURCES = lib566.c $(SUPPORTFILES) $(MULTIBYTE)
lib567_SOURCES = lib567.c $(SUPPORTFILES)
lib583_SOURCES = lib583.c $(SUPPORTFILES)
-lib584_SOURCES = lib589.c $(SUPPORTFILES)
-lib584_CPPFLAGS = $(AM_CPPFLAGS) -DLIB584
-
-lib585_SOURCES = lib500.c $(SUPPORTFILES) $(TESTUTIL) $(TSTTRACE) $(MULTIBYTE)
-lib585_LDADD = $(TESTUTIL_LIBS)
-lib585_CPPFLAGS = $(AM_CPPFLAGS) -DLIB585
-
lib586_SOURCES = lib586.c $(SUPPORTFILES)
-lib587_SOURCES = lib587.c $(SUPPORTFILES)
-
lib589_SOURCES = lib589.c $(SUPPORTFILES)
lib590_SOURCES = lib590.c $(SUPPORTFILES)
lib643_SOURCES = lib643.c $(SUPPORTFILES)
-lib645_SOURCES = lib645.c $(SUPPORTFILES)
-
lib650_SOURCES = lib650.c $(SUPPORTFILES)
lib651_SOURCES = lib651.c $(SUPPORTFILES)
lib670_SOURCES = lib670.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib670_LDADD = $(TESTUTIL_LIBS)
-lib670_CPPFLAGS = $(AM_CPPFLAGS) -DLIB670
-
-lib671_SOURCES = lib670.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib671_LDADD = $(TESTUTIL_LIBS)
-lib671_CPPFLAGS = $(AM_CPPFLAGS) -DLIB671
-
-lib672_SOURCES = lib670.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib672_LDADD = $(TESTUTIL_LIBS)
-lib672_CPPFLAGS = $(AM_CPPFLAGS) -DLIB672
-
-lib673_SOURCES = lib670.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib673_LDADD = $(TESTUTIL_LIBS)
lib674_SOURCES = lib674.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib674_LDADD = $(TESTUTIL_LIBS)
lib695_SOURCES = lib695.c $(SUPPORTFILES)
-lib696_SOURCES = lib556.c $(SUPPORTFILES) $(WARNLESS)
-lib696_CPPFLAGS = $(AM_CPPFLAGS) -DLIB696
-
lib751_SOURCES = lib751.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib751_LDADD = $(TESTUTIL_LIBS)
lib1538_SOURCES = lib1538.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib1538_LDADD = $(TESTUTIL_LIBS)
-lib1539_SOURCES = lib1514.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
-lib1539_LDADD = $(TESTUTIL_LIBS)
-lib1539_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1539
-
lib1540_SOURCES = lib1540.c $(SUPPORTFILES) $(TESTUTIL) $(TSTTRACE) $(WARNLESS)
lib1540_LDADD = $(TESTUTIL_LIBS)
lib1542_SOURCES = lib1542.c $(SUPPORTFILES) $(TESTUTIL) $(TSTTRACE) $(WARNLESS)
lib1542_LDADD = $(TESTUTIL_LIBS)
-lib1543_SOURCES = lib1518.c $(SUPPORTFILES)
-lib1543_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1543
-
lib1545_SOURCES = lib1545.c $(SUPPORTFILES)
lib1550_SOURCES = lib1550.c $(SUPPORTFILES)
lib1569_SOURCES = lib1569.c $(SUPPORTFILES)
lib1571_SOURCES = lib1571.c $(SUPPORTFILES)
-lib1571_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1571
lib1576_SOURCES = lib1576.c $(SUPPORTFILES)
lib1916_SOURCES = lib1916.c $(SUPPORTFILES) $(WARNLESS)
-lib1917_SOURCES = lib1916.c $(SUPPORTFILES) $(WARNLESS)
-lib1917_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1917
-
lib1918_SOURCES = lib1918.c $(SUPPORTFILES) $(WARNLESS)
lib1919_SOURCES = lib1919.c $(SUPPORTFILES) $(WARNLESS)
lib1945_SOURCES = lib1945.c $(SUPPORTFILES)
lib1945_LDADD = $(TESTUTIL_LIBS)
-lib1946_SOURCES = lib1940.c $(SUPPORTFILES)
-lib1946_LDADD = $(TESTUTIL_LIBS)
-lib1946_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1946
-
lib1947_SOURCES = lib1947.c $(SUPPORTFILES)
lib1947_LDADD = $(TESTUTIL_LIBS)
#include "memdebug.h"
-#ifndef LIB1514_C
-#define LIB1514_C
struct t1514_WriteThis {
char *readptr;
size_t sizeleft;
return 0; /* no more data left to deliver */
}
-#endif
CURLcode test(char *URL)
{
/* Purposely omit to set CURLOPT_POSTFIELDSIZE */
easy_setopt(curl, CURLOPT_READFUNCTION, t1514_read_cb);
easy_setopt(curl, CURLOPT_READDATA, &pooh);
-#ifdef LIB1539
- /* speak HTTP 1.0 - no chunked! */
- easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
-#endif
+
+ if(testnum == 1539) {
+ /* speak HTTP 1.0 - no chunked! */
+ easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
+ }
result = curl_easy_perform(curl);
/* Test inspired by github issue 3340 */
-#ifndef LIB1518_C
-#define LIB1518_C
static size_t t1518_write_cb(char *buffer, size_t size, size_t nitems,
void *outstream)
{
(void)outstream;
return 0;
}
-#endif
CURLcode test(char *URL)
{
long curlRedirectCount;
char *effectiveUrl = NULL;
char *redirectUrl = NULL;
-#ifdef LIB1543
CURLU *urlu = NULL;
-#endif
curl = curl_easy_init();
if(!curl) {
curl_mfprintf(stderr, "curl_easy_init() failed\n");
curl_global_cleanup();
return TEST_ERR_MAJOR_BAD;
}
-#ifdef LIB1543
- /* set CURLOPT_URLU */
- {
+ if(testnum == 1543) {
+ /* set CURLOPT_URLU */
CURLUcode rc = CURLUE_OK;
urlu = curl_url();
if(urlu)
goto test_cleanup;
}
test_setopt(curl, CURLOPT_CURLU, urlu);
+ test_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
+ }
+ else {
+ test_setopt(curl, CURLOPT_URL, URL);
+ /* just to make it explicit and visible in this test: */
+ test_setopt(curl, CURLOPT_FOLLOWLOCATION, 0L);
}
- test_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
-#else
- test_setopt(curl, CURLOPT_URL, URL);
- /* just to make it explicit and visible in this test: */
- test_setopt(curl, CURLOPT_FOLLOWLOCATION, 0L);
-#endif
-
/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
curl_global_cleanup();
-#ifdef LIB1543
- curl_url_cleanup(urlu);
-#endif
+ if(testnum == 1543)
+ curl_url_cleanup(urlu);
return res;
}
{
CURLcode res;
CURL *curl;
- int testno = atoi(libtest_arg2);
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
curl_mfprintf(stderr, "curl_global_init() failed\n");
test_setopt(curl, CURLOPT_HEADER, 1L);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_URL, URL);
- if((testno == 1571) || (testno == 1575) || (testno == 1581)) {
+ if((testnum == 1571) || (testnum == 1572) ||
+ (testnum == 1575) || (testnum == 1581)) {
test_setopt(curl, CURLOPT_POSTFIELDS, "moo");
}
- if(testno == 1581) {
+ if(testnum == 1581) {
test_setopt(curl, CURLOPT_POSTREDIR, (long)CURL_REDIR_POST_301);
}
test_setopt(curl, CURLOPT_CUSTOMREQUEST, "IGLOO");
- if((testno == 1574) || (testno == 1575)) {
+ if((testnum == 1574) || (testnum == 1575)) {
test_setopt(curl, CURLOPT_FOLLOWLOCATION, CURLFOLLOW_FIRSTONLY);
}
else {
CURLcode res;
CURL *curl;
struct curl_slist *pHeaderList = NULL;
- int testno = atoi(libtest_arg2);
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
curl_mfprintf(stderr, "curl_global_init() failed\n");
test_setopt(curl, CURLOPT_INFILESIZE, (long)strlen(t1576_testdata));
test_setopt(curl, CURLOPT_CUSTOMREQUEST, "CURL");
- if(testno == 1578) {
+ if(testnum == 1578 || testnum == 1580) {
test_setopt(curl, CURLOPT_FOLLOWLOCATION, CURLFOLLOW_FIRSTONLY);
}
else {
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, URL);
-#ifdef LIB1917
- /* without any postfields set! */
- curl_easy_setopt(curl, CURLOPT_POST, 1L);
-#else
- curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "");
-#endif
+ if(testnum == 1917) {
+ /* without any postfields set! */
+ curl_easy_setopt(curl, CURLOPT_POST, 1L);
+ }
+ else {
+ curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "");
+ }
res = curl_easy_perform(curl);
if(res) {
curl_mprintf("res: %d\n", res);
#include "memdebug.h"
-#ifndef LIB1940_C
-#define LIB1940_C
-
static size_t t1940_write_cb(char *data, size_t n, size_t l, void *userp)
{
/* take care of the data here, ignored in this example */
}
}
}
-#endif
CURLcode test(char *URL)
{
CURLcode res = CURLE_OK;
int header_request;
-#ifdef LIB1946
- header_request = 0;
-#else
- header_request = -1;
-#endif
+ if(testnum == 1946) {
+ header_request = 0;
+ }
+ else {
+ header_request = -1;
+ }
global_init(CURL_GLOBAL_DEFAULT);
easy_init(easy);
#include "testtrace.h"
#include "memdebug.h"
-#ifdef LIB585
-
static int testcounter;
static curl_socket_t tst_opensocket(void *clientp,
testcounter = 0;
}
-#endif
-
-
CURLcode test(char *URL)
{
CURLcode res;
if(libtest_arg3 && !strcmp(libtest_arg3, "activeftp"))
test_setopt(curl, CURLOPT_FTPPORT, "-");
-#ifdef LIB585
- setupcallbacks(curl);
-#endif
+ if(testnum == 585 || testnum == 586 || testnum == 595 || testnum == 596)
+ setupcallbacks(curl);
res = curl_easy_perform(curl);
#include "memdebug.h"
-#ifndef LIB510_C
-#define LIB510_C
-
struct t510_WriteThis {
int counter;
};
}
return 0; /* no more data left to deliver */
}
-#endif
CURLcode test(char *URL)
{
/* enforce chunked transfer by setting the header */
test_setopt(curl, CURLOPT_HTTPHEADER, slist);
-#ifdef LIB565
- test_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_DIGEST);
- test_setopt(curl, CURLOPT_USERPWD, "foo:bar");
-#endif
+ if(testnum == 565) {
+ test_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_DIGEST);
+ test_setopt(curl, CURLOPT_USERPWD, "foo:bar");
+ }
/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
start_test_timing();
if(!libtest_arg2) {
-#ifdef LIB529
- /* test 529 */
- curl_mfprintf(stderr, "Usage: lib529 [url] [uploadfile]\n");
-#else
- /* test 525 */
- curl_mfprintf(stderr, "Usage: lib525 [url] [uploadfile]\n");
-#endif
+ if(testnum == 529) {
+ curl_mfprintf(stderr, "Usage: lib529 [url] [uploadfile]\n");
+ }
+ else { /* testnum == 525 */
+ curl_mfprintf(stderr, "Usage: lib525 [url] [uploadfile]\n");
+ }
return TEST_ERR_USAGE;
}
test_cleanup:
-#ifdef LIB529
- /* test 529 */
- /* proper cleanup sequence - type PA */
- curl_multi_remove_handle(m, curl);
- curl_multi_cleanup(m);
- curl_easy_cleanup(curl);
- curl_global_cleanup();
-#else
- /* test 525 */
- /* proper cleanup sequence - type PB */
- curl_multi_remove_handle(m, curl);
- curl_easy_cleanup(curl);
- curl_multi_cleanup(m);
- curl_global_cleanup();
-#endif
+ if(testnum == 529) {
+ /* proper cleanup sequence - type PA */
+ curl_multi_remove_handle(m, curl);
+ curl_multi_cleanup(m);
+ curl_easy_cleanup(curl);
+ curl_global_cleanup();
+ }
+ else { /* testnum == 525 */
+ /* proper cleanup sequence - type PB */
+ curl_multi_remove_handle(m, curl);
+ curl_easy_cleanup(curl);
+ curl_multi_cleanup(m);
+ curl_global_cleanup();
+ }
/* close the local file */
fclose(hd_src);
* sharing within the multi handle all transfers are performed on the same
* persistent connection.
*
- * This source code is used for lib526, lib527 and lib532 with only #ifdefs
+ * This source code is used for test526, test527 and test532 with branches
* controlling the small differences.
*
- * - lib526 closes all easy handles after
+ * - test526 closes all easy handles after
* they all have transferred the file over the single connection
- * - lib527 closes each easy handle after each single transfer.
- * - lib532 uses only a single easy handle that is removed, reset and then
+ * - test527 closes each easy handle after each single transfer.
+ * - test532 uses only a single easy handle that is removed, reset and then
* re-added for each transfer
*
* Test case 526, 527 and 532 use FTP, while test 528 uses the lib526 tool but
abort_on_test_timeout();
if(!running) {
-#ifdef LIB527
- /* NOTE: this code does not remove the handle from the multi handle
- here, which would be the nice, sane and documented way of working.
- This however tests that the API survives this abuse gracefully. */
- curl_easy_cleanup(curl[current]);
- curl[current] = NULL;
-#endif
+
+ if(testnum == 527) {
+ /* NOTE: this code does not remove the handle from the multi handle
+ here, which would be the nice, sane and documented way of working.
+ This however tests that the API survives this abuse gracefully. */
+ curl_easy_cleanup(curl[current]);
+ curl[current] = NULL;
+ }
+
if(++current < NUM_HANDLES) {
curl_mfprintf(stderr, "Advancing to URL %d\n", current);
-#ifdef LIB532
+
+ if(testnum == 532) {
/* first remove the only handle we use */
curl_multi_remove_handle(m, curl[0]);
/* re-add it */
multi_add_handle(m, curl[0]);
-#else
- multi_add_handle(m, curl[current]);
-#endif
+ }
+ else {
+ multi_add_handle(m, curl[current]);
+ }
}
else {
break; /* done */
test_cleanup:
-#if defined(LIB526)
-
- /* test 526 and 528 */
- /* proper cleanup sequence - type PB */
+ if(testnum == 526 || testnum == 528) {
+ /* proper cleanup sequence - type PB */
- for(i = 0; i < NUM_HANDLES; i++) {
- curl_multi_remove_handle(m, curl[i]);
- curl_easy_cleanup(curl[i]);
+ for(i = 0; i < NUM_HANDLES; i++) {
+ curl_multi_remove_handle(m, curl[i]);
+ curl_easy_cleanup(curl[i]);
+ }
+ curl_multi_cleanup(m);
+ curl_global_cleanup();
}
- curl_multi_cleanup(m);
- curl_global_cleanup();
-
-#elif defined(LIB527)
-
- /* test 527 */
-
- /* Upon non-failure test flow the easy's have already been cleanup'ed. In
- case there is a failure we arrive here with easy's that have not been
- cleanup'ed yet, in this case we have to cleanup them or otherwise these
- will be leaked, let's use undocumented cleanup sequence - type UB */
+ else if(testnum == 527) {
+ /* Upon non-failure test flow the easy's have already been cleanup'ed. In
+ case there is a failure we arrive here with easy's that have not been
+ cleanup'ed yet, in this case we have to cleanup them or otherwise these
+ will be leaked, let's use undocumented cleanup sequence - type UB */
+
+ if(res != CURLE_OK)
+ for(i = 0; i < NUM_HANDLES; i++)
+ curl_easy_cleanup(curl[i]);
+
+ curl_multi_cleanup(m);
+ curl_global_cleanup();
+ }
+ else { /* testnum == 532 */
+ /* undocumented cleanup sequence - type UB */
- if(res != CURLE_OK)
for(i = 0; i < NUM_HANDLES; i++)
curl_easy_cleanup(curl[i]);
-
- curl_multi_cleanup(m);
- curl_global_cleanup();
-
-#elif defined(LIB532)
-
- /* test 532 */
- /* undocumented cleanup sequence - type UB */
-
- for(i = 0; i < NUM_HANDLES; i++)
- curl_easy_cleanup(curl[i]);
- curl_multi_cleanup(m);
- curl_global_cleanup();
-
-#endif
+ curl_multi_cleanup(m);
+ curl_global_cleanup();
+ }
return res;
}
/* First set the URL that is about to receive our POST. */
test_setopt(curl, CURLOPT_URL, URL);
-#ifdef LIB545
- test_setopt(curl, CURLOPT_POSTFIELDSIZE, (long) sizeof(teststring));
-#endif
+ if(testnum == 545)
+ test_setopt(curl, CURLOPT_POSTFIELDSIZE, (long) sizeof(teststring));
test_setopt(curl, CURLOPT_COPYPOSTFIELDS, teststring);
#define UPLOADTHIS "this is the blurb we want to upload\n"
-#ifndef LIB548
static size_t t547_read_cb(char *ptr, size_t size, size_t nmemb, void *clientp)
{
int *counter = (int *)clientp;
}
return CURLIOE_OK;
}
-#endif
CURLcode test(char *URL)
{
CURLcode res;
CURL *curl;
-#ifndef LIB548
int counter = 0;
-#endif
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
curl_mfprintf(stderr, "curl_global_init() failed\n");
test_setopt(curl, CURLOPT_URL, URL);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_HEADER, 1L);
-#ifdef LIB548
- /* set the data to POST with a mere pointer to a null-terminated string */
- test_setopt(curl, CURLOPT_POSTFIELDS, UPLOADTHIS);
-#else
- /* 547 style, which means reading the POST data from a callback */
- test_setopt(curl, CURLOPT_IOCTLFUNCTION, t547_ioctl_callback);
- test_setopt(curl, CURLOPT_IOCTLDATA, &counter);
-
- test_setopt(curl, CURLOPT_READFUNCTION, t547_read_cb);
- test_setopt(curl, CURLOPT_READDATA, &counter);
- /* We CANNOT do the POST fine without setting the size (or choose
- chunked)! */
- test_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)strlen(UPLOADTHIS));
-#endif
+ if(testnum == 548) {
+ /* set the data to POST with a mere pointer to a null-terminated string */
+ test_setopt(curl, CURLOPT_POSTFIELDS, UPLOADTHIS);
+ }
+ else {
+ /* 547 style, which means reading the POST data from a callback */
+ test_setopt(curl, CURLOPT_IOCTLFUNCTION, t547_ioctl_callback);
+ test_setopt(curl, CURLOPT_IOCTLDATA, &counter);
+
+ test_setopt(curl, CURLOPT_READFUNCTION, t547_read_cb);
+ test_setopt(curl, CURLOPT_READDATA, &counter);
+ /* 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_POST, 1L);
test_setopt(curl, CURLOPT_PROXY, libtest_arg2);
test_setopt(curl, CURLOPT_PROXYUSERPWD, libtest_arg3);
return 0;
if(pooh->sizeleft) {
- *ptr = pooh->readptr[0]; /* copy one single byte */
- pooh->readptr++; /* advance pointer */
- pooh->sizeleft--; /* less data left */
- return 1; /* we return 1 byte at a time! */
+ *ptr = pooh->readptr[0]; /* copy one single byte */
+ pooh->readptr++; /* advance pointer */
+ pooh->sizeleft--; /* less data left */
+ return 1; /* we return 1 byte at a time! */
}
- return 0; /* no more data left to deliver */
+ return 0; /* no more data left to deliver */
+}
+
+static size_t t587_read_cb(char *ptr, size_t size, size_t nmemb, void *userp)
+{
+ (void)ptr;
+ (void)size;
+ (void)nmemb;
+ (void)userp;
+ return CURL_READFUNC_ABORT;
}
static CURLcode t554_test_once(char *URL, bool oldstyle)
test_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)pooh.sizeleft);
/* we want to use our own read function */
- test_setopt(curl, CURLOPT_READFUNCTION, t554_read_cb);
+ if(testnum == 587) {
+ test_setopt(curl, CURLOPT_READFUNCTION, t587_read_cb);
+ }
+ else {
+ test_setopt(curl, CURLOPT_READFUNCTION, t554_read_cb);
+ }
/* send a multi-part formpost */
test_setopt(curl, CURLOPT_HTTPPOST, formpost);
return CURLIOE_OK;
}
-
CURLcode test(char *URL)
{
CURLcode res = CURLE_OK;
{
CURLcode res;
CURL *curl;
-#ifdef LIB696
int transfers = 0;
-#endif
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
curl_mfprintf(stderr, "curl_global_init() failed\n");
test_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
-#ifdef LIB696
again:
-#endif
res = curl_easy_perform(curl);
res = TEST_ERR_FAILURE;
}
-#ifdef LIB696
- ++transfers;
- /* perform the transfer a second time */
- if(!res && transfers == 1)
- goto again;
-#endif
+ if(testnum == 696) {
+ ++transfers;
+ /* perform the transfer a second time */
+ if(!res && transfers == 1)
+ goto again;
+ }
test_cleanup:
+++ /dev/null
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at https://curl.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- * SPDX-License-Identifier: curl
- *
- ***************************************************************************/
-#include "test.h"
-
-#include "memdebug.h"
-
-struct t587_WriteThis {
- const char *readptr;
- size_t sizeleft;
-};
-
-static size_t t587_read_cb(char *ptr, size_t size, size_t nmemb, void *userp)
-{
- (void)ptr;
- (void)size;
- (void)nmemb;
- (void)userp;
- return CURL_READFUNC_ABORT;
-}
-
-static CURLcode t587_test_once(char *URL, bool oldstyle)
-{
- static const char testdata[] =
- "this is what we post to the silly web server\n";
-
- CURL *curl;
- CURLcode res = CURLE_OK;
- CURLFORMcode formrc;
-
- struct curl_httppost *formpost = NULL;
- struct curl_httppost *lastptr = NULL;
- struct t587_WriteThis pooh;
- struct t587_WriteThis pooh2;
-
- pooh.readptr = testdata;
- pooh.sizeleft = strlen(testdata);
-
- /* Fill in the file upload field */
- if(oldstyle) {
- formrc = curl_formadd(&formpost,
- &lastptr,
- CURLFORM_COPYNAME, "sendfile",
- CURLFORM_STREAM, &pooh,
- CURLFORM_CONTENTSLENGTH, (long)pooh.sizeleft,
- CURLFORM_FILENAME, "postit2.c",
- CURLFORM_END);
- }
- else {
- /* new style */
- formrc = curl_formadd(&formpost,
- &lastptr,
- CURLFORM_COPYNAME, "sendfile alternative",
- CURLFORM_STREAM, &pooh,
- CURLFORM_CONTENTLEN, (curl_off_t)pooh.sizeleft,
- CURLFORM_FILENAME, "file name 2",
- CURLFORM_END);
- }
-
- if(formrc)
- curl_mprintf("curl_formadd(1) = %d\n", (int)formrc);
-
- /* Now add the same data with another name and make it not look like
- a file upload but still using the callback */
-
- pooh2.readptr = testdata;
- pooh2.sizeleft = strlen(testdata);
-
- /* Fill in the file upload field */
- formrc = curl_formadd(&formpost,
- &lastptr,
- CURLFORM_COPYNAME, "callbackdata",
- CURLFORM_STREAM, &pooh2,
- CURLFORM_CONTENTSLENGTH, (long)pooh2.sizeleft,
- CURLFORM_END);
-
- if(formrc)
- curl_mprintf("curl_formadd(2) = %d\n", (int)formrc);
-
- /* Fill in the filename field */
- formrc = curl_formadd(&formpost,
- &lastptr,
- CURLFORM_COPYNAME, "filename",
- CURLFORM_COPYCONTENTS, "postit2.c",
- CURLFORM_END);
- if(formrc)
- curl_mprintf("curl_formadd(3) = %d\n", (int)formrc);
-
- /* Fill in a submit field too */
- formrc = curl_formadd(&formpost,
- &lastptr,
- CURLFORM_COPYNAME, "submit",
- CURLFORM_COPYCONTENTS, "send",
- CURLFORM_CONTENTTYPE, "text/plain",
- CURLFORM_END);
-
- if(formrc)
- curl_mprintf("curl_formadd(4) = %d\n", (int)formrc);
-
- formrc = curl_formadd(&formpost, &lastptr,
- CURLFORM_COPYNAME, "somename",
- CURLFORM_BUFFER, "somefile.txt",
- CURLFORM_BUFFERPTR, "blah blah",
- CURLFORM_BUFFERLENGTH, (long)9,
- CURLFORM_END);
-
- if(formrc)
- curl_mprintf("curl_formadd(5) = %d\n", (int)formrc);
-
- curl = curl_easy_init();
- if(!curl) {
- curl_mfprintf(stderr, "curl_easy_init() failed\n");
- curl_formfree(formpost);
- curl_global_cleanup();
- return TEST_ERR_MAJOR_BAD;
- }
-
- /* First set the URL that is about to receive our POST. */
- test_setopt(curl, CURLOPT_URL, URL);
-
- /* Now specify we want to POST data */
- test_setopt(curl, CURLOPT_POST, 1L);
-
- /* Set the expected POST size */
- test_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)pooh.sizeleft);
-
- /* we want to use our own read function */
- test_setopt(curl, CURLOPT_READFUNCTION, t587_read_cb);
-
- /* send a multi-part formpost */
- test_setopt(curl, CURLOPT_HTTPPOST, formpost);
-
- /* get verbose debug output please */
- test_setopt(curl, CURLOPT_VERBOSE, 1L);
-
- /* include headers in the output */
- test_setopt(curl, CURLOPT_HEADER, 1L);
-
- /* Perform the request, res will get the return code */
- res = curl_easy_perform(curl);
-
-test_cleanup:
-
- /* always cleanup */
- curl_easy_cleanup(curl);
-
- /* now cleanup the formpost chain */
- curl_formfree(formpost);
-
- return res;
-}
-
-CURLcode test(char *URL)
-{
- CURLcode res;
-
- if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
- curl_mfprintf(stderr, "curl_global_init() failed\n");
- return TEST_ERR_MAJOR_BAD;
- }
-
- res = t587_test_once(URL, TRUE); /* old */
- if(!res)
- res = t587_test_once(URL, FALSE); /* new */
-
- curl_global_cleanup();
-
- return res;
-}
test_setopt(curl, CURLOPT_VERBOSE, 1L); /* show verbose for debug */
test_setopt(curl, CURLOPT_HEADER, 1L); /* include header */
-#ifdef LIB584
- {
+ if(testnum == 584) {
curl_mime *mime = curl_mime_init(curl);
curl_mimepart *part = curl_mime_addpart(mime);
curl_mime_name(part, "fake");
if(res)
goto test_cleanup;
}
-#endif
test_setopt(curl, CURLOPT_MIMEPOST, NULL);
if(size*nmemb < 1)
return 0;
- eof = pooh->sizeleft <= 0;
- if(!eof)
- pooh->sizeleft--;
+ if(testnum == 643) {
+ eof = pooh->sizeleft <= 0;
+ if(!eof)
+ pooh->sizeleft--;
+ }
+ else {
+ eof = !*pooh->readptr;
+ }
if(!eof) {
*ptr = *pooh->readptr; /* copy one single byte */
curl_off_t datasize = -1;
pooh.readptr = testdata;
- datasize = (curl_off_t)strlen(testdata);
+ if(testnum == 643)
+ datasize = (curl_off_t)strlen(testdata);
pooh.sizeleft = datasize;
curl = curl_easy_init();
a file upload but still using the callback */
pooh2.readptr = testdata;
- datasize = (curl_off_t)strlen(testdata);
+ if(testnum == 643)
+ datasize = (curl_off_t)strlen(testdata);
pooh2.sizeleft = datasize;
part = curl_mime_addpart(mime);
+++ /dev/null
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at https://curl.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- * SPDX-License-Identifier: curl
- *
- ***************************************************************************/
-#include "test.h"
-
-#include "memdebug.h"
-
-struct t645_WriteThis {
- const char *readptr;
- curl_off_t sizeleft;
-};
-
-static size_t t645_read_cb(char *ptr, size_t size, size_t nmemb, void *userp)
-{
- struct t645_WriteThis *pooh = (struct t645_WriteThis *)userp;
- int eof;
-
- if(size*nmemb < 1)
- return 0;
-
- eof = !*pooh->readptr;
-
- if(!eof) {
- *ptr = *pooh->readptr; /* copy one single byte */
- pooh->readptr++; /* advance pointer */
- return 1; /* we return 1 byte at a time! */
- }
-
- return 0; /* no more data left to deliver */
-}
-
-static CURLcode t645_test_once(char *URL, bool oldstyle)
-{
- static const char testdata[] = "dummy\n";
-
- CURL *curl;
- CURLcode res = CURLE_OK;
-
- curl_mime *mime = NULL;
- curl_mimepart *part = NULL;
- struct t645_WriteThis pooh;
- struct t645_WriteThis pooh2;
- curl_off_t datasize = -1;
-
- pooh.readptr = testdata;
- pooh.sizeleft = datasize;
-
- curl = curl_easy_init();
- if(!curl) {
- curl_mfprintf(stderr, "curl_easy_init() failed\n");
- curl_global_cleanup();
- return TEST_ERR_MAJOR_BAD;
- }
-
- mime = curl_mime_init(curl);
- if(!mime) {
- curl_mfprintf(stderr, "curl_mime_init() failed\n");
- curl_easy_cleanup(curl);
- curl_global_cleanup();
- return TEST_ERR_MAJOR_BAD;
- }
-
- part = curl_mime_addpart(mime);
- if(!part) {
- curl_mfprintf(stderr, "curl_mime_addpart(1) failed\n");
- curl_mime_free(mime);
- curl_easy_cleanup(curl);
- curl_global_cleanup();
- return TEST_ERR_MAJOR_BAD;
- }
-
- /* Fill in the file upload part */
- if(oldstyle) {
- res = curl_mime_name(part, "sendfile");
- if(!res)
- res = curl_mime_data_cb(part, datasize, t645_read_cb,
- NULL, NULL, &pooh);
- if(!res)
- res = curl_mime_filename(part, "postit2.c");
- }
- else {
- /* new style */
- res = curl_mime_name(part, "sendfile alternative");
- if(!res)
- res = curl_mime_data_cb(part, datasize, t645_read_cb,
- NULL, NULL, &pooh);
- if(!res)
- res = curl_mime_filename(part, "file name 2");
- }
-
- if(res)
- curl_mprintf("curl_mime_xxx(1) = %s\n", curl_easy_strerror(res));
-
- /* Now add the same data with another name and make it not look like
- a file upload but still using the callback */
-
- pooh2.readptr = testdata;
- pooh2.sizeleft = datasize;
-
- part = curl_mime_addpart(mime);
- if(!part) {
- curl_mfprintf(stderr, "curl_mime_addpart(2) failed\n");
- curl_mime_free(mime);
- curl_easy_cleanup(curl);
- curl_global_cleanup();
- return TEST_ERR_MAJOR_BAD;
- }
- /* Fill in the file upload part */
- res = curl_mime_name(part, "callbackdata");
- if(!res)
- res = curl_mime_data_cb(part, datasize, t645_read_cb,
- NULL, NULL, &pooh2);
-
- if(res)
- curl_mprintf("curl_mime_xxx(2) = %s\n", curl_easy_strerror(res));
-
- part = curl_mime_addpart(mime);
- if(!part) {
- curl_mfprintf(stderr, "curl_mime_addpart(3) failed\n");
- curl_mime_free(mime);
- curl_easy_cleanup(curl);
- curl_global_cleanup();
- return TEST_ERR_MAJOR_BAD;
- }
-
- /* Fill in the filename field */
- res = curl_mime_name(part, "filename");
- if(!res)
- res = curl_mime_data(part, "postit2.c",
- CURL_ZERO_TERMINATED);
-
- if(res)
- curl_mprintf("curl_mime_xxx(3) = %s\n", curl_easy_strerror(res));
-
- /* Fill in a submit field too */
- part = curl_mime_addpart(mime);
- if(!part) {
- curl_mfprintf(stderr, "curl_mime_addpart(4) failed\n");
- curl_mime_free(mime);
- curl_easy_cleanup(curl);
- curl_global_cleanup();
- return TEST_ERR_MAJOR_BAD;
- }
- res = curl_mime_name(part, "submit");
- if(!res)
- res = curl_mime_data(part, "send",
- CURL_ZERO_TERMINATED);
-
- if(res)
- curl_mprintf("curl_mime_xxx(4) = %s\n", curl_easy_strerror(res));
-
- part = curl_mime_addpart(mime);
- if(!part) {
- curl_mfprintf(stderr, "curl_mime_addpart(5) failed\n");
- curl_mime_free(mime);
- curl_easy_cleanup(curl);
- curl_global_cleanup();
- return TEST_ERR_MAJOR_BAD;
- }
- res = curl_mime_name(part, "somename");
- if(!res)
- res = curl_mime_filename(part, "somefile.txt");
- if(!res)
- res = curl_mime_data(part, "blah blah", 9);
-
- if(res)
- curl_mprintf("curl_mime_xxx(5) = %s\n", curl_easy_strerror(res));
-
- /* First set the URL that is about to receive our POST. */
- test_setopt(curl, CURLOPT_URL, URL);
-
- /* send a multi-part mimepost */
- test_setopt(curl, CURLOPT_MIMEPOST, mime);
-
- /* get verbose debug output please */
- test_setopt(curl, CURLOPT_VERBOSE, 1L);
-
- /* include headers in the output */
- test_setopt(curl, CURLOPT_HEADER, 1L);
-
- /* Perform the request, res will get the return code */
- res = curl_easy_perform(curl);
-
-test_cleanup:
-
- /* always cleanup */
- curl_easy_cleanup(curl);
-
- /* now cleanup the mimepost structure */
- curl_mime_free(mime);
-
- return res;
-}
-
-static CURLcode t645_cyclic_add(void)
-{
- CURL *easy = curl_easy_init();
- curl_mime *mime = curl_mime_init(easy);
- curl_mimepart *part = curl_mime_addpart(mime);
- CURLcode a1 = curl_mime_subparts(part, mime);
-
- if(a1 == CURLE_BAD_FUNCTION_ARGUMENT) {
- curl_mime *submime = curl_mime_init(easy);
- curl_mimepart *subpart = curl_mime_addpart(submime);
-
- curl_mime_subparts(part, submime);
- a1 = curl_mime_subparts(subpart, mime);
- }
-
- curl_mime_free(mime);
- curl_easy_cleanup(easy);
- if(a1 != CURLE_BAD_FUNCTION_ARGUMENT)
- /* that should have failed */
- return TEST_ERR_FAILURE;
-
- return CURLE_OK;
-}
-
-CURLcode test(char *URL)
-{
- CURLcode res;
-
- if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
- curl_mfprintf(stderr, "curl_global_init() failed\n");
- return TEST_ERR_MAJOR_BAD;
- }
-
- res = t645_test_once(URL, TRUE); /* old */
- if(!res)
- res = t645_test_once(URL, FALSE); /* new */
-
- if(!res)
- res = t645_cyclic_add();
-
- curl_global_cleanup();
-
- return res;
-}
#define PAUSE_TIME 5
-#ifndef LIB670_C
-#define LIB670_C
struct t670_ReadThis {
CURL *easy;
time_t origin;
curl_mfprintf(stderr, "Read callback called after EOF\n");
exit(1);
}
-#endif
-#if !defined(LIB670) && !defined(LIB672)
-#ifndef LIB670_XFERINFO_C
-#define LIB670_XFERINFO_C
static int t670_xferinfo(void *clientp,
curl_off_t dltotal, curl_off_t dlnow,
curl_off_t ultotal, curl_off_t ulnow)
return 0;
}
-#endif
-#endif
CURLcode test(char *URL)
{
static const char testname[] = "field";
-#if defined(LIB670) || defined(LIB671)
curl_mime *mime = NULL;
- curl_mimepart *part;
-#else
- CURLFORMcode formrc;
struct curl_httppost *formpost = NULL;
- struct curl_httppost *lastptr = NULL;
-#endif
-#if defined(LIB670) || defined(LIB672)
- CURLM *multi = NULL;
- CURLMcode mres;
- CURLMsg *msg;
- int msgs_left;
- int still_running = 0;
-#endif
struct t670_ReadThis pooh;
CURLcode res = TEST_ERR_FAILURE;
/* include headers in the output */
test_setopt(pooh.easy, CURLOPT_HEADER, 1L);
-#if defined(LIB670) || defined(LIB671)
- /* Build the mime tree. */
- mime = curl_mime_init(pooh.easy);
- part = curl_mime_addpart(mime);
- res = curl_mime_name(part, testname);
- if(res != CURLE_OK) {
- curl_mfprintf(stderr,
- "Something went wrong when building the mime structure: %d\n",
- res);
- goto test_cleanup;
- }
+ if(testnum == 670 || testnum == 671) {
+ curl_mimepart *part;
+ /* Build the mime tree. */
+ mime = curl_mime_init(pooh.easy);
+ part = curl_mime_addpart(mime);
+ res = curl_mime_name(part, testname);
+ if(res != CURLE_OK) {
+ curl_mfprintf(stderr,
+ "Something went wrong when building the mime structure: %d\n",
+ res);
+ goto test_cleanup;
+ }
+
+ res = curl_mime_data_cb(part, (curl_off_t) 2, t670_read_cb,
+ NULL, NULL, &pooh);
- res = curl_mime_data_cb(part, (curl_off_t) 2, t670_read_cb,
- NULL, NULL, &pooh);
-
- /* Bind mime data to its easy handle. */
- if(res == CURLE_OK)
- test_setopt(pooh.easy, CURLOPT_MIMEPOST, mime);
-#else
- /* Build the form. */
- formrc = curl_formadd(&formpost, &lastptr,
- CURLFORM_COPYNAME, testname,
- CURLFORM_STREAM, &pooh,
- CURLFORM_CONTENTLEN, (curl_off_t) 2,
- CURLFORM_END);
- if(formrc) {
- curl_mfprintf(stderr, "curl_formadd() = %d\n", (int) formrc);
- goto test_cleanup;
+ /* Bind mime data to its easy handle. */
+ if(res == CURLE_OK)
+ test_setopt(pooh.easy, CURLOPT_MIMEPOST, mime);
}
+ else {
+ struct curl_httppost *lastptr = NULL;
+ CURLFORMcode formrc;
+ /* Build the form. */
+ formrc = curl_formadd(&formpost, &lastptr,
+ CURLFORM_COPYNAME, testname,
+ CURLFORM_STREAM, &pooh,
+ CURLFORM_CONTENTLEN, (curl_off_t) 2,
+ CURLFORM_END);
+ if(formrc) {
+ curl_mfprintf(stderr, "curl_formadd() = %d\n", (int) formrc);
+ goto test_cleanup;
+ }
- /* We want to use our own read function. */
- test_setopt(pooh.easy, CURLOPT_READFUNCTION, t670_read_cb);
+ /* We want to use our own read function. */
+ test_setopt(pooh.easy, CURLOPT_READFUNCTION, t670_read_cb);
- /* Send a multi-part formpost. */
- test_setopt(pooh.easy, CURLOPT_HTTPPOST, formpost);
-#endif
+ /* Send a multi-part formpost. */
+ test_setopt(pooh.easy, CURLOPT_HTTPPOST, formpost);
+ }
-#if defined(LIB670) || defined(LIB672)
- /* Use the multi interface. */
- multi = curl_multi_init();
- mres = curl_multi_add_handle(multi, pooh.easy);
- while(!mres) {
- struct timeval timeout;
- int rc = 0;
- fd_set fdread;
- fd_set fdwrite;
- fd_set fdexcept;
- int maxfd = -1;
-
- mres = curl_multi_perform(multi, &still_running);
- if(!still_running || mres != CURLM_OK)
- break;
-
- if(pooh.origin) {
- time_t delta = time(NULL) - pooh.origin;
-
- if(delta >= 4 * PAUSE_TIME) {
- curl_mfprintf(stderr, "unpausing failed: drain problem?\n");
- res = CURLE_OPERATION_TIMEDOUT;
+ if(testnum == 670 || testnum == 672) {
+ CURLMcode mres;
+ CURLM *multi;
+ /* Use the multi interface. */
+ multi = curl_multi_init();
+ mres = curl_multi_add_handle(multi, pooh.easy);
+ while(!mres) {
+ struct timeval timeout;
+ int rc = 0;
+ fd_set fdread;
+ fd_set fdwrite;
+ fd_set fdexcept;
+ int maxfd = -1;
+ int still_running = 0;
+
+ mres = curl_multi_perform(multi, &still_running);
+ if(!still_running || mres != CURLM_OK)
break;
- }
- if(delta >= PAUSE_TIME)
- curl_easy_pause(pooh.easy, CURLPAUSE_CONT);
- }
+ if(pooh.origin) {
+ time_t delta = time(NULL) - pooh.origin;
+
+ if(delta >= 4 * PAUSE_TIME) {
+ curl_mfprintf(stderr, "unpausing failed: drain problem?\n");
+ res = CURLE_OPERATION_TIMEDOUT;
+ break;
+ }
- FD_ZERO(&fdread);
- FD_ZERO(&fdwrite);
- FD_ZERO(&fdexcept);
- timeout.tv_sec = 0;
- timeout.tv_usec = 1000000 * PAUSE_TIME / 10;
- mres = curl_multi_fdset(multi, &fdread, &fdwrite, &fdexcept, &maxfd);
- if(mres)
- break;
+ if(delta >= PAUSE_TIME)
+ curl_easy_pause(pooh.easy, CURLPAUSE_CONT);
+ }
+
+ FD_ZERO(&fdread);
+ FD_ZERO(&fdwrite);
+ FD_ZERO(&fdexcept);
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 1000000 * PAUSE_TIME / 10;
+ mres = curl_multi_fdset(multi, &fdread, &fdwrite, &fdexcept, &maxfd);
+ if(mres)
+ break;
#ifdef _WIN32
- if(maxfd == -1)
- Sleep(100);
- else
+ if(maxfd == -1)
+ Sleep(100);
+ else
#endif
- rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcept, &timeout);
- if(rc == -1) {
- curl_mfprintf(stderr, "Select error\n");
- break;
- }
- }
-
- if(mres != CURLM_OK)
- for(;;) {
- msg = curl_multi_info_read(multi, &msgs_left);
- if(!msg)
+ rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcept, &timeout);
+ if(rc == -1) {
+ curl_mfprintf(stderr, "Select error\n");
break;
- if(msg->msg == CURLMSG_DONE) {
- res = msg->data.result;
}
}
- curl_multi_remove_handle(multi, pooh.easy);
- curl_multi_cleanup(multi);
-
-#else
- /* Use the easy interface. */
- test_setopt(pooh.easy, CURLOPT_XFERINFODATA, &pooh);
- test_setopt(pooh.easy, CURLOPT_XFERINFOFUNCTION, t670_xferinfo);
- test_setopt(pooh.easy, CURLOPT_NOPROGRESS, 0L);
- res = curl_easy_perform(pooh.easy);
-#endif
+ if(mres != CURLM_OK)
+ for(;;) {
+ int msgs_left;
+ CURLMsg *msg;
+ msg = curl_multi_info_read(multi, &msgs_left);
+ if(!msg)
+ break;
+ if(msg->msg == CURLMSG_DONE) {
+ res = msg->data.result;
+ }
+ }
+ curl_multi_remove_handle(multi, pooh.easy);
+ curl_multi_cleanup(multi);
+ }
+ else {
+ /* Use the easy interface. */
+ test_setopt(pooh.easy, CURLOPT_XFERINFODATA, &pooh);
+ test_setopt(pooh.easy, CURLOPT_XFERINFOFUNCTION, t670_xferinfo);
+ test_setopt(pooh.easy, CURLOPT_NOPROGRESS, 0L);
+ res = curl_easy_perform(pooh.easy);
+ }
test_cleanup:
curl_easy_cleanup(pooh.easy);
-#if defined(LIB670) || defined(LIB671)
- curl_mime_free(mime);
-#else
- curl_formfree(formpost);
-#endif
+
+ if(testnum == 670 || testnum == 671) {
+ curl_mime_free(mime);
+ }
+ else {
+ curl_formfree(formpost);
+ }
curl_global_cleanup();
return res;
chomp $line;
if($line =~ /([a-z0-9]+)_SOURCES\ =\ ([a-z0-9]+)\.c/) {
my $name = $1;
- my $namu = uc($name);
my $src = "$2.c";
# Make common symbols unique across test sources
print "#define $symb ${symb}_$name\n";
}
- print "#define $namu\n";
print "#include \"$src\"\n";
- print "#undef $namu\n";
print "\n";
$tlist .= " {\"$name\", test_$name},\n";
}