From 45d883d88df76af778ce7024912d3fdd08d13859 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 8 Aug 2011 10:21:03 +0200 Subject: CURLFORM_BUFFER: insert filename as documented A regression where CURLFORM_BUFFER stopped to properly insert the file name part in the formpart. Bug introduced in commit f851f768578dc096. Added CURLFORM_BUFFER use to test 554 to verify this. Bug: http://curl.haxx.se/mail/lib-2011-07/0176.html Reported by: Henry Ludemann --- tests/data/test554 | 7 ++++++- tests/libtest/lib554.c | 10 ++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/data/test554 b/tests/data/test554 index 7fdc353fc..9d9bbcca7 100644 --- a/tests/data/test554 +++ b/tests/data/test554 @@ -45,7 +45,7 @@ s/boundary=----------------------------[a-z0-9]*/boundary=---------------------- POST /554 HTTP/1.1 Host: %HOSTIP:%HTTPPORT Accept: */* -Content-Length: 561 +Content-Length: 732 Expect: 100-continue Content-Type: multipart/form-data; boundary=---------------------------- @@ -67,6 +67,11 @@ postit2.c Content-Disposition: form-data; name="submit" send +------------------------------ +Content-Disposition: form-data; name="somename"; filename="somefile.txt" +Content-Type: application/octet-stream + +blah blah -------------------------------- diff --git a/tests/libtest/lib554.c b/tests/libtest/lib554.c index ed8d13f05..8e71c8899 100644 --- a/tests/libtest/lib554.c +++ b/tests/libtest/lib554.c @@ -136,6 +136,16 @@ int test(char *URL) if(formrc) printf("curl_formadd(3) = %d\n", (int)formrc); + formrc = curl_formadd(&formpost, &lastptr, + CURLFORM_COPYNAME, "somename", + CURLFORM_BUFFER, "somefile.txt", + CURLFORM_BUFFERPTR, "blah blah", + CURLFORM_BUFFERLENGTH, 9, + CURLFORM_END); + + if(formrc) + printf("curl_formadd(4) = %d\n", (int)formrc); + if ((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_formfree(formpost); -- cgit v1.2.3