mirror of
https://github.com/moparisthebest/curl
synced 2024-08-13 17:03:50 -04:00
Add tests for curl's --libcurl output.
These tests check the output of the --libcurl option of curl, including the improved option handling added in a related patch.
This commit is contained in:
parent
9954242980
commit
c3cae332c5
@ -83,6 +83,7 @@ test1300 test1301 test1302 test1303 test1304 test1305 \
|
|||||||
test1306 test1307 test1308 test1309 test1310 test1311 test1312 test1313 \
|
test1306 test1307 test1308 test1309 test1310 test1311 test1312 test1313 \
|
||||||
test1314 test1315 test1316 test1317 test1318 test1319 test1320 test1321 \
|
test1314 test1315 test1316 test1317 test1318 test1319 test1320 test1321 \
|
||||||
test1322 test1323 test1324 test1325 test1326 test1327 test1328 test1329 \
|
test1322 test1323 test1324 test1325 test1326 test1327 test1328 test1329 \
|
||||||
|
test1400 test1401 test1402 test1403 test1404 test1405 test1406 test1407 \
|
||||||
test2000 test2001 test2002 test2003 test2004
|
test2000 test2001 test2002 test2003 test2004
|
||||||
|
|
||||||
EXTRA_DIST = $(TESTCASES) DISABLED
|
EXTRA_DIST = $(TESTCASES) DISABLED
|
||||||
|
98
tests/data/test1400
Normal file
98
tests/data/test1400
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
<testcase>
|
||||||
|
<info>
|
||||||
|
<keywords>
|
||||||
|
HTTP
|
||||||
|
--libcurl
|
||||||
|
</keywords>
|
||||||
|
</info>
|
||||||
|
|
||||||
|
# Server-side
|
||||||
|
<reply>
|
||||||
|
<data>
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
Date: Thu, 29 Jul 2008 14:49:00 GMT
|
||||||
|
Server: test-server/fake
|
||||||
|
Content-Length: 0
|
||||||
|
Connection: close
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</reply>
|
||||||
|
|
||||||
|
# Client-side
|
||||||
|
<client>
|
||||||
|
<server>
|
||||||
|
http
|
||||||
|
</server>
|
||||||
|
<name>
|
||||||
|
--libcurl for simple HTTP GET
|
||||||
|
</name>
|
||||||
|
<command>
|
||||||
|
http://%HOSTIP:%HTTPPORT/we/want/1400 --libcurl log/test1400.c
|
||||||
|
</command>
|
||||||
|
</client>
|
||||||
|
|
||||||
|
# Verify data after the test has been "shot"
|
||||||
|
<verify>
|
||||||
|
<strip>
|
||||||
|
^User-Agent:.*
|
||||||
|
</strip>
|
||||||
|
<protocol>
|
||||||
|
GET /we/want/1400 HTTP/1.1
|
||||||
|
User-Agent: curl/7.18.2 (i686-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.7a ipv6 zlib/1.1.4
|
||||||
|
Host: %HOSTIP:%HTTPPORT
|
||||||
|
Accept: */*
|
||||||
|
|
||||||
|
</protocol>
|
||||||
|
<stripfile>
|
||||||
|
s/(USERAGENT, \")[^\"]+/${1}stripped/
|
||||||
|
# CURLOPT_SSL_VERIFYPEER varies with configuration - just ignore it
|
||||||
|
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
|
||||||
|
</stripfile>
|
||||||
|
<file name="log/test1400.c">
|
||||||
|
/********* Sample code generated by the curl command line tool **********
|
||||||
|
* All curl_easy_setopt() options are documented at:
|
||||||
|
* http://curl.haxx.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_URL, "http://%HOSTIP:%HTTPPORT/we/want/1400");
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_HEADER, 1L);
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
|
||||||
|
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 select to either not use them or implement
|
||||||
|
them yourself.
|
||||||
|
|
||||||
|
CURLOPT_WRITEDATA set to a objectpointer
|
||||||
|
CURLOPT_WRITEFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_READDATA set to a objectpointer
|
||||||
|
CURLOPT_READFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_SEEKDATA set to a objectpointer
|
||||||
|
CURLOPT_SEEKFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_ERRORBUFFER set to a objectpointer
|
||||||
|
CURLOPT_STDERR set to a objectpointer
|
||||||
|
CURLOPT_DEBUGFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_DEBUGDATA set to a objectpointer
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
ret = curl_easy_perform(hnd);
|
||||||
|
|
||||||
|
curl_easy_cleanup(hnd);
|
||||||
|
hnd = NULL;
|
||||||
|
|
||||||
|
return (int)ret;
|
||||||
|
}
|
||||||
|
/**** End of sample code ****/
|
||||||
|
</file>
|
||||||
|
</verify>
|
||||||
|
</testcase>
|
119
tests/data/test1401
Normal file
119
tests/data/test1401
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
<testcase>
|
||||||
|
<info>
|
||||||
|
<keywords>
|
||||||
|
HTTP
|
||||||
|
HTTP Basic auth
|
||||||
|
--libcurl
|
||||||
|
</keywords>
|
||||||
|
</info>
|
||||||
|
|
||||||
|
# Server-side
|
||||||
|
<reply>
|
||||||
|
<data>
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
Date: Thu, 29 Jul 2008 14:49:00 GMT
|
||||||
|
Server: test-server/fake
|
||||||
|
Content-Length: 0
|
||||||
|
Content-Type: text/plain
|
||||||
|
Connection: close
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</reply>
|
||||||
|
|
||||||
|
# Client-side
|
||||||
|
<client>
|
||||||
|
<server>
|
||||||
|
http
|
||||||
|
</server>
|
||||||
|
<name>
|
||||||
|
--libcurl for GET with various options
|
||||||
|
</name>
|
||||||
|
<command>
|
||||||
|
http://%HOSTIP:%HTTPPORT/we/want/1401 --libcurl log/test1401.c --basic -u fake:user -H "X-Files: Mulder" -H "X-Men: cyclops, iceman" -A MyUA -b chocolate=chip --proto "=http,ftp,file"
|
||||||
|
</command>
|
||||||
|
</client>
|
||||||
|
|
||||||
|
# Verify data after the test has been "shot"
|
||||||
|
<verify>
|
||||||
|
<strip>
|
||||||
|
^User-Agent:.*
|
||||||
|
</strip>
|
||||||
|
<protocol>
|
||||||
|
GET /we/want/1401 HTTP/1.1
|
||||||
|
User-Agent: stripped
|
||||||
|
Authorization: Basic ZmFrZTp1c2Vy
|
||||||
|
Host: %HOSTIP:%HTTPPORT
|
||||||
|
Accept: */*
|
||||||
|
Cookie: chocolate=chip
|
||||||
|
X-Files: Mulder
|
||||||
|
X-Men: cyclops, iceman
|
||||||
|
|
||||||
|
</protocol>
|
||||||
|
<stripfile>
|
||||||
|
# CURLOPT_SSL_VERIFYPEER varies with configuration - just ignore it
|
||||||
|
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
|
||||||
|
</stripfile>
|
||||||
|
<file name="log/test1401.c">
|
||||||
|
/********* Sample code generated by the curl command line tool **********
|
||||||
|
* All curl_easy_setopt() options are documented at:
|
||||||
|
* http://curl.haxx.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_URL, "http://%HOSTIP:%HTTPPORT/we/want/1401");
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_HEADER, 1L);
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_USERPWD, "fake:user");
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "MyUA");
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, slist1);
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_HTTPAUTH, (long)CURLAUTH_BASIC);
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_COOKIE, "chocolate=chip");
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_PROTOCOLS, (long)CURLPROTO_FILE |
|
||||||
|
(long)CURLPROTO_FTP |
|
||||||
|
(long)CURLPROTO_HTTP);
|
||||||
|
|
||||||
|
/* Here is a list of options the curl code used that cannot get generated
|
||||||
|
as source easily. You may select to either not use them or implement
|
||||||
|
them yourself.
|
||||||
|
|
||||||
|
CURLOPT_WRITEDATA set to a objectpointer
|
||||||
|
CURLOPT_WRITEFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_READDATA set to a objectpointer
|
||||||
|
CURLOPT_READFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_SEEKDATA set to a objectpointer
|
||||||
|
CURLOPT_SEEKFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_ERRORBUFFER set to a objectpointer
|
||||||
|
CURLOPT_STDERR set to a objectpointer
|
||||||
|
CURLOPT_DEBUGFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_DEBUGDATA set to a objectpointer
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
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>
|
||||||
|
<stdout>
|
||||||
|
</stdout>
|
||||||
|
</verify>
|
||||||
|
</testcase>
|
108
tests/data/test1402
Normal file
108
tests/data/test1402
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
<testcase>
|
||||||
|
<info>
|
||||||
|
<keywords>
|
||||||
|
HTTP
|
||||||
|
HTTP POST
|
||||||
|
--libcurl
|
||||||
|
</keywords>
|
||||||
|
</info>
|
||||||
|
|
||||||
|
# Server-side
|
||||||
|
<reply>
|
||||||
|
<data>
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
Date: Thu, 29 Jul 2008 14:49:00 GMT
|
||||||
|
Server: test-server/fake
|
||||||
|
Content-Length: 0
|
||||||
|
Content-Type: text/plain
|
||||||
|
Connection: close
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</reply>
|
||||||
|
|
||||||
|
# Client-side
|
||||||
|
<client>
|
||||||
|
<server>
|
||||||
|
http
|
||||||
|
</server>
|
||||||
|
<name>
|
||||||
|
--libcurl for simple POST
|
||||||
|
</name>
|
||||||
|
<command>
|
||||||
|
http://%HOSTIP:%HTTPPORT/we/want/1402 --libcurl log/test1402.c -d "foo=bar" -d "baz=quux"
|
||||||
|
</command>
|
||||||
|
</client>
|
||||||
|
|
||||||
|
# Verify data after the test has been "shot"
|
||||||
|
<verify>
|
||||||
|
<strip>
|
||||||
|
^User-Agent:.*
|
||||||
|
</strip>
|
||||||
|
<protocol nonewline="yes">
|
||||||
|
POST /we/want/1402 HTTP/1.1
|
||||||
|
User-Agent: curl/7.18.2 (i686-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.7a ipv6 zlib/1.1.4
|
||||||
|
Host: %HOSTIP:%HTTPPORT
|
||||||
|
Accept: */*
|
||||||
|
Content-Length: 16
|
||||||
|
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 varies with configuration - just ignore it
|
||||||
|
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
|
||||||
|
</stripfile>
|
||||||
|
<file name="log/test1402.c">
|
||||||
|
/********* Sample code generated by the curl command line tool **********
|
||||||
|
* All curl_easy_setopt() options are documented at:
|
||||||
|
* http://curl.haxx.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_URL, "http://%HOSTIP:%HTTPPORT/we/want/1402");
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_HEADER, 1L);
|
||||||
|
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_VERBOSE, 1L);
|
||||||
|
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 select to either not use them or implement
|
||||||
|
them yourself.
|
||||||
|
|
||||||
|
CURLOPT_WRITEDATA set to a objectpointer
|
||||||
|
CURLOPT_WRITEFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_READDATA set to a objectpointer
|
||||||
|
CURLOPT_READFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_SEEKDATA set to a objectpointer
|
||||||
|
CURLOPT_SEEKFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_ERRORBUFFER set to a objectpointer
|
||||||
|
CURLOPT_STDERR set to a objectpointer
|
||||||
|
CURLOPT_DEBUGFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_DEBUGDATA set to a objectpointer
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
ret = curl_easy_perform(hnd);
|
||||||
|
|
||||||
|
curl_easy_cleanup(hnd);
|
||||||
|
hnd = NULL;
|
||||||
|
|
||||||
|
return (int)ret;
|
||||||
|
}
|
||||||
|
/**** End of sample code ****/
|
||||||
|
</file>
|
||||||
|
<stdout>
|
||||||
|
</stdout>
|
||||||
|
</verify>
|
||||||
|
</testcase>
|
103
tests/data/test1403
Normal file
103
tests/data/test1403
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
<testcase>
|
||||||
|
<info>
|
||||||
|
<keywords>
|
||||||
|
HTTP
|
||||||
|
HTTP GET
|
||||||
|
--libcurl
|
||||||
|
</keywords>
|
||||||
|
</info>
|
||||||
|
|
||||||
|
# Server-side
|
||||||
|
<reply>
|
||||||
|
<data>
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
Date: Thu, 29 Jul 2008 14:49:00 GMT
|
||||||
|
Server: test-server/fake
|
||||||
|
Content-Length: 0
|
||||||
|
Content-Type: text/plain
|
||||||
|
Connection: close
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</reply>
|
||||||
|
|
||||||
|
# Client-side
|
||||||
|
<client>
|
||||||
|
<server>
|
||||||
|
http
|
||||||
|
</server>
|
||||||
|
<name>
|
||||||
|
--libcurl for GET with query
|
||||||
|
</name>
|
||||||
|
<command>
|
||||||
|
http://%HOSTIP:%HTTPPORT/we/want/1403 --libcurl log/test1403.c -G -d "foo=bar" -d "baz=quux"
|
||||||
|
</command>
|
||||||
|
</client>
|
||||||
|
|
||||||
|
# Verify data after the test has been "shot"
|
||||||
|
<verify>
|
||||||
|
<strip>
|
||||||
|
^User-Agent:.*
|
||||||
|
</strip>
|
||||||
|
<protocol>
|
||||||
|
GET /we/want/1403?foo=bar&baz=quux HTTP/1.1
|
||||||
|
User-Agent: curl/7.18.2 (i686-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.7a ipv6 zlib/1.1.4
|
||||||
|
Host: %HOSTIP:%HTTPPORT
|
||||||
|
Accept: */*
|
||||||
|
|
||||||
|
</protocol>
|
||||||
|
<stripfile>
|
||||||
|
# curl's default user-agent varies with version, libraries etc.
|
||||||
|
s/(USERAGENT, \")[^\"]+/${1}stripped/
|
||||||
|
# CURLOPT_SSL_VERIFYPEER varies with configuration - just ignore it
|
||||||
|
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
|
||||||
|
</stripfile>
|
||||||
|
<file name="log/test1403.c">
|
||||||
|
/********* Sample code generated by the curl command line tool **********
|
||||||
|
* All curl_easy_setopt() options are documented at:
|
||||||
|
* http://curl.haxx.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_URL, "http://%HOSTIP:%HTTPPORT/we/want/1403?foo=bar&baz=quux");
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_HEADER, 1L);
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
|
||||||
|
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 select to either not use them or implement
|
||||||
|
them yourself.
|
||||||
|
|
||||||
|
CURLOPT_WRITEDATA set to a objectpointer
|
||||||
|
CURLOPT_WRITEFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_READDATA set to a objectpointer
|
||||||
|
CURLOPT_READFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_SEEKDATA set to a objectpointer
|
||||||
|
CURLOPT_SEEKFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_ERRORBUFFER set to a objectpointer
|
||||||
|
CURLOPT_STDERR set to a objectpointer
|
||||||
|
CURLOPT_DEBUGFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_DEBUGDATA set to a objectpointer
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
ret = curl_easy_perform(hnd);
|
||||||
|
|
||||||
|
curl_easy_cleanup(hnd);
|
||||||
|
hnd = NULL;
|
||||||
|
|
||||||
|
return (int)ret;
|
||||||
|
}
|
||||||
|
/**** End of sample code ****/
|
||||||
|
</file>
|
||||||
|
<stdout>
|
||||||
|
</stdout>
|
||||||
|
</verify>
|
||||||
|
</testcase>
|
157
tests/data/test1404
Normal file
157
tests/data/test1404
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
<testcase>
|
||||||
|
# Based on test 1315
|
||||||
|
<info>
|
||||||
|
<keywords>
|
||||||
|
HTTP
|
||||||
|
HTTP FORMPOST
|
||||||
|
HTTP file upload
|
||||||
|
--libcurl
|
||||||
|
</keywords>
|
||||||
|
</info>
|
||||||
|
|
||||||
|
# Server-side
|
||||||
|
<reply>
|
||||||
|
<data>
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
Date: Thu, 29 Jul 2008 14:49:00 GMT
|
||||||
|
Server: test-server/fake
|
||||||
|
Content-Length: 0
|
||||||
|
Connection: close
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</reply>
|
||||||
|
|
||||||
|
# Client-side
|
||||||
|
<client>
|
||||||
|
<server>
|
||||||
|
http
|
||||||
|
</server>
|
||||||
|
<name>
|
||||||
|
HTTP RFC1867-type formposting - -F with three files, one with explicit type
|
||||||
|
</name>
|
||||||
|
<command>
|
||||||
|
http://%HOSTIP:%HTTPPORT/we/want/1404 -F name=value -F 'file=@log/test1404.txt,log/test1404.txt;type=magic/content,log/test1404.txt' --libcurl log/test1404.c
|
||||||
|
</command>
|
||||||
|
# We create this file before the command is invoked!
|
||||||
|
<file name="log/test1404.txt">
|
||||||
|
dummy data
|
||||||
|
</file>
|
||||||
|
</client>
|
||||||
|
|
||||||
|
# Verify data after the test has been "shot"
|
||||||
|
<verify>
|
||||||
|
<strip>
|
||||||
|
(^User-Agent:.*|-----+\w+)
|
||||||
|
</strip>
|
||||||
|
<protocol>
|
||||||
|
POST /we/want/1404 HTTP/1.1
|
||||||
|
User-Agent: curl/7.18.2 (i686-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.7a ipv6 zlib/1.1.4
|
||||||
|
Host: %HOSTIP:%HTTPPORT
|
||||||
|
Accept: */*
|
||||||
|
Content-Length: 795
|
||||||
|
Expect: 100-continue
|
||||||
|
Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763
|
||||||
|
|
||||||
|
------------------------------9ef8d6205763
|
||||||
|
Content-Disposition: form-data; name="name"
|
||||||
|
|
||||||
|
value
|
||||||
|
------------------------------9ef8d6205763
|
||||||
|
Content-Disposition: form-data; name="file"
|
||||||
|
Content-Type: multipart/mixed; boundary=----------------------------aaaaaaaaaaaa
|
||||||
|
|
||||||
|
Content-Disposition: attachment; filename="test1404.txt"
|
||||||
|
Content-Type: text/plain
|
||||||
|
|
||||||
|
dummy data
|
||||||
|
|
||||||
|
------------------------------9ef8d6205763
|
||||||
|
Content-Disposition: attachment; filename="test1404.txt"
|
||||||
|
Content-Type: magic/content
|
||||||
|
|
||||||
|
dummy data
|
||||||
|
|
||||||
|
------------------------------9ef8d6205763
|
||||||
|
Content-Disposition: attachment; filename="test1404.txt"
|
||||||
|
Content-Type: text/plain
|
||||||
|
|
||||||
|
dummy data
|
||||||
|
|
||||||
|
------------------------------aaaaaaaaaaaa--
|
||||||
|
------------------------------9ef8d6205763--
|
||||||
|
</protocol>
|
||||||
|
<stripfile>
|
||||||
|
# curl's default user-agent varies with version, libraries etc.
|
||||||
|
s/(USERAGENT, \")[^\"]+/${1}stripped/
|
||||||
|
# CURLOPT_SSL_VERIFYPEER varies with configuration - just ignore it
|
||||||
|
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
|
||||||
|
</stripfile>
|
||||||
|
<file name="log/test1404.c">
|
||||||
|
/********* Sample code generated by the curl command line tool **********
|
||||||
|
* All curl_easy_setopt() options are documented at:
|
||||||
|
* http://curl.haxx.se/libcurl/c/curl_easy_setopt.html
|
||||||
|
************************************************************************/
|
||||||
|
#include <curl/curl.h>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
CURLcode ret;
|
||||||
|
CURL *hnd;
|
||||||
|
struct curl_httppost *post1;
|
||||||
|
struct curl_httppost *postend;
|
||||||
|
|
||||||
|
post1 = NULL;
|
||||||
|
postend = NULL;
|
||||||
|
curl_formadd(&post1, &postend,
|
||||||
|
CURLFORM_COPYNAME, "name",
|
||||||
|
CURLFORM_COPYCONTENTS, "value",
|
||||||
|
CURLFORM_END);
|
||||||
|
curl_formadd(&post1, &postend,
|
||||||
|
CURLFORM_COPYNAME, "file",
|
||||||
|
CURLFORM_FILE, "log/test1404.txt",
|
||||||
|
CURLFORM_CONTENTTYPE, "text/plain",
|
||||||
|
CURLFORM_FILE, "log/test1404.txt",
|
||||||
|
CURLFORM_CONTENTTYPE, "magic/content",
|
||||||
|
CURLFORM_FILE, "log/test1404.txt",
|
||||||
|
CURLFORM_CONTENTTYPE, "text/plain",
|
||||||
|
CURLFORM_END);
|
||||||
|
|
||||||
|
hnd = curl_easy_init();
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/1404");
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_HEADER, 1L);
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_HTTPPOST, post1);
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
|
||||||
|
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 select to either not use them or implement
|
||||||
|
them yourself.
|
||||||
|
|
||||||
|
CURLOPT_WRITEDATA set to a objectpointer
|
||||||
|
CURLOPT_WRITEFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_READDATA set to a objectpointer
|
||||||
|
CURLOPT_READFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_SEEKDATA set to a objectpointer
|
||||||
|
CURLOPT_SEEKFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_ERRORBUFFER set to a objectpointer
|
||||||
|
CURLOPT_STDERR set to a objectpointer
|
||||||
|
CURLOPT_DEBUGFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_DEBUGDATA set to a objectpointer
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
ret = curl_easy_perform(hnd);
|
||||||
|
|
||||||
|
curl_easy_cleanup(hnd);
|
||||||
|
hnd = NULL;
|
||||||
|
curl_formfree(post1);
|
||||||
|
post1 = NULL;
|
||||||
|
|
||||||
|
return (int)ret;
|
||||||
|
}
|
||||||
|
/**** End of sample code ****/
|
||||||
|
</file>
|
||||||
|
</verify>
|
||||||
|
</testcase>
|
133
tests/data/test1405
Normal file
133
tests/data/test1405
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
<testcase>
|
||||||
|
# Derived from test227
|
||||||
|
<info>
|
||||||
|
<keywords>
|
||||||
|
FTP
|
||||||
|
post-quote
|
||||||
|
pre-quote
|
||||||
|
quote
|
||||||
|
--libcurl
|
||||||
|
</keywords>
|
||||||
|
</info>
|
||||||
|
# Server-side
|
||||||
|
<reply>
|
||||||
|
<data>
|
||||||
|
data
|
||||||
|
to
|
||||||
|
see
|
||||||
|
that FTP
|
||||||
|
works
|
||||||
|
so does it?
|
||||||
|
</data>
|
||||||
|
<servercmd>
|
||||||
|
REPLY EPSV 500 no such command
|
||||||
|
REPLY FAIL 500 this might not be a failure!
|
||||||
|
</servercmd>
|
||||||
|
</reply>
|
||||||
|
|
||||||
|
# Client-side
|
||||||
|
<client>
|
||||||
|
<server>
|
||||||
|
ftp
|
||||||
|
</server>
|
||||||
|
<name>
|
||||||
|
FTP with quote ops
|
||||||
|
</name>
|
||||||
|
<command>
|
||||||
|
ftp://%HOSTIP:%FTPPORT/1405 -Q "NOOP 1" -Q "+NOOP 2" -Q "-NOOP 3" -Q "*FAIL" -Q "+*FAIL HARD" --libcurl log/test1405.c
|
||||||
|
</command>
|
||||||
|
</client>
|
||||||
|
|
||||||
|
# Verify data after the test has been "shot"
|
||||||
|
<verify>
|
||||||
|
<protocol>
|
||||||
|
USER anonymous
|
||||||
|
PASS ftp@example.com
|
||||||
|
PWD
|
||||||
|
NOOP 1
|
||||||
|
FAIL
|
||||||
|
EPSV
|
||||||
|
PASV
|
||||||
|
TYPE I
|
||||||
|
NOOP 2
|
||||||
|
FAIL HARD
|
||||||
|
SIZE 1405
|
||||||
|
RETR 1405
|
||||||
|
NOOP 3
|
||||||
|
QUIT
|
||||||
|
</protocol>
|
||||||
|
<file name="log/test1405.c">
|
||||||
|
/********* Sample code generated by the curl command line tool **********
|
||||||
|
* All curl_easy_setopt() options are documented at:
|
||||||
|
* http://curl.haxx.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_URL, "ftp://%HOSTIP:%FTPPORT/1405");
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_HEADER, 1L);
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
|
||||||
|
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_VERBOSE, 1L);
|
||||||
|
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 select to either not use them or implement
|
||||||
|
them yourself.
|
||||||
|
|
||||||
|
CURLOPT_WRITEDATA set to a objectpointer
|
||||||
|
CURLOPT_WRITEFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_READDATA set to a objectpointer
|
||||||
|
CURLOPT_READFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_SEEKDATA set to a objectpointer
|
||||||
|
CURLOPT_SEEKFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_ERRORBUFFER set to a objectpointer
|
||||||
|
CURLOPT_STDERR set to a objectpointer
|
||||||
|
CURLOPT_DEBUGFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_DEBUGDATA set to a objectpointer
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
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>
|
||||||
|
# curl's default user-agent varies with version, libraries etc.
|
||||||
|
s/(USERAGENT, \")[^\"]+/${1}stripped/
|
||||||
|
# CURLOPT_SSL_VERIFYPEER varies with configuration - just ignore it
|
||||||
|
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
|
||||||
|
</stripfile>
|
||||||
|
</verify>
|
||||||
|
</testcase>
|
119
tests/data/test1406
Normal file
119
tests/data/test1406
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
<testcase>
|
||||||
|
# Based on test802
|
||||||
|
# N.B. --libcurl output not sufficient to deal with uploaded files.
|
||||||
|
<info>
|
||||||
|
<keywords>
|
||||||
|
SMTP
|
||||||
|
--libcurl
|
||||||
|
</keywords>
|
||||||
|
</info>
|
||||||
|
|
||||||
|
#
|
||||||
|
# Server-side
|
||||||
|
<reply>
|
||||||
|
</reply>
|
||||||
|
|
||||||
|
#
|
||||||
|
# Client-side
|
||||||
|
<client>
|
||||||
|
<server>
|
||||||
|
smtp
|
||||||
|
</server>
|
||||||
|
<name>
|
||||||
|
SMTP
|
||||||
|
</name>
|
||||||
|
<file name="log/test1406.eml">
|
||||||
|
From: different
|
||||||
|
To: another
|
||||||
|
|
||||||
|
body
|
||||||
|
</file>
|
||||||
|
<command>
|
||||||
|
smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 1406@foo --mail-rcpt 1406@foobar.example --mail-from 1406@from -T log/test1406.eml --libcurl log/test1406.c
|
||||||
|
</command>
|
||||||
|
</client>
|
||||||
|
|
||||||
|
#
|
||||||
|
# Verify data after the test has been "shot"
|
||||||
|
<verify>
|
||||||
|
<protocol>
|
||||||
|
EHLO user
|
||||||
|
MAIL FROM:<1406@from> SIZE=34
|
||||||
|
RCPT TO:<1406@foo>
|
||||||
|
RCPT TO:<1406@foobar.example>
|
||||||
|
DATA
|
||||||
|
QUIT
|
||||||
|
</protocol>
|
||||||
|
<upload>
|
||||||
|
From: different
|
||||||
|
To: another
|
||||||
|
|
||||||
|
body
|
||||||
|
|
||||||
|
.
|
||||||
|
</upload>
|
||||||
|
<file name="log/test1406.c">
|
||||||
|
/********* Sample code generated by the curl command line tool **********
|
||||||
|
* All curl_easy_setopt() options are documented at:
|
||||||
|
* http://curl.haxx.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, "1406@foo");
|
||||||
|
slist1 = curl_slist_append(slist1, "1406@foobar.example");
|
||||||
|
|
||||||
|
hnd = curl_easy_init();
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_INFILESIZE_LARGE, (curl_off_t)34);
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_URL, "smtp://%HOSTIP:%SMTPPORT/user");
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_HEADER, 1L);
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_UPLOAD, 1L);
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_MAIL_FROM, "1406@from");
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_MAIL_RCPT, slist1);
|
||||||
|
|
||||||
|
/* Here is a list of options the curl code used that cannot get generated
|
||||||
|
as source easily. You may select to either not use them or implement
|
||||||
|
them yourself.
|
||||||
|
|
||||||
|
CURLOPT_WRITEDATA set to a objectpointer
|
||||||
|
CURLOPT_WRITEFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_READDATA set to a objectpointer
|
||||||
|
CURLOPT_READFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_SEEKDATA set to a objectpointer
|
||||||
|
CURLOPT_SEEKFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_ERRORBUFFER set to a objectpointer
|
||||||
|
CURLOPT_STDERR set to a objectpointer
|
||||||
|
CURLOPT_DEBUGFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_DEBUGDATA set to a objectpointer
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
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>
|
||||||
|
# curl's default user-agent varies with version, libraries etc.
|
||||||
|
s/(USERAGENT, \")[^\"]+/${1}stripped/
|
||||||
|
# CURLOPT_SSL_VERIFYPEER varies with configuration - just ignore it
|
||||||
|
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
|
||||||
|
</stripfile>
|
||||||
|
</verify>
|
||||||
|
</testcase>
|
97
tests/data/test1407
Normal file
97
tests/data/test1407
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
<testcase>
|
||||||
|
# Based on test808
|
||||||
|
<info>
|
||||||
|
<keywords>
|
||||||
|
POP3
|
||||||
|
LIST
|
||||||
|
--libcurl
|
||||||
|
</keywords>
|
||||||
|
</info>
|
||||||
|
|
||||||
|
#
|
||||||
|
# Server-side
|
||||||
|
<reply>
|
||||||
|
<servercmd>
|
||||||
|
REPLY LIST +OK 1407 100
|
||||||
|
</servercmd>
|
||||||
|
</reply>
|
||||||
|
|
||||||
|
#
|
||||||
|
# Client-side
|
||||||
|
<client>
|
||||||
|
<server>
|
||||||
|
pop3
|
||||||
|
</server>
|
||||||
|
<name>
|
||||||
|
POP3 LIST one message
|
||||||
|
</name>
|
||||||
|
<command>
|
||||||
|
pop3://%HOSTIP:%POP3PORT/1407 -l -u user:secret --libcurl log/test1407.c
|
||||||
|
</command>
|
||||||
|
</client>
|
||||||
|
|
||||||
|
#
|
||||||
|
# Verify data after the test has been "shot"
|
||||||
|
<verify>
|
||||||
|
<protocol>
|
||||||
|
USER user
|
||||||
|
PASS secret
|
||||||
|
LIST 1407
|
||||||
|
QUIT
|
||||||
|
</protocol>
|
||||||
|
<file name="log/test1407.c">
|
||||||
|
/********* Sample code generated by the curl command line tool **********
|
||||||
|
* All curl_easy_setopt() options are documented at:
|
||||||
|
* http://curl.haxx.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_URL, "pop3://%HOSTIP:%POP3PORT/1407");
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_HEADER, 1L);
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_DIRLISTONLY, 1L);
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_USERPWD, "user:secret");
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
|
||||||
|
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
|
||||||
|
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 select to either not use them or implement
|
||||||
|
them yourself.
|
||||||
|
|
||||||
|
CURLOPT_WRITEDATA set to a objectpointer
|
||||||
|
CURLOPT_WRITEFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_READDATA set to a objectpointer
|
||||||
|
CURLOPT_READFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_SEEKDATA set to a objectpointer
|
||||||
|
CURLOPT_SEEKFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_ERRORBUFFER set to a objectpointer
|
||||||
|
CURLOPT_STDERR set to a objectpointer
|
||||||
|
CURLOPT_DEBUGFUNCTION set to a functionpointer
|
||||||
|
CURLOPT_DEBUGDATA set to a objectpointer
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
ret = curl_easy_perform(hnd);
|
||||||
|
|
||||||
|
curl_easy_cleanup(hnd);
|
||||||
|
hnd = NULL;
|
||||||
|
|
||||||
|
return (int)ret;
|
||||||
|
}
|
||||||
|
/**** End of sample code ****/
|
||||||
|
</file>
|
||||||
|
<stripfile>
|
||||||
|
# curl's default user-agent varies with version, libraries etc.
|
||||||
|
s/(USERAGENT, \")[^\"]+/${1}stripped/
|
||||||
|
# CURLOPT_SSL_VERIFYPEER varies with configuration - just ignore it
|
||||||
|
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
|
||||||
|
</stripfile>
|
||||||
|
</verify>
|
||||||
|
</testcase>
|
Loading…
Reference in New Issue
Block a user