tests/data: move --libcurl output to external data files

To make the test files XML-compliant, and the expected results
possibly easier to manage by keeping them in `.c` files.

Non-XML-compliant files are down to 36 after this patch.

Also:
- make all macro expansions apply to `%includetext` contents.

Closes #19799
This commit is contained in:
Viktor Szakats
2025-12-01 13:31:42 +01:00
parent 2ae983bf4e
commit d75716e4e5
27 changed files with 645 additions and 630 deletions

View File

@@ -115,7 +115,8 @@ the include instruction:
%include filename%
Or, a variant of the above where the file is loaded as a newline-agnostic
text file, and `%CR`, `%SP`, `%TAB` macros are expanded after inclusion:
text file, and whitespace, special character macros and variables expanded
after inclusion:
%includetext filename%

View File

@@ -22,6 +22,7 @@ if(@ARGV) {
}
@files = grep !/\/CMakeFiles\//, @files;
@files = grep !/tests\/data\/data.+\.c/, @files;
@files = map { dirname($_) } @files;
my @dirs = sort { $a cmp $b } keys %{{ map { $_ => 1 } @files }};

View File

@@ -283,4 +283,6 @@ test3200 test3201 test3202 test3203 test3204 test3205 test3206 test3207 test3208
test3209 test3210 test3211 test3212 test3213 test3214 test3215 test3216 \
test4000 test4001
EXTRA_DIST = $(TESTCASES) DISABLED data-xml1
EXTRA_DIST = $(TESTCASES) DISABLED data-xml1 \
data1400.c data1401.c data1402.c data1403.c data1404.c data1405.c data1406.c \
data1407.c data1420.c data1465.c data1481.c

46
tests/data/data1400.c Normal file
View File

@@ -0,0 +1,46 @@
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER");
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/%VERSION");
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may choose to either not use them or implement
them yourself.
CURLOPT_DEBUGFUNCTION was set to a function pointer
CURLOPT_DEBUGDATA was set to an object pointer
CURLOPT_WRITEDATA was set to an object pointer
CURLOPT_WRITEFUNCTION was set to a function pointer
CURLOPT_READDATA was set to an object pointer
CURLOPT_READFUNCTION was set to a function pointer
CURLOPT_SEEKDATA was set to an object pointer
CURLOPT_SEEKFUNCTION was set to a function pointer
CURLOPT_HEADERFUNCTION was set to a function pointer
CURLOPT_HEADERDATA was set to an object pointer
CURLOPT_ERRORBUFFER was set to an object pointer
CURLOPT_STDERR was set to an object pointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
return (int)ret;
}
/**** End of sample code ****/

58
tests/data/data1401.c Normal file
View File

@@ -0,0 +1,58 @@
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
struct curl_slist *slist1;
slist1 = NULL;
slist1 = curl_slist_append(slist1, "X-Files: Mulder");
slist1 = curl_slist_append(slist1, "X-Men: cyclops, iceman");
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER");
curl_easy_setopt(hnd, CURLOPT_USERPWD, "fake:user");
curl_easy_setopt(hnd, CURLOPT_HTTPAUTH, (long)CURLAUTH_BASIC);
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, slist1);
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "MyUA");
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
curl_easy_setopt(hnd, CURLOPT_COOKIE, "chocolate=chip");
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
curl_easy_setopt(hnd, CURLOPT_PROTOCOLS_STR, "file,ftp,http");
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may choose to either not use them or implement
them yourself.
CURLOPT_DEBUGFUNCTION was set to a function pointer
CURLOPT_DEBUGDATA was set to an object pointer
CURLOPT_WRITEDATA was set to an object pointer
CURLOPT_WRITEFUNCTION was set to a function pointer
CURLOPT_READDATA was set to an object pointer
CURLOPT_READFUNCTION was set to a function pointer
CURLOPT_SEEKDATA was set to an object pointer
CURLOPT_SEEKFUNCTION was set to a function pointer
CURLOPT_HEADERFUNCTION was set to a function pointer
CURLOPT_HEADERDATA was set to an object pointer
CURLOPT_ERRORBUFFER was set to an object pointer
CURLOPT_STDERR was set to an object pointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
curl_slist_free_all(slist1);
slist1 = NULL;
return (int)ret;
}
/**** End of sample code ****/

48
tests/data/data1402.c Normal file
View File

@@ -0,0 +1,48 @@
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER");
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "foo=bar&baz=quux");
curl_easy_setopt(hnd, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)16);
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/%VERSION");
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may choose to either not use them or implement
them yourself.
CURLOPT_DEBUGFUNCTION was set to a function pointer
CURLOPT_DEBUGDATA was set to an object pointer
CURLOPT_WRITEDATA was set to an object pointer
CURLOPT_WRITEFUNCTION was set to a function pointer
CURLOPT_READDATA was set to an object pointer
CURLOPT_READFUNCTION was set to a function pointer
CURLOPT_SEEKDATA was set to an object pointer
CURLOPT_SEEKFUNCTION was set to a function pointer
CURLOPT_HEADERFUNCTION was set to a function pointer
CURLOPT_HEADERDATA was set to an object pointer
CURLOPT_ERRORBUFFER was set to an object pointer
CURLOPT_STDERR was set to an object pointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
return (int)ret;
}
/**** End of sample code ****/

46
tests/data/data1403.c Normal file
View File

@@ -0,0 +1,46 @@
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER\?foo=bar&baz=quux");
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/%VERSION");
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may choose to either not use them or implement
them yourself.
CURLOPT_DEBUGFUNCTION was set to a function pointer
CURLOPT_DEBUGDATA was set to an object pointer
CURLOPT_WRITEDATA was set to an object pointer
CURLOPT_WRITEFUNCTION was set to a function pointer
CURLOPT_READDATA was set to an object pointer
CURLOPT_READFUNCTION was set to a function pointer
CURLOPT_SEEKDATA was set to an object pointer
CURLOPT_SEEKFUNCTION was set to a function pointer
CURLOPT_HEADERFUNCTION was set to a function pointer
CURLOPT_HEADERDATA was set to an object pointer
CURLOPT_ERRORBUFFER was set to an object pointer
CURLOPT_STDERR was set to an object pointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
return (int)ret;
}
/**** End of sample code ****/

83
tests/data/data1404.c Normal file
View File

@@ -0,0 +1,83 @@
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
curl_mime *mime1;
curl_mimepart *part1;
curl_mime *mime2;
curl_mimepart *part2;
struct curl_slist *slist1;
mime1 = NULL;
mime2 = NULL;
slist1 = NULL;
slist1 = curl_slist_append(slist1, "X-testheader-1: header 1");
slist1 = curl_slist_append(slist1, "X-testheader-2: header 2");
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER");
mime1 = curl_mime_init(hnd);
part1 = curl_mime_addpart(mime1);
curl_mime_data(part1, "value", CURL_ZERO_TERMINATED);
curl_mime_name(part1, "name");
part1 = curl_mime_addpart(mime1);
mime2 = curl_mime_init(hnd);
part2 = curl_mime_addpart(mime2);
curl_mime_filedata(part2, "%LOGDIR/test%TESTNUMBER.txt");
part2 = curl_mime_addpart(mime2);
curl_mime_filedata(part2, "%LOGDIR/test%TESTNUMBER.txt");
curl_mime_encoder(part2, "8bit");
curl_mime_type(part2, "magic/content");
part2 = curl_mime_addpart(mime2);
curl_mime_filedata(part2, "%LOGDIR/test%TESTNUMBER.txt");
curl_mime_headers(part2, slist1, 1);
slist1 = NULL;
curl_mime_subparts(part1, mime2);
mime2 = NULL;
curl_mime_name(part1, "file");
curl_easy_setopt(hnd, CURLOPT_MIMEPOST, mime1);
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/%VERSION");
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may choose to either not use them or implement
them yourself.
CURLOPT_DEBUGFUNCTION was set to a function pointer
CURLOPT_DEBUGDATA was set to an object pointer
CURLOPT_WRITEDATA was set to an object pointer
CURLOPT_WRITEFUNCTION was set to a function pointer
CURLOPT_READDATA was set to an object pointer
CURLOPT_READFUNCTION was set to a function pointer
CURLOPT_SEEKDATA was set to an object pointer
CURLOPT_SEEKFUNCTION was set to a function pointer
CURLOPT_HEADERFUNCTION was set to a function pointer
CURLOPT_HEADERDATA was set to an object pointer
CURLOPT_ERRORBUFFER was set to an object pointer
CURLOPT_STDERR was set to an object pointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
curl_mime_free(mime1);
mime1 = NULL;
curl_mime_free(mime2);
mime2 = NULL;
curl_slist_free_all(slist1);
slist1 = NULL;
return (int)ret;
}
/**** End of sample code ****/

66
tests/data/data1405.c Normal file
View File

@@ -0,0 +1,66 @@
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
struct curl_slist *slist1;
struct curl_slist *slist2;
struct curl_slist *slist3;
slist1 = NULL;
slist1 = curl_slist_append(slist1, "NOOP 1");
slist1 = curl_slist_append(slist1, "*FAIL");
slist2 = NULL;
slist2 = curl_slist_append(slist2, "NOOP 3");
slist3 = NULL;
slist3 = curl_slist_append(slist3, "NOOP 2");
slist3 = curl_slist_append(slist3, "*FAIL HARD");
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "ftp://%HOSTIP:%FTPPORT/%TESTNUMBER");
curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
curl_easy_setopt(hnd, CURLOPT_QUOTE, slist1);
curl_easy_setopt(hnd, CURLOPT_POSTQUOTE, slist2);
curl_easy_setopt(hnd, CURLOPT_PREQUOTE, slist3);
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may choose to either not use them or implement
them yourself.
CURLOPT_DEBUGFUNCTION was set to a function pointer
CURLOPT_DEBUGDATA was set to an object pointer
CURLOPT_WRITEDATA was set to an object pointer
CURLOPT_WRITEFUNCTION was set to a function pointer
CURLOPT_READDATA was set to an object pointer
CURLOPT_READFUNCTION was set to a function pointer
CURLOPT_SEEKDATA was set to an object pointer
CURLOPT_SEEKFUNCTION was set to a function pointer
CURLOPT_HEADERFUNCTION was set to a function pointer
CURLOPT_HEADERDATA was set to an object pointer
CURLOPT_ERRORBUFFER was set to an object pointer
CURLOPT_STDERR was set to an object pointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
curl_slist_free_all(slist1);
slist1 = NULL;
curl_slist_free_all(slist2);
slist2 = NULL;
curl_slist_free_all(slist3);
slist3 = NULL;
return (int)ret;
}
/**** End of sample code ****/

56
tests/data/data1406.c Normal file
View File

@@ -0,0 +1,56 @@
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
struct curl_slist *slist1;
slist1 = NULL;
slist1 = curl_slist_append(slist1, "recipient.one@example.com");
slist1 = curl_slist_append(slist1, "recipient.two@example.com");
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "smtp://%HOSTIP:%SMTPPORT/%TESTNUMBER");
curl_easy_setopt(hnd, CURLOPT_UPLOAD, 1L);
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/%VERSION");
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
curl_easy_setopt(hnd, CURLOPT_MAIL_FROM, "sender@example.com");
curl_easy_setopt(hnd, CURLOPT_MAIL_RCPT, slist1);
curl_easy_setopt(hnd, CURLOPT_INFILESIZE_LARGE, (curl_off_t)38);
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may choose to either not use them or implement
them yourself.
CURLOPT_DEBUGFUNCTION was set to a function pointer
CURLOPT_DEBUGDATA was set to an object pointer
CURLOPT_WRITEDATA was set to an object pointer
CURLOPT_WRITEFUNCTION was set to a function pointer
CURLOPT_READDATA was set to an object pointer
CURLOPT_READFUNCTION was set to a function pointer
CURLOPT_SEEKDATA was set to an object pointer
CURLOPT_SEEKFUNCTION was set to a function pointer
CURLOPT_HEADERFUNCTION was set to a function pointer
CURLOPT_HEADERDATA was set to an object pointer
CURLOPT_ERRORBUFFER was set to an object pointer
CURLOPT_STDERR was set to an object pointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
curl_slist_free_all(slist1);
slist1 = NULL;
return (int)ret;
}
/**** End of sample code ****/

46
tests/data/data1407.c Normal file
View File

@@ -0,0 +1,46 @@
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "pop3://%HOSTIP:%POP3PORT/%TESTNUMBER");
curl_easy_setopt(hnd, CURLOPT_DIRLISTONLY, 1L);
curl_easy_setopt(hnd, CURLOPT_USERPWD, "user:secret");
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may choose to either not use them or implement
them yourself.
CURLOPT_DEBUGFUNCTION was set to a function pointer
CURLOPT_DEBUGDATA was set to an object pointer
CURLOPT_WRITEDATA was set to an object pointer
CURLOPT_WRITEFUNCTION was set to a function pointer
CURLOPT_READDATA was set to an object pointer
CURLOPT_READFUNCTION was set to a function pointer
CURLOPT_SEEKDATA was set to an object pointer
CURLOPT_SEEKFUNCTION was set to a function pointer
CURLOPT_HEADERFUNCTION was set to a function pointer
CURLOPT_HEADERDATA was set to an object pointer
CURLOPT_ERRORBUFFER was set to an object pointer
CURLOPT_STDERR was set to an object pointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
return (int)ret;
}
/**** End of sample code ****/

46
tests/data/data1420.c Normal file
View File

@@ -0,0 +1,46 @@
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "imap://%HOSTIP:%IMAPPORT/%TESTNUMBER/;MAILINDEX=1");
curl_easy_setopt(hnd, CURLOPT_USERPWD, "user:secret");
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/%VERSION");
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may choose to either not use them or implement
them yourself.
CURLOPT_DEBUGFUNCTION was set to a function pointer
CURLOPT_DEBUGDATA was set to an object pointer
CURLOPT_WRITEDATA was set to an object pointer
CURLOPT_WRITEFUNCTION was set to a function pointer
CURLOPT_READDATA was set to an object pointer
CURLOPT_READFUNCTION was set to a function pointer
CURLOPT_SEEKDATA was set to an object pointer
CURLOPT_SEEKFUNCTION was set to a function pointer
CURLOPT_HEADERFUNCTION was set to a function pointer
CURLOPT_HEADERDATA was set to an object pointer
CURLOPT_ERRORBUFFER was set to an object pointer
CURLOPT_STDERR was set to an object pointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
return (int)ret;
}
/**** End of sample code ****/

48
tests/data/data1465.c Normal file
View File

@@ -0,0 +1,48 @@
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER");
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "ab\201cd\000e\\\"\?\r\n\t\001fghi\x1ajklm\xfd");
curl_easy_setopt(hnd, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)24);
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/%VERSION");
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may choose to either not use them or implement
them yourself.
CURLOPT_DEBUGFUNCTION was set to a function pointer
CURLOPT_DEBUGDATA was set to an object pointer
CURLOPT_WRITEDATA was set to an object pointer
CURLOPT_WRITEFUNCTION was set to a function pointer
CURLOPT_READDATA was set to an object pointer
CURLOPT_READFUNCTION was set to a function pointer
CURLOPT_SEEKDATA was set to an object pointer
CURLOPT_SEEKFUNCTION was set to a function pointer
CURLOPT_HEADERFUNCTION was set to a function pointer
CURLOPT_HEADERDATA was set to an object pointer
CURLOPT_ERRORBUFFER was set to an object pointer
CURLOPT_STDERR was set to an object pointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
return (int)ret;
}
/**** End of sample code ****/

49
tests/data/data1481.c Normal file
View File

@@ -0,0 +1,49 @@
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "http://moo/");
curl_easy_setopt(hnd, CURLOPT_PROXY, "http://%HOSTIP:%HTTPPORT");
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/%VERSION");
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
curl_easy_setopt(hnd, CURLOPT_SSLVERSION, (long)(CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_TLSv1_3));
curl_easy_setopt(hnd, CURLOPT_PROXY_SSLVERSION, (long)CURL_SSLVERSION_TLSv1);
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may choose to either not use them or implement
them yourself.
CURLOPT_DEBUGFUNCTION was set to a function pointer
CURLOPT_DEBUGDATA was set to an object pointer
CURLOPT_WRITEDATA was set to an object pointer
CURLOPT_WRITEFUNCTION was set to a function pointer
CURLOPT_READDATA was set to an object pointer
CURLOPT_READFUNCTION was set to a function pointer
CURLOPT_SEEKDATA was set to an object pointer
CURLOPT_SEEKFUNCTION was set to a function pointer
CURLOPT_HEADERFUNCTION was set to a function pointer
CURLOPT_HEADERDATA was set to an object pointer
CURLOPT_ERRORBUFFER was set to an object pointer
CURLOPT_STDERR was set to an object pointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
return (int)ret;
}
/**** End of sample code ****/

View File

@@ -4,7 +4,6 @@
HTTP
HTTP GET
--libcurl
notxml
</keywords>
</info>
@@ -49,7 +48,6 @@ Accept: */*
</protocol>
<stripfile>
s/(USERAGENT, \")[^\"]+/${1}stripped/
# CURLOPT_SSL_VERIFYPEER, SSH_KNOWNHOSTS and HTTP_VERSION vary with
# CURLOPT_INTERLEAVEDATA requires RTSP protocol
# configurations - just ignore them
@@ -62,52 +60,7 @@ $_ = '' if /CURLOPT_INTERLEAVEDATA/
$_ = '' if /CURLOPT_TIMEOUT_MS/
</stripfile>
<file name="%LOGDIR/test%TESTNUMBER.c" mode="text">
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER");
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may choose to either not use them or implement
them yourself.
CURLOPT_DEBUGFUNCTION was set to a function pointer
CURLOPT_DEBUGDATA was set to an object pointer
CURLOPT_WRITEDATA was set to an object pointer
CURLOPT_WRITEFUNCTION was set to a function pointer
CURLOPT_READDATA was set to an object pointer
CURLOPT_READFUNCTION was set to a function pointer
CURLOPT_SEEKDATA was set to an object pointer
CURLOPT_SEEKFUNCTION was set to a function pointer
CURLOPT_HEADERFUNCTION was set to a function pointer
CURLOPT_HEADERDATA was set to an object pointer
CURLOPT_ERRORBUFFER was set to an object pointer
CURLOPT_STDERR was set to an object pointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
return (int)ret;
}
/**** End of sample code ****/
%includetext %SRCDIR/data/data1400.c%
</file>
</verify>
</testcase>

View File

@@ -7,7 +7,6 @@ HTTP Basic auth
HTTP set cookie
cookies
--libcurl
notxml
</keywords>
</info>
@@ -71,64 +70,7 @@ $_ = '' if /CURLOPT_SSLVERSION/
$_ = '' if /CURLOPT_TIMEOUT_MS/
</stripfile>
<file name="%LOGDIR/test%TESTNUMBER.c" mode="text">
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
struct curl_slist *slist1;
slist1 = NULL;
slist1 = curl_slist_append(slist1, "X-Files: Mulder");
slist1 = curl_slist_append(slist1, "X-Men: cyclops, iceman");
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER");
curl_easy_setopt(hnd, CURLOPT_USERPWD, "fake:user");
curl_easy_setopt(hnd, CURLOPT_HTTPAUTH, (long)CURLAUTH_BASIC);
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, slist1);
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "MyUA");
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
curl_easy_setopt(hnd, CURLOPT_COOKIE, "chocolate=chip");
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
curl_easy_setopt(hnd, CURLOPT_PROTOCOLS_STR, "file,ftp,http");
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may choose to either not use them or implement
them yourself.
CURLOPT_DEBUGFUNCTION was set to a function pointer
CURLOPT_DEBUGDATA was set to an object pointer
CURLOPT_WRITEDATA was set to an object pointer
CURLOPT_WRITEFUNCTION was set to a function pointer
CURLOPT_READDATA was set to an object pointer
CURLOPT_READFUNCTION was set to a function pointer
CURLOPT_SEEKDATA was set to an object pointer
CURLOPT_SEEKFUNCTION was set to a function pointer
CURLOPT_HEADERFUNCTION was set to a function pointer
CURLOPT_HEADERDATA was set to an object pointer
CURLOPT_ERRORBUFFER was set to an object pointer
CURLOPT_STDERR was set to an object pointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
curl_slist_free_all(slist1);
slist1 = NULL;
return (int)ret;
}
/**** End of sample code ****/
%includetext %SRCDIR/data/data1401.c%
</file>
</verify>
</testcase>

View File

@@ -53,8 +53,6 @@ Content-Type: application/x-www-form-urlencoded
foo=bar&baz=quux
</protocol>
<stripfile>
# curl's default user-agent varies with version, libraries etc.
s/(USERAGENT, \")[^\"]+/${1}stripped/
# CURLOPT_SSL_VERIFYPEER, SSH_KNOWNHOSTS and HTTP_VERSION vary with
# configurations - just ignore them
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
@@ -65,54 +63,7 @@ $_ = '' if /CURLOPT_SSLVERSION/
$_ = '' if /CURLOPT_TIMEOUT_MS/
</stripfile>
<file name="%LOGDIR/test%TESTNUMBER.c" mode="text">
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER");
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "foo=bar&baz=quux");
curl_easy_setopt(hnd, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)16);
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may choose to either not use them or implement
them yourself.
CURLOPT_DEBUGFUNCTION was set to a function pointer
CURLOPT_DEBUGDATA was set to an object pointer
CURLOPT_WRITEDATA was set to an object pointer
CURLOPT_WRITEFUNCTION was set to a function pointer
CURLOPT_READDATA was set to an object pointer
CURLOPT_READFUNCTION was set to a function pointer
CURLOPT_SEEKDATA was set to an object pointer
CURLOPT_SEEKFUNCTION was set to a function pointer
CURLOPT_HEADERFUNCTION was set to a function pointer
CURLOPT_HEADERDATA was set to an object pointer
CURLOPT_ERRORBUFFER was set to an object pointer
CURLOPT_STDERR was set to an object pointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
return (int)ret;
}
/**** End of sample code ****/
%includetext %SRCDIR/data/data1402.c%
</file>
</verify>
</testcase>

View File

@@ -50,8 +50,6 @@ Accept: */*
</protocol>
<stripfile>
# curl's default user-agent varies with version, libraries etc.
s/(USERAGENT, \")[^\"]+/${1}stripped/
# CURLOPT_SSL_VERIFYPEER, SSH_KNOWNHOSTS and HTTP_VERSION vary with
# configurations - just ignore them
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
@@ -62,52 +60,7 @@ $_ = '' if /CURLOPT_SSLVERSION/
$_ = '' if /CURLOPT_TIMEOUT_MS/
</stripfile>
<file name="%LOGDIR/test%TESTNUMBER.c" mode="text">
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER\?foo=bar&baz=quux");
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may choose to either not use them or implement
them yourself.
CURLOPT_DEBUGFUNCTION was set to a function pointer
CURLOPT_DEBUGDATA was set to an object pointer
CURLOPT_WRITEDATA was set to an object pointer
CURLOPT_WRITEFUNCTION was set to a function pointer
CURLOPT_READDATA was set to an object pointer
CURLOPT_READFUNCTION was set to a function pointer
CURLOPT_SEEKDATA was set to an object pointer
CURLOPT_SEEKFUNCTION was set to a function pointer
CURLOPT_HEADERFUNCTION was set to a function pointer
CURLOPT_HEADERDATA was set to an object pointer
CURLOPT_ERRORBUFFER was set to an object pointer
CURLOPT_STDERR was set to an object pointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
return (int)ret;
}
/**** End of sample code ****/
%includetext %SRCDIR/data/data1403.c%
</file>
</verify>
</testcase>

View File

@@ -6,7 +6,6 @@ HTTP
HTTP FORMPOST
HTTP file upload
--libcurl
notxml
</keywords>
</info>
@@ -95,8 +94,6 @@ dummy data
------------------------------9ef8d6205763--%CR
</protocol>
<stripfile>
# curl's default user-agent varies with version, libraries etc.
s/(USERAGENT, \")[^\"]+/${1}stripped/
# CURLOPT_SSL_VERIFYPEER, SSH_KNOWNHOSTS and HTTP_VERSION vary with
# configurations - just ignore them
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
@@ -109,89 +106,7 @@ $_ = '' if /CURLOPT_TIMEOUT_MS/
$_ = '' if /\/\* "value" \*\//
</stripfile>
<file name="%LOGDIR/test%TESTNUMBER.c" mode="text">
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
curl_mime *mime1;
curl_mimepart *part1;
curl_mime *mime2;
curl_mimepart *part2;
struct curl_slist *slist1;
mime1 = NULL;
mime2 = NULL;
slist1 = NULL;
slist1 = curl_slist_append(slist1, "X-testheader-1: header 1");
slist1 = curl_slist_append(slist1, "X-testheader-2: header 2");
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER");
mime1 = curl_mime_init(hnd);
part1 = curl_mime_addpart(mime1);
curl_mime_data(part1, "value", CURL_ZERO_TERMINATED);
curl_mime_name(part1, "name");
part1 = curl_mime_addpart(mime1);
mime2 = curl_mime_init(hnd);
part2 = curl_mime_addpart(mime2);
curl_mime_filedata(part2, "%LOGDIR/test%TESTNUMBER.txt");
part2 = curl_mime_addpart(mime2);
curl_mime_filedata(part2, "%LOGDIR/test%TESTNUMBER.txt");
curl_mime_encoder(part2, "8bit");
curl_mime_type(part2, "magic/content");
part2 = curl_mime_addpart(mime2);
curl_mime_filedata(part2, "%LOGDIR/test%TESTNUMBER.txt");
curl_mime_headers(part2, slist1, 1);
slist1 = NULL;
curl_mime_subparts(part1, mime2);
mime2 = NULL;
curl_mime_name(part1, "file");
curl_easy_setopt(hnd, CURLOPT_MIMEPOST, mime1);
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may choose to either not use them or implement
them yourself.
CURLOPT_DEBUGFUNCTION was set to a function pointer
CURLOPT_DEBUGDATA was set to an object pointer
CURLOPT_WRITEDATA was set to an object pointer
CURLOPT_WRITEFUNCTION was set to a function pointer
CURLOPT_READDATA was set to an object pointer
CURLOPT_READFUNCTION was set to a function pointer
CURLOPT_SEEKDATA was set to an object pointer
CURLOPT_SEEKFUNCTION was set to a function pointer
CURLOPT_HEADERFUNCTION was set to a function pointer
CURLOPT_HEADERDATA was set to an object pointer
CURLOPT_ERRORBUFFER was set to an object pointer
CURLOPT_STDERR was set to an object pointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
curl_mime_free(mime1);
mime1 = NULL;
curl_mime_free(mime2);
mime2 = NULL;
curl_slist_free_all(slist1);
slist1 = NULL;
return (int)ret;
}
/**** End of sample code ****/
%includetext %SRCDIR/data/data1404.c%
</file>
</verify>
</testcase>

View File

@@ -6,7 +6,6 @@ FTP
post-quote
pre-quote
--libcurl
notxml
</keywords>
</info>
# Server-side
@@ -62,74 +61,6 @@ RETR %TESTNUMBER
NOOP 3
QUIT
</protocol>
<file name="%LOGDIR/test%TESTNUMBER.c" mode="text">
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
struct curl_slist *slist1;
struct curl_slist *slist2;
struct curl_slist *slist3;
slist1 = NULL;
slist1 = curl_slist_append(slist1, "NOOP 1");
slist1 = curl_slist_append(slist1, "*FAIL");
slist2 = NULL;
slist2 = curl_slist_append(slist2, "NOOP 3");
slist3 = NULL;
slist3 = curl_slist_append(slist3, "NOOP 2");
slist3 = curl_slist_append(slist3, "*FAIL HARD");
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "ftp://%HOSTIP:%FTPPORT/%TESTNUMBER");
curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
curl_easy_setopt(hnd, CURLOPT_QUOTE, slist1);
curl_easy_setopt(hnd, CURLOPT_POSTQUOTE, slist2);
curl_easy_setopt(hnd, CURLOPT_PREQUOTE, slist3);
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may choose to either not use them or implement
them yourself.
CURLOPT_DEBUGFUNCTION was set to a function pointer
CURLOPT_DEBUGDATA was set to an object pointer
CURLOPT_WRITEDATA was set to an object pointer
CURLOPT_WRITEFUNCTION was set to a function pointer
CURLOPT_READDATA was set to an object pointer
CURLOPT_READFUNCTION was set to a function pointer
CURLOPT_SEEKDATA was set to an object pointer
CURLOPT_SEEKFUNCTION was set to a function pointer
CURLOPT_HEADERFUNCTION was set to a function pointer
CURLOPT_HEADERDATA was set to an object pointer
CURLOPT_ERRORBUFFER was set to an object pointer
CURLOPT_STDERR was set to an object pointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
curl_slist_free_all(slist1);
slist1 = NULL;
curl_slist_free_all(slist2);
slist2 = NULL;
curl_slist_free_all(slist3);
slist3 = NULL;
return (int)ret;
}
/**** End of sample code ****/
</file>
<stripfile>
# CURLOPT_USERAGENT and CURLOPT_MAXREDIRS requires HTTP protocol
# CURLOPT_INTERLEAVEDATA requires RTSP (HTTP) protocol
@@ -146,5 +77,8 @@ $_ = '' if /CURLOPT_INTERLEAVEDATA/
$_ = '' if /CURLOPT_SSLVERSION/
$_ = '' if /CURLOPT_TIMEOUT_MS/
</stripfile>
<file name="%LOGDIR/test%TESTNUMBER.c" mode="text">
%includetext %SRCDIR/data/data1405.c%
</file>
</verify>
</testcase>

View File

@@ -5,7 +5,6 @@
<keywords>
SMTP
--libcurl
notxml
</keywords>
</info>
@@ -63,67 +62,9 @@ To: another
body
.
</upload>
<file name="%LOGDIR/test%TESTNUMBER.c" mode="text">
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
struct curl_slist *slist1;
slist1 = NULL;
slist1 = curl_slist_append(slist1, "recipient.one@example.com");
slist1 = curl_slist_append(slist1, "recipient.two@example.com");
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "smtp://%HOSTIP:%SMTPPORT/%TESTNUMBER");
curl_easy_setopt(hnd, CURLOPT_UPLOAD, 1L);
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
curl_easy_setopt(hnd, CURLOPT_MAIL_FROM, "sender@example.com");
curl_easy_setopt(hnd, CURLOPT_MAIL_RCPT, slist1);
curl_easy_setopt(hnd, CURLOPT_INFILESIZE_LARGE, (curl_off_t)38);
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may choose to either not use them or implement
them yourself.
CURLOPT_DEBUGFUNCTION was set to a function pointer
CURLOPT_DEBUGDATA was set to an object pointer
CURLOPT_WRITEDATA was set to an object pointer
CURLOPT_WRITEFUNCTION was set to a function pointer
CURLOPT_READDATA was set to an object pointer
CURLOPT_READFUNCTION was set to a function pointer
CURLOPT_SEEKDATA was set to an object pointer
CURLOPT_SEEKFUNCTION was set to a function pointer
CURLOPT_HEADERFUNCTION was set to a function pointer
CURLOPT_HEADERDATA was set to an object pointer
CURLOPT_ERRORBUFFER was set to an object pointer
CURLOPT_STDERR was set to an object pointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
curl_slist_free_all(slist1);
slist1 = NULL;
return (int)ret;
}
/**** End of sample code ****/
</file>
<stripfile>
# These options vary with configurations - just ignore them
# CURLOPT_INTERLEAVEDATA requires RTSP (HTTP) protocol
$_ = '' if /CURLOPT_USERAGENT/
$_ = '' if /CURLOPT_MAXREDIRS/
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
$_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
@@ -133,5 +74,8 @@ $_ = '' if /CURLOPT_INTERLEAVEDATA/
$_ = '' if /CURLOPT_SSLVERSION/
$_ = '' if /CURLOPT_TIMEOUT_MS/
</stripfile>
<file name="%LOGDIR/test%TESTNUMBER.c" mode="text">
%includetext %SRCDIR/data/data1406.c%
</file>
</verify>
</testcase>

View File

@@ -6,7 +6,6 @@ POP3
Clear Text
LIST
--libcurl
notxml
</keywords>
</info>
@@ -50,56 +49,9 @@ PASS secret
LIST %TESTNUMBER
QUIT
</protocol>
<file name="%LOGDIR/test%TESTNUMBER.c" mode="text">
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "pop3://%HOSTIP:%POP3PORT/%TESTNUMBER");
curl_easy_setopt(hnd, CURLOPT_DIRLISTONLY, 1L);
curl_easy_setopt(hnd, CURLOPT_USERPWD, "user:secret");
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may choose to either not use them or implement
them yourself.
CURLOPT_DEBUGFUNCTION was set to a function pointer
CURLOPT_DEBUGDATA was set to an object pointer
CURLOPT_WRITEDATA was set to an object pointer
CURLOPT_WRITEFUNCTION was set to a function pointer
CURLOPT_READDATA was set to an object pointer
CURLOPT_READFUNCTION was set to a function pointer
CURLOPT_SEEKDATA was set to an object pointer
CURLOPT_SEEKFUNCTION was set to a function pointer
CURLOPT_HEADERFUNCTION was set to a function pointer
CURLOPT_HEADERDATA was set to an object pointer
CURLOPT_ERRORBUFFER was set to an object pointer
CURLOPT_STDERR was set to an object pointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
return (int)ret;
}
/**** End of sample code ****/
</file>
<stripfile>
# These options vary with configurations - just ignore them
# CURLOPT_USERAGENT and CURLOPT_MAXREDIRS requires HTTP protocol
# CURLOPT_INTERLEAVEDATA requires RTSP (HTTP) protocol
$_ = '' if /CURLOPT_USERAGENT/
$_ = '' if /CURLOPT_MAXREDIRS/
@@ -111,5 +63,8 @@ $_ = '' if /CURLOPT_INTERLEAVEDATA/
$_ = '' if /CURLOPT_SSLVERSION/
$_ = '' if /CURLOPT_TIMEOUT_MS/
</stripfile>
<file name="%LOGDIR/test%TESTNUMBER.c" mode="text">
%includetext %SRCDIR/data/data1407.c%
</file>
</verify>
</testcase>

View File

@@ -6,7 +6,6 @@ IMAP
Clear Text
FETCH
--libcurl
notxml
</keywords>
</info>
@@ -56,57 +55,9 @@ A003 SELECT %TESTNUMBER
A004 FETCH 1 BODY[]
A005 LOGOUT
</protocol>
<file name="%LOGDIR/test%TESTNUMBER.c" mode="text">
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "imap://%HOSTIP:%IMAPPORT/%TESTNUMBER/;MAILINDEX=1");
curl_easy_setopt(hnd, CURLOPT_USERPWD, "user:secret");
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may choose to either not use them or implement
them yourself.
CURLOPT_DEBUGFUNCTION was set to a function pointer
CURLOPT_DEBUGDATA was set to an object pointer
CURLOPT_WRITEDATA was set to an object pointer
CURLOPT_WRITEFUNCTION was set to a function pointer
CURLOPT_READDATA was set to an object pointer
CURLOPT_READFUNCTION was set to a function pointer
CURLOPT_SEEKDATA was set to an object pointer
CURLOPT_SEEKFUNCTION was set to a function pointer
CURLOPT_HEADERFUNCTION was set to a function pointer
CURLOPT_HEADERDATA was set to an object pointer
CURLOPT_ERRORBUFFER was set to an object pointer
CURLOPT_STDERR was set to an object pointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
return (int)ret;
}
/**** End of sample code ****/
</file>
<stripfile>
# These options vary with configurations - just ignore them
# CURLOPT_INTERLEAVEDATA requires RTSP (HTTP) protocol
$_ = '' if /CURLOPT_USERAGENT/
$_ = '' if /CURLOPT_MAXREDIRS/
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
$_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
@@ -115,5 +66,8 @@ $_ = '' if /CURLOPT_INTERLEAVEDATA/
$_ = '' if /CURLOPT_SSLVERSION/
$_ = '' if /CURLOPT_TIMEOUT_MS/
</stripfile>
<file name="%LOGDIR/test%TESTNUMBER.c" mode="text">
%includetext %SRCDIR/data/data1420.c%
</file>
</verify>
</testcase>

View File

@@ -4,7 +4,6 @@
HTTP
HTTP POST
--libcurl
notxml
</keywords>
</info>
@@ -57,7 +56,6 @@ Content-Type: application/x-www-form-urlencoded
%hex[ab%81cd%00e\"?%0D%0A%09%01fghi%1Ajklm%FD]hex%
</protocol>
<stripfile>
# CURLOPT_SSL_VERIFYPEER, SSH_KNOWNHOSTS and HTTP_VERSION vary with
# configurations - just ignore them
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
@@ -68,54 +66,7 @@ $_ = '' if /CURLOPT_SSLVERSION/
$_ = '' if /CURLOPT_TIMEOUT_MS/
</stripfile>
<file name="%LOGDIR/test%TESTNUMBER.c" mode="text">
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER");
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "ab\201cd\000e\\\"\?\r\n\t\001fghi\x1ajklm\xfd");
curl_easy_setopt(hnd, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)24);
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/%VERSION");
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may choose to either not use them or implement
them yourself.
CURLOPT_DEBUGFUNCTION was set to a function pointer
CURLOPT_DEBUGDATA was set to an object pointer
CURLOPT_WRITEDATA was set to an object pointer
CURLOPT_WRITEFUNCTION was set to a function pointer
CURLOPT_READDATA was set to an object pointer
CURLOPT_READFUNCTION was set to a function pointer
CURLOPT_SEEKDATA was set to an object pointer
CURLOPT_SEEKFUNCTION was set to a function pointer
CURLOPT_HEADERFUNCTION was set to a function pointer
CURLOPT_HEADERDATA was set to an object pointer
CURLOPT_ERRORBUFFER was set to an object pointer
CURLOPT_STDERR was set to an object pointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
return (int)ret;
}
/**** End of sample code ****/
%includetext %SRCDIR/data/data1465.c%
</file>
</verify>
</testcase>

View File

@@ -4,7 +4,6 @@
HTTP
HTTP GET
--libcurl
notxml
</keywords>
</info>
@@ -52,7 +51,6 @@ Proxy-Connection: Keep-Alive
</protocol>
<stripfile>
s/(USERAGENT, \")[^\"]+/${1}stripped/
# CURLOPT_SSL_VERIFYPEER, SSH_KNOWNHOSTS and HTTP_VERSION vary with
# CURLOPT_INTERLEAVEDATA requires RTSP protocol
# configurations - just ignore them
@@ -64,55 +62,7 @@ $_ = '' if /CURLOPT_INTERLEAVEDATA/
$_ = '' if /CURLOPT_TIMEOUT_MS/
</stripfile>
<file name="%LOGDIR/test%TESTNUMBER.c" mode="text">
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "http://moo/");
curl_easy_setopt(hnd, CURLOPT_PROXY, "http://%HOSTIP:%HTTPPORT");
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
curl_easy_setopt(hnd, CURLOPT_SSLVERSION, (long)(CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_TLSv1_3));
curl_easy_setopt(hnd, CURLOPT_PROXY_SSLVERSION, (long)CURL_SSLVERSION_TLSv1);
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
/* Here is a list of options the curl code used that cannot get generated
as source easily. You may choose to either not use them or implement
them yourself.
CURLOPT_DEBUGFUNCTION was set to a function pointer
CURLOPT_DEBUGDATA was set to an object pointer
CURLOPT_WRITEDATA was set to an object pointer
CURLOPT_WRITEFUNCTION was set to a function pointer
CURLOPT_READDATA was set to an object pointer
CURLOPT_READFUNCTION was set to a function pointer
CURLOPT_SEEKDATA was set to an object pointer
CURLOPT_SEEKFUNCTION was set to a function pointer
CURLOPT_HEADERFUNCTION was set to a function pointer
CURLOPT_HEADERDATA was set to an object pointer
CURLOPT_ERRORBUFFER was set to an object pointer
CURLOPT_STDERR was set to an object pointer
*/
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
return (int)ret;
}
/**** End of sample code ****/
%includetext %SRCDIR/data/data1481.c%
</file>
</verify>
</testcase>

View File

@@ -101,6 +101,8 @@ use testutil qw(
logmsg
runclient
exerunner
subtextfile
subchars
subbase64
subsha256base64file
substrippemfile
@@ -367,6 +369,10 @@ sub prepro {
$data_crlf = "";
}
subvariables(\$s, $testnum, "%");
if(subtextfile(\$s)) {
subvariables(\$s, $testnum, "%");
}
subchars(\$s);
subbase64(\$s);
subsha256base64file(\$s);
substrippemfile(\$s);

View File

@@ -38,6 +38,8 @@ BEGIN {
runclientoutput
setlogfunc
exerunner
subtextfile
subchars
subbase64
subnewlines
subsha256base64file
@@ -110,6 +112,25 @@ sub includefile {
return join("", @a);
}
sub subtextfile {
my ($thing) = @_;
my $count = ($$thing =~ s/%includetext ([^%]*)%[\n\r]+/includefile($1, 1)/ge);
return $count > 0;
}
sub subchars {
my ($thing) = @_;
$$thing =~ s/%SP/ /g; # space
$$thing =~ s/%TAB/\t/g; # horizontal tab
$$thing =~ s/%CR/\r/g; # carriage return aka \r aka 0x0d
$$thing =~ s/%LT/</g;
$$thing =~ s/%GT/>/g;
$$thing =~ s/%AMP/&/g;
}
sub subbase64 {
my ($thing) = @_;
@@ -150,16 +171,6 @@ sub subbase64 {
$$thing =~ s/%%DAYS%%/%alternatives[$d,$d2]/;
}
# include a file, expand space macros
$$thing =~ s/%includetext ([^%]*)%[\n\r]+/includefile($1, 1)/ge;
$$thing =~ s/%SP/ /g; # space
$$thing =~ s/%TAB/\t/g; # horizontal tab
$$thing =~ s/%CR/\r/g; # carriage return aka \r aka 0x0d
$$thing =~ s/%LT/</g;
$$thing =~ s/%GT/>/g;
$$thing =~ s/%AMP/&/g;
# include a file
$$thing =~ s/%include ([^%]*)%[\n\r]+/includefile($1, 0)/ge;
}