From 3baf36edf6ed1d7c74d68846d79f87334b573aea Mon Sep 17 00:00:00 2001 From: Patrick Monnerat Date: Sat, 2 Sep 2017 19:08:45 +0100 Subject: mime: tests and examples. Additional mime-specific tests. Existing tests updated to reflect small differences (Expect: 100-continue, data size change due to empty lines, etc). Option -F headers= keyword added to tests. test1135 disabled until the entry point order change is resolved. New example smtp-mime. Examples postit2 and multi-post converted from form API to mime API. --- tests/data/DISABLED | 3 ++ tests/data/Makefile.inc | 3 +- tests/data/test1053 | 2 - tests/data/test1133 | 4 +- tests/data/test1315 | 4 +- tests/data/test1404 | 63 ++++++++++++++-------- tests/data/test158 | 1 - tests/data/test163 | 1 - tests/data/test166 | 1 - tests/data/test173 | 1 - tests/data/test186 | 5 +- tests/data/test259 | 6 +-- tests/data/test277 | 5 +- tests/data/test554 | 2 - tests/data/test587 | 1 - tests/data/test589 | 55 +++++++++++++++++++ tests/data/test643 | 131 ++++++++++++++++++++++++++++++++++++++++++++ tests/data/test644 | 58 ++++++++++++++++++++ tests/data/test645 | 141 ++++++++++++++++++++++++++++++++++++++++++++++++ tests/data/test646 | 98 +++++++++++++++++++++++++++++++++ tests/data/test647 | 79 +++++++++++++++++++++++++++ tests/data/test71 | 1 - tests/data/test9 | 1 - 23 files changed, 618 insertions(+), 48 deletions(-) create mode 100644 tests/data/test589 create mode 100644 tests/data/test643 create mode 100644 tests/data/test644 create mode 100644 tests/data/test645 create mode 100644 tests/data/test646 create mode 100644 tests/data/test647 (limited to 'tests/data') diff --git a/tests/data/DISABLED b/tests/data/DISABLED index 11d54b463..27ea77473 100644 --- a/tests/data/DISABLED +++ b/tests/data/DISABLED @@ -18,3 +18,6 @@ 1510 # Pipelining test that is causing false positives a little too often 1903 +# Entry point order should currently not be checked: mime API requires a +# SONAME change. +1135 diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc index 098f3f60f..8db5b80d0 100644 --- a/tests/data/Makefile.inc +++ b/tests/data/Makefile.inc @@ -71,13 +71,14 @@ test545 test546 test547 test548 test549 test550 test551 test552 test553 \ test554 test555 test556 test557 test558 test559 test560 test561 test562 \ test563 test564 test565 test566 test567 test568 test569 test570 test571 \ test572 test573 test574 test575 test576 test578 test579 test580 \ -test581 test582 test583 test584 test585 test586 test587 test588 \ +test581 test582 test583 test584 test585 test586 test587 test588 test589 \ test590 test591 test592 test593 test594 test595 test596 test597 test598 \ test599 test600 test601 test602 test603 test604 test605 test606 test607 \ test608 test609 test610 test611 test612 test613 test614 test615 test616 \ test617 test618 test619 test620 test621 test622 test623 test624 test625 \ test626 test627 test628 test629 test630 test631 test632 test633 test634 \ test635 test636 test637 test638 test639 test640 test641 test642 \ +test643 test644 test645 test646 test647 \ \ test700 test701 test702 test703 test704 test705 test706 test707 test708 \ test709 test710 test711 test712 test713 test714 test715 \ diff --git a/tests/data/test1053 b/tests/data/test1053 index 8c60e5ce3..239a1100f 100644 --- a/tests/data/test1053 +++ b/tests/data/test1053 @@ -79,7 +79,6 @@ User-Agent: curl/7.18.2 (i686-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.7a ipv6 z Host: %HOSTIP:%HTTPPORT Accept: */* Content-Length: 410 -Expect: 100-continue Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763 ------------------------------9ef8d6205763 @@ -104,7 +103,6 @@ User-Agent: curl/7.18.2 (i686-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.7a ipv6 z Host: %HOSTIP:%HTTPPORT Accept: */* Content-Length: 410 -Expect: 100-continue Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763 ------------------------------9ef8d6205763 diff --git a/tests/data/test1133 b/tests/data/test1133 index 8b016fc14..2238b9c07 100644 --- a/tests/data/test1133 +++ b/tests/data/test1133 @@ -47,8 +47,7 @@ POST /we/want/1133 HTTP/1.1 User-Agent: curl/7.10.4 (i686-pc-linux-gnu) libcurl/7.10.4 OpenSSL/0.9.7a ipv6 zlib/1.1.3 Host: %HOSTIP:%HTTPPORT Accept: */* -Content-Length: 967 -Expect: 100-continue +Content-Length: 969 Content-Type: multipart/form-data; boundary=----------------------------24e78000bd32 ------------------------------24e78000bd32 @@ -89,6 +88,7 @@ This is a bar foo bar foo + ------------------------------24e78000bd32-- diff --git a/tests/data/test1315 b/tests/data/test1315 index c2f158a95..888ddc5c1 100644 --- a/tests/data/test1315 +++ b/tests/data/test1315 @@ -47,8 +47,7 @@ POST /we/want/1315 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-Length: 797 Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763 ------------------------------9ef8d6205763 @@ -77,6 +76,7 @@ Content-Type: text/plain dummy data ------------------------------aaaaaaaaaaaa-- + ------------------------------9ef8d6205763-- diff --git a/tests/data/test1404 b/tests/data/test1404 index c86d2602c..60ed58a16 100644 --- a/tests/data/test1404 +++ b/tests/data/test1404 @@ -33,7 +33,7 @@ http SSL_CERT_FILE= -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 +http://%HOSTIP:%HTTPPORT/we/want/1404 -F name=value -F 'file=@log/test1404.txt,log/test1404.txt;type=magic/content,log/test1404.txt;headers=X-testheader-1: header 1;headers=X-testheader-2: header 2' --libcurl log/test1404.c # We create this file before the command is invoked! @@ -51,8 +51,7 @@ 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-Length: 849 Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763 ------------------------------9ef8d6205763 @@ -77,10 +76,13 @@ dummy data ------------------------------9ef8d6205763 Content-Disposition: attachment; filename="test1404.txt" Content-Type: text/plain +X-testheader-1: header 1 +X-testheader-2: header 2 dummy data ------------------------------aaaaaaaaaaaa-- + ------------------------------9ef8d6205763-- @@ -103,30 +105,41 @@ int main(int argc, char *argv[]) { CURLcode ret; CURL *hnd; - struct curl_httppost *post1; - struct curl_httppost *postend; + curl_mime *mime1; + curl_mimepart *part1; + curl_mime *mime2; + curl_mimepart *part2; + struct curl_slist *slist1; - 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); + 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_BUFFERSIZE, 102400L); 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); + mime1 = curl_mime_init(hnd); + part1 = curl_mime_addpart(mime1); + curl_mime_data(part1, "value", -1); + curl_mime_name(part1, "name", -1); + part1 = curl_mime_addpart(mime1); + mime2 = curl_mime_init(hnd); + part2 = curl_mime_addpart(mime2); + curl_mime_filedata(part2, "log/test1404.txt"); + part2 = curl_mime_addpart(mime2); + curl_mime_filedata(part2, "log/test1404.txt"); + curl_mime_type(part2, "magic/content"); + part2 = curl_mime_addpart(mime2); + curl_mime_filedata(part2, "log/test1404.txt"); + curl_mime_headers(part2, slist1, 1); + slist1 = NULL; + curl_mime_subparts(part1, mime2); + mime2 = NULL; + curl_mime_name(part1, "file", -1); + 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_VERBOSE, 1L); @@ -156,8 +169,12 @@ int main(int argc, char *argv[]) curl_easy_cleanup(hnd); hnd = NULL; - curl_formfree(post1); - post1 = NULL; + curl_mime_free(mime1); + mime1 = NULL; + curl_mime_free(mime2); + mime2 = NULL; + curl_slist_free_all(slist1); + slist1 = NULL; return (int)ret; } diff --git a/tests/data/test158 b/tests/data/test158 index 9c4b22f70..dca51b163 100644 --- a/tests/data/test158 +++ b/tests/data/test158 @@ -41,7 +41,6 @@ User-Agent: curl/7.11.2-CVS (i686-pc-linux-gnu) libcurl/7.11.2-CVS OpenSSL/0.9.6 Host: %HOSTIP:%HTTPPORT Accept: */* Content-Length: 145 -Expect: 100-continue Content-Type: multipart/form-data; boundary=----------------------------4f12fcdaa3bc ------------------------------4f12fcdaa3bc diff --git a/tests/data/test163 b/tests/data/test163 index 22341c045..b4e2d260f 100644 --- a/tests/data/test163 +++ b/tests/data/test163 @@ -54,7 +54,6 @@ User-Agent: curl/7.11.2-CVS (i686-pc-linux-gnu) libcurl/7.11.2-CVS OpenSSL/0.9.6 Host: %HOSTIP:%HTTPPORT Accept: */* Content-Length: 304 -Expect: 100-continue Content-Type: multipart/form-data; boundary=----------------------------c2d1767eb6ac ------------------------------c2d1767eb6ac diff --git a/tests/data/test166 b/tests/data/test166 index 2036773f8..f170752e6 100644 --- a/tests/data/test166 +++ b/tests/data/test166 @@ -46,7 +46,6 @@ User-Agent: curl/7.12.0-CVS (i686-pc-linux-gnu) libcurl/7.12.0-CVS OpenSSL/0.9.6 Host: %HOSTIP:%HTTPPORT Accept: */* Content-Length: 223 -Expect: 100-continue Content-Type: multipart/form-data; boundary=----------------------------b0b3d6d23991 ------------------------------b0b3d6d23991 diff --git a/tests/data/test173 b/tests/data/test173 index bf6af0007..865ef7ba2 100644 --- a/tests/data/test173 +++ b/tests/data/test173 @@ -54,7 +54,6 @@ User-Agent: curl/7.12.1-CVS (i686-pc-linux-gnu) libcurl/7.12.1-CVS OpenSSL/0.9.6 Host: %HOSTIP:%HTTPPORT Accept: */* Content-Length: 360 -Expect: 100-continue Content-Type: multipart/form-data; boundary=----------------------------5dbea401cd8c ------------------------------5dbea401cd8c diff --git a/tests/data/test186 b/tests/data/test186 index b07736cbc..4abc74a2b 100644 --- a/tests/data/test186 +++ b/tests/data/test186 @@ -43,8 +43,7 @@ POST /we/want/186 HTTP/1.1 User-Agent: curl/7.12.2-CVS (i686-pc-linux-gnu) libcurl/7.12.2-CVS OpenSSL/0.9.7d zlib/1.2.1.1 c-ares/1.2.0 libidn/0.5.2 Host: %HOSTIP:%HTTPPORT Accept: */* -Content-Length: 321 -Expect: 100-continue +Content-Length: 320 Content-Type: multipart/form-data; boundary=----------------------------212d9006ceb5 ------------------------------212d9006ceb5 @@ -56,7 +55,7 @@ daniel Content-Disposition: form-data; name="html" Content-Type: text/html;charset=verymoo - hello +hello ------------------------------212d9006ceb5-- diff --git a/tests/data/test259 b/tests/data/test259 index 9532887a9..6e1853601 100644 --- a/tests/data/test259 +++ b/tests/data/test259 @@ -59,7 +59,7 @@ crypto HTTP POST multipart with Expect: header using proxy anyauth (Digest) --x http://%HOSTIP:%HTTPPORT http://remotehost:54321/we/want/259 -F name=daniel -F tool=curl -F file=@log/test259.txt -U uuuser:pppassword --proxy-anyauth +-x http://%HOSTIP:%HTTPPORT http://remotehost:54321/we/want/259 -F name=daniel -F tool=curl -F file=@log/test259.txt -U uuuser:pppassword --proxy-anyauth -H "Expect: 100-continue" # We create this file before the command is invoked! @@ -80,8 +80,8 @@ Host: remotehost:54321 User-Agent: curl/7.10.4 (i686-pc-linux-gnu) libcurl/7.10.4 OpenSSL/0.9.7a ipv6 zlib/1.1.3 Accept: */* Proxy-Connection: Keep-Alive -Content-Length: 409 Expect: 100-continue +Content-Length: 409 Content-Type: multipart/form-data; boundary=----------------------------7c633d5c27ce ------------------------------7c633d5c27ce @@ -107,8 +107,8 @@ User-Agent: curl/7.10.4 (i686-pc-linux-gnu) libcurl/7.10.4 OpenSSL/0.9.7a ipv6 z Proxy-Authorization: Digest username="uuuser", realm="many secrets", nonce="911", uri="/we/want/259", response="b479994d13e60f3aa192a67c5892ddc5" Accept: */* Proxy-Connection: Keep-Alive -Content-Length: 409 Expect: 100-continue +Content-Length: 409 Content-Type: multipart/form-data; boundary=----------------------------7c633d5c27ce ------------------------------7c633d5c27ce diff --git a/tests/data/test277 b/tests/data/test277 index a509b40ec..d3e9d0fa4 100644 --- a/tests/data/test277 +++ b/tests/data/test277 @@ -45,12 +45,11 @@ POST /want/277 HTTP/1.1 User-Agent: curl/7.10.4 (i686-pc-linux-gnu) libcurl/7.10.4 OpenSSL/0.9.7a ipv6 zlib/1.1.3 Host: %HOSTIP:%HTTPPORT Accept: */* -Content-Length: 145 -Expect: 100-continue +Content-Length: 146 Content-Type: text/info; boundary=------------------------ -------------------------- -Content-Disposition: form-data; name="name" +Content-Disposition: attachment; name="name" daniel ---------------------------- diff --git a/tests/data/test554 b/tests/data/test554 index 3419e5e0f..ce4a14dc4 100644 --- a/tests/data/test554 +++ b/tests/data/test554 @@ -69,7 +69,6 @@ POST /554 HTTP/1.1 Host: %HOSTIP:%HTTPPORT Accept: */* Content-Length: 718 -Expect: 100-continue Content-Type: multipart/form-data; boundary=---------------------------- ------------------------------ @@ -100,7 +99,6 @@ POST /554 HTTP/1.1 Host: %HOSTIP:%HTTPPORT Accept: */* Content-Length: 732 -Expect: 100-continue Content-Type: multipart/form-data; boundary=---------------------------- ------------------------------ diff --git a/tests/data/test587 b/tests/data/test587 index 69cbe1ed7..689a877db 100644 --- a/tests/data/test587 +++ b/tests/data/test587 @@ -43,7 +43,6 @@ POST /587 HTTP/1.1 Host: %HOSTIP:%HTTPPORT Accept: */* Content-Length: 718 -Expect: 100-continue Content-Type: multipart/form-data; boundary=---------------------------- ------------------------------ diff --git a/tests/data/test589 b/tests/data/test589 new file mode 100644 index 000000000..451bb15bd --- /dev/null +++ b/tests/data/test589 @@ -0,0 +1,55 @@ + + + +HTTP +HTTP POST +HTTP MIME + + + +# +# Server-side + + +HTTP/1.1 200 OK swsclose +Date: Thu, 09 Nov 2010 14:49:00 GMT +Server: test-server/fake +Content-Length: 3 + +OK + + + +# Client-side + + +http + +# tool is what to use instead of 'curl' + +lib589 + + + +make a HTTP MIME POST set to NULL + + +http://%HOSTIP:%HTTPPORT/589 + + + +# +# Verify data after the test has been "shot" + + +^User-Agent:.* + + +POST /589 HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +Accept: */* +Content-Length: 0 + + + + diff --git a/tests/data/test643 b/tests/data/test643 new file mode 100644 index 000000000..0eaf22c5f --- /dev/null +++ b/tests/data/test643 @@ -0,0 +1,131 @@ + + + +HTTP +HTTP POST +HTTP MIME POST + + + +# +# Server-side + + +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Server: test-server/fake swsclose +Connection: close +Content-Type: text/html + +hello + + +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Server: test-server/fake swsclose +Connection: close +Content-Type: text/html + +hello +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Server: test-server/fake swsclose +Connection: close +Content-Type: text/html + +hello + + + +# Client-side + + +http + +# tool is what to use instead of 'curl' + +lib643 + + + +HTTP multi-part mimepost using read callback for the file part + + +http://%HOSTIP:%HTTPPORT/643 + + + +# +# Verify data after the test has been "shot" + + +s/^--------------------------[a-z0-9]*/------------------------------/ +s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/ + +# Note that the stripping above removes 12 bytes from every occurrence of the +# boundary string and since 5 of them are in the body contents, we see +# (5*12) == 60 bytes less + +POST /643 HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +Accept: */* +Content-Length: 718 +Content-Type: multipart/form-data; boundary=---------------------------- + +------------------------------ +Content-Disposition: form-data; name="sendfile"; filename="postit2.c" + +this is what we post to the silly web server + +------------------------------ +Content-Disposition: form-data; name="callbackdata" + +this is what we post to the silly web server + +------------------------------ +Content-Disposition: form-data; name="filename" + +postit2.c +------------------------------ +Content-Disposition: form-data; name="submit" + +send +------------------------------ +Content-Disposition: form-data; name="somename"; filename="somefile.txt" +Content-Type: text/plain + +blah blah +-------------------------------- +POST /643 HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +Accept: */* +Content-Length: 732 +Content-Type: multipart/form-data; boundary=---------------------------- + +------------------------------ +Content-Disposition: form-data; name="sendfile alternative"; filename="file name 2" + +this is what we post to the silly web server + +------------------------------ +Content-Disposition: form-data; name="callbackdata" + +this is what we post to the silly web server + +------------------------------ +Content-Disposition: form-data; name="filename" + +postit2.c +------------------------------ +Content-Disposition: form-data; name="submit" + +send +------------------------------ +Content-Disposition: form-data; name="somename"; filename="somefile.txt" +Content-Type: text/plain + +blah blah +-------------------------------- + + + diff --git a/tests/data/test644 b/tests/data/test644 new file mode 100644 index 000000000..6ac37ce54 --- /dev/null +++ b/tests/data/test644 @@ -0,0 +1,58 @@ + + + +HTTP +HTTP POST +HTTP MIME POST + + + +# +# Server-side + + + + + +# Client-side + + +http + +# tool is what to use instead of 'curl' + +lib644 + + + +HTTP multi-part formpost with aborted read callback + + +http://%HOSTIP:%HTTPPORT/644 + + + +# +# Verify data after the test has been "shot" + + +s/^--------------------------[a-z0-9]*/------------------------------/ +s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/ + + +POST /644 HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +Accept: */* +Content-Length: 718 +Content-Type: multipart/form-data; boundary=---------------------------- + +------------------------------ +Content-Disposition: form-data; name="sendfile"; filename="postit2.c" + + +# CURLE_ABORTED_BY_CALLBACK (42) + +42 + + + diff --git a/tests/data/test645 b/tests/data/test645 new file mode 100644 index 000000000..6533944b4 --- /dev/null +++ b/tests/data/test645 @@ -0,0 +1,141 @@ + + + +HTTP +HTTP POST +HTTP MIME POST + + + +# +# Server-side + + +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Server: test-server/fake swsclose +Connection: close +Content-Type: text/html + +hello + + +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Server: test-server/fake swsclose +Connection: close +Content-Type: text/html + +hello +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Server: test-server/fake swsclose +Connection: close +Content-Type: text/html + +hello + + + +# Client-side + + +http + +# tool is what to use instead of 'curl' + +lib645 + + + +HTTP multi-part chunked mimepost using read callback for the file part + + +http://%HOSTIP:%HTTPPORT/645 + + + +# +# Verify data after the test has been "shot" + + +s/^--------------------------[a-z0-9]*/------------------------------/ +s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/ + +# Note that the stripping above removes 12 bytes from every occurrence of the +# boundary string and since 5 of them are in the body contents, we see +# (5*12) == 60 bytes less + +POST /645 HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +Accept: */* +Transfer-Encoding: chunked +Content-Type: multipart/form-data; boundary=---------------------------- +Expect: 100-continue + +2ce +------------------------------ +Content-Disposition: form-data; name="sendfile"; filename="postit2.c" + +this is what we post to the silly web server + +------------------------------ +Content-Disposition: form-data; name="callbackdata" + +this is what we post to the silly web server + +------------------------------ +Content-Disposition: form-data; name="filename" + +postit2.c +------------------------------ +Content-Disposition: form-data; name="submit" + +send +------------------------------ +Content-Disposition: form-data; name="somename"; filename="somefile.txt" +Content-Type: text/plain + +blah blah +-------------------------------- + +0 + +POST /645 HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +Accept: */* +Transfer-Encoding: chunked +Content-Type: multipart/form-data; boundary=---------------------------- +Expect: 100-continue + +2dc +------------------------------ +Content-Disposition: form-data; name="sendfile alternative"; filename="file name 2" + +this is what we post to the silly web server + +------------------------------ +Content-Disposition: form-data; name="callbackdata" + +this is what we post to the silly web server + +------------------------------ +Content-Disposition: form-data; name="filename" + +postit2.c +------------------------------ +Content-Disposition: form-data; name="submit" + +send +------------------------------ +Content-Disposition: form-data; name="somename"; filename="somefile.txt" +Content-Type: text/plain + +blah blah +-------------------------------- + +0 + + + + diff --git a/tests/data/test646 b/tests/data/test646 new file mode 100644 index 000000000..a53c34090 --- /dev/null +++ b/tests/data/test646 @@ -0,0 +1,98 @@ + + + +SMTP +MULTIPART + + + +# +# Server-side + + + +# +# Client-side + + +smtp + + +SMTP multipart using mime API + + +From: different +To: another + +body + + +smtp://%HOSTIP:%SMTPPORT/646 --mail-rcpt recipient@example.com --mail-from sender@example.com -F "=(;type=multipart/alternative" -F "= This is the html version;headers=X-test1: this is a header;type=text/html;headers=X-test2: this is another header " -F "=This is the plain text version;headers=@log/headers646" -F "=)" -F "=@log/test646.txt;headers=" + + +This is an attached file. + +It may contain any type of data. + + +# This line is a comment +X-fileheader1: This is a header from a file + +# This line is another comment. It precedes a folded header. +X-fileheader2: This is #a + folded header + + + +# +# Verify data after the test has been "shot" + + +s/^--------------------------[a-z0-9]*/------------------------------/ +s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/ + + +EHLO 646 +MAIL FROM: +RCPT TO: +DATA +QUIT + + +Content-Type: multipart/mixed; boundary=---------------------------- +Mime-Version: 1.0 +From: different +To: another +Reply-To: + +------------------------------ +Content-Type: multipart/alternative; boundary=---------------------------- + +------------------------------ +Content-Type: text/html +Content-Transfer-Encoding: 8bit +X-test1: this is a header +X-test2: this is another header + +This is the html version +------------------------------ +X-fileheader1: This is a header from a file +X-fileheader2: This is #a folded header + +This is the plain text version +-------------------------------- + +------------------------------ +Content-Disposition: attachment; filename="test646.txt" +X-fileheader1: This is a header from a file +X-fileheader2: This is #a folded header + +This is an attached file. + +It may contain any type of data. + +-------------------------------- +. + + + diff --git a/tests/data/test647 b/tests/data/test647 new file mode 100644 index 000000000..de2b467fc --- /dev/null +++ b/tests/data/test647 @@ -0,0 +1,79 @@ + + + +IMAP +APPEND +MULTIPART + + + +# +# Server-side + + + +# +# Client-side + + +imap + + +IMAP APPEND multipart using mime API + + +imap://%HOSTIP:%IMAPPORT/647 -F "=(;type=multipart/alternative" -F "= This is the html version;type=text/html" -F "=This is the plain text version" -F "=)" -F "=@log/test647.txt" -H "Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)" -H "From: Fred Foobar " -H "To: joe@example.com" -H "Message-Id: " -H "Subject: afternoon meeting" -u user:secret + + +This is an attached file. + +It may contain any type of data. + + + +# +# Verify data after the test has been "shot" + + +s/^--------------------------[a-z0-9]*/------------------------------/ +s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/ + + +A001 CAPABILITY +A002 LOGIN user secret +A003 APPEND 647 (\Seen) {892} +A004 LOGOUT + + +Content-Type: multipart/mixed; boundary=---------------------------- +Mime-Version: 1.0 +Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST) +From: Fred Foobar +To: joe@example.com +Message-Id: +Subject: afternoon meeting + +------------------------------ +Content-Type: multipart/alternative; boundary=---------------------------- + +------------------------------ +Content-Type: text/html +Content-Transfer-Encoding: 8bit + +This is the html version +------------------------------ + +This is the plain text version +-------------------------------- + +------------------------------ +Content-Disposition: attachment; filename="test647.txt" + +This is an attached file. + +It may contain any type of data. + +-------------------------------- + + + diff --git a/tests/data/test71 b/tests/data/test71 index 341a0033f..0bc76fc03 100644 --- a/tests/data/test71 +++ b/tests/data/test71 @@ -54,7 +54,6 @@ POST /we/want/71 HTTP/1.1 Host: %HOSTIP:%HTTPPORT Accept: */* Content-Length: 408 -Expect: 100-continue Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763 ------------------------------9ef8d6205763 diff --git a/tests/data/test9 b/tests/data/test9 index 7905ac838..53fe25eda 100644 --- a/tests/data/test9 +++ b/tests/data/test9 @@ -48,7 +48,6 @@ User-Agent: curl/7.10.4 (i686-pc-linux-gnu) libcurl/7.10.4 OpenSSL/0.9.7a ipv6 z Host: %HOSTIP:%HTTPPORT Accept: */* Content-Length: 407 -Expect: 100-continue Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763 ------------------------------9ef8d6205763 -- cgit v1.2.3