From c3cae332c5fa5d4d50c45e9aeeb7efdc267dafd2 Mon Sep 17 00:00:00 2001 From: Colin Hogben Date: Thu, 23 Feb 2012 09:48:46 +0000 Subject: 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. --- tests/data/Makefile.am | 1 + tests/data/test1400 | 98 ++++++++++++++++++++++++++++++ tests/data/test1401 | 119 +++++++++++++++++++++++++++++++++++++ tests/data/test1402 | 108 ++++++++++++++++++++++++++++++++++ tests/data/test1403 | 103 ++++++++++++++++++++++++++++++++ tests/data/test1404 | 157 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/data/test1405 | 133 +++++++++++++++++++++++++++++++++++++++++ tests/data/test1406 | 119 +++++++++++++++++++++++++++++++++++++ tests/data/test1407 | 97 ++++++++++++++++++++++++++++++ 9 files changed, 935 insertions(+) create mode 100644 tests/data/test1400 create mode 100644 tests/data/test1401 create mode 100644 tests/data/test1402 create mode 100644 tests/data/test1403 create mode 100644 tests/data/test1404 create mode 100644 tests/data/test1405 create mode 100644 tests/data/test1406 create mode 100644 tests/data/test1407 (limited to 'tests/data') diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 40ebf252c..8c53590eb 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -83,6 +83,7 @@ test1300 test1301 test1302 test1303 test1304 test1305 \ test1306 test1307 test1308 test1309 test1310 test1311 test1312 test1313 \ test1314 test1315 test1316 test1317 test1318 test1319 test1320 test1321 \ test1322 test1323 test1324 test1325 test1326 test1327 test1328 test1329 \ +test1400 test1401 test1402 test1403 test1404 test1405 test1406 test1407 \ test2000 test2001 test2002 test2003 test2004 EXTRA_DIST = $(TESTCASES) DISABLED diff --git a/tests/data/test1400 b/tests/data/test1400 new file mode 100644 index 000000000..762236ac0 --- /dev/null +++ b/tests/data/test1400 @@ -0,0 +1,98 @@ + + + +HTTP +--libcurl + + + +# Server-side + + +HTTP/1.1 200 OK +Date: Thu, 29 Jul 2008 14:49:00 GMT +Server: test-server/fake +Content-Length: 0 +Connection: close + + + + +# Client-side + + +http + + +--libcurl for simple HTTP GET + + +http://%HOSTIP:%HTTPPORT/we/want/1400 --libcurl log/test1400.c + + + +# Verify data after the test has been "shot" + + +^User-Agent:.* + + +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: */* + + + +s/(USERAGENT, \")[^\"]+/${1}stripped/ +# CURLOPT_SSL_VERIFYPEER varies with configuration - just ignore it +$_ = '' if /CURLOPT_SSL_VERIFYPEER/ + + +/********* 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 + +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 ****/ + + + diff --git a/tests/data/test1401 b/tests/data/test1401 new file mode 100644 index 000000000..dd63fcc68 --- /dev/null +++ b/tests/data/test1401 @@ -0,0 +1,119 @@ + + + +HTTP +HTTP Basic auth +--libcurl + + + +# Server-side + + +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 + + + + +# Client-side + + +http + + +--libcurl for GET with various options + + +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" + + + +# Verify data after the test has been "shot" + + +^User-Agent:.* + + +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 + + + +# CURLOPT_SSL_VERIFYPEER varies with configuration - just ignore it +$_ = '' if /CURLOPT_SSL_VERIFYPEER/ + + +/********* 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 + +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 ****/ + + + + + diff --git a/tests/data/test1402 b/tests/data/test1402 new file mode 100644 index 000000000..d5f3df365 --- /dev/null +++ b/tests/data/test1402 @@ -0,0 +1,108 @@ + + + +HTTP +HTTP POST +--libcurl + + + +# Server-side + + +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 + + + + +# Client-side + + +http + + +--libcurl for simple POST + + +http://%HOSTIP:%HTTPPORT/we/want/1402 --libcurl log/test1402.c -d "foo=bar" -d "baz=quux" + + + +# Verify data after the test has been "shot" + + +^User-Agent:.* + + +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 + + +# 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/ + + +/********* 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 + +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 ****/ + + + + + diff --git a/tests/data/test1403 b/tests/data/test1403 new file mode 100644 index 000000000..c9bc3ad7d --- /dev/null +++ b/tests/data/test1403 @@ -0,0 +1,103 @@ + + + +HTTP +HTTP GET +--libcurl + + + +# Server-side + + +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 + + + + +# Client-side + + +http + + +--libcurl for GET with query + + +http://%HOSTIP:%HTTPPORT/we/want/1403 --libcurl log/test1403.c -G -d "foo=bar" -d "baz=quux" + + + +# Verify data after the test has been "shot" + + +^User-Agent:.* + + +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: */* + + + +# 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/ + + +/********* 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 + +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 ****/ + + + + + diff --git a/tests/data/test1404 b/tests/data/test1404 new file mode 100644 index 000000000..90b8d6a5f --- /dev/null +++ b/tests/data/test1404 @@ -0,0 +1,157 @@ + +# Based on test 1315 + + +HTTP +HTTP FORMPOST +HTTP file upload +--libcurl + + + +# Server-side + + +HTTP/1.1 200 OK +Date: Thu, 29 Jul 2008 14:49:00 GMT +Server: test-server/fake +Content-Length: 0 +Connection: close + + + + +# Client-side + + +http + + +HTTP RFC1867-type formposting - -F with three files, one with explicit type + + +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 + +# We create this file before the command is invoked! + +dummy data + + + +# Verify data after the test has been "shot" + + +(^User-Agent:.*|-----+\w+) + + +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-- + + +# 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/ + + +/********* 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 + +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 ****/ + + + diff --git a/tests/data/test1405 b/tests/data/test1405 new file mode 100644 index 000000000..74925ee90 --- /dev/null +++ b/tests/data/test1405 @@ -0,0 +1,133 @@ + +# Derived from test227 + + +FTP +post-quote +pre-quote +quote +--libcurl + + +# Server-side + + +data + to + see +that FTP +works + so does it? + + +REPLY EPSV 500 no such command +REPLY FAIL 500 this might not be a failure! + + + +# Client-side + + +ftp + + +FTP with quote ops + + +ftp://%HOSTIP:%FTPPORT/1405 -Q "NOOP 1" -Q "+NOOP 2" -Q "-NOOP 3" -Q "*FAIL" -Q "+*FAIL HARD" --libcurl log/test1405.c + + + +# Verify data after the test has been "shot" + + +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 + + +/********* 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 + +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 ****/ + + +# 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/ + + + diff --git a/tests/data/test1406 b/tests/data/test1406 new file mode 100644 index 000000000..d87b4e42a --- /dev/null +++ b/tests/data/test1406 @@ -0,0 +1,119 @@ + +# Based on test802 +# N.B. --libcurl output not sufficient to deal with uploaded files. + + +SMTP +--libcurl + + + +# +# Server-side + + + +# +# Client-side + + +smtp + + +SMTP + + +From: different +To: another + +body + + +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 + + + +# +# Verify data after the test has been "shot" + + +EHLO user +MAIL FROM:<1406@from> SIZE=34 +RCPT TO:<1406@foo> +RCPT TO:<1406@foobar.example> +DATA +QUIT + + +From: different +To: another + +body + +. + + +/********* 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 + +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 ****/ + + +# 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/ + + + diff --git a/tests/data/test1407 b/tests/data/test1407 new file mode 100644 index 000000000..24d69b988 --- /dev/null +++ b/tests/data/test1407 @@ -0,0 +1,97 @@ + +# Based on test808 + + +POP3 +LIST +--libcurl + + + +# +# Server-side + + +REPLY LIST +OK 1407 100 + + + +# +# Client-side + + +pop3 + + +POP3 LIST one message + + +pop3://%HOSTIP:%POP3PORT/1407 -l -u user:secret --libcurl log/test1407.c + + + +# +# Verify data after the test has been "shot" + + +USER user +PASS secret +LIST 1407 +QUIT + + +/********* 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 + +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 ****/ + + +# 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/ + + + -- cgit v1.2.3