/*
Debug the form generator stand-alone by compiling this source file with:
- gcc -DHAVE_CONFIG_H -I../ -g -D_FORM_DEBUG -DCURLDEBUG -o formdata -I../include formdata.c strequal.c memdebug.c mprintf.c strerror.c
+ gcc -DHAVE_CONFIG_H -I../ -g -D_FORM_DEBUG -DCURLDEBUG -o formdata \
+ -I../include formdata.c strequal.c memdebug.c mprintf.c strerror.c
+
+ (depending on circumstances you may need further externals added)
run the 'formdata' executable the output should end with:
All Tests seem to have worked ...
(or you might see v^@lue at the start)
Content-Disposition: form-data; name="PTRCONTENTS_+_CONTENTSLENGTH_+_CONTENTTYPE"
-Content-Type: text/plain
-vlue for PTRCOTNENTS + CONTENTSLENGTH + CONTENTTYPE
+Content-Type: application/octet-stream
+vlue for PTRCONTENTS + CONTENTSLENGTH + CONTENTTYPE
(or you might see v^@lue at the start)
Content-Disposition: form-data; name="FILE1_+_CONTENTTYPE"; filename="inet_ntoa_r.h"
Content-Type: multipart/mixed, boundary=curlz1s0dkticx49MV1KGcYP5cvfSsz
...
Content-Disposition: attachment; filename="inet_ntoa_r.h"
-Content-Type: text/plain
+Content-Type: application/octet-stream
...
Content-Disposition: attachment; filename="Makefile.b32"
-Content-Type: text/plain
+Content-Type: application/octet-stream
...
Content-Disposition: form-data; name="FILE1_+_FILE2_+_FILE3"
Content-Type: multipart/mixed, boundary=curlirkYPmPwu6FrJ1vJ1u1BmtIufh1
...
Content-Disposition: attachment; filename="inet_ntoa_r.h"
-Content-Type: text/plain
+Content-Type: application/octet-stream
...
Content-Disposition: attachment; filename="Makefile.b32"
-Content-Type: text/plain
+Content-Type: application/octet-stream
...
Content-Disposition: attachment; filename="inet_ntoa_r.h"
-Content-Type: text/plain
+Content-Type: application/octet-stream
...
Content-Type: multipart/mixed, boundary=curlirkYPmPwu6FrJ1vJ1u1BmtIufh1
...
Content-Disposition: attachment; filename="inet_ntoa_r.h"
-Content-Type: text/plain
+Content-Type: application/octet-stream
...
Content-Disposition: attachment; filename="Makefile.b32"
-Content-Type: text/plain
+Content-Type: application/octet-stream
...
Content-Disposition: attachment; filename="inet_ntoa_r.h"
-Content-Type: text/plain
+Content-Type: application/octet-stream
...
Content-Disposition: form-data; name="FILECONTENT"
/* default to the previously set/used! */
contenttype = prevtype;
else
- /* It seems RFC1867 defines no Content-Type to default to
- text/plain so we don't actually need to set this: */
contenttype = HTTPPOST_CONTENTTYPE_DEFAULT;
if(filename) { /* in case a NULL was passed in */
}
-int main()
+int main(int argc, argv_item_t argv[])
{
char name1[] = "simple_COPYCONTENTS";
char name2[] = "COPYCONTENTS_+_CONTENTTYPE";
char value3[] = "value for PTRNAME + NAMELENGTH + COPYNAME + CONTENTSLENGTH";
char value4[] = "value for simple PTRCONTENTS";
char value5[] = "value for PTRCONTENTS + CONTENTSLENGTH";
- char value6[] = "value for PTRCOTNENTS + CONTENTSLENGTH + CONTENTTYPE";
+ char value6[] = "value for PTRCONTENTS + CONTENTSLENGTH + CONTENTTYPE";
char value7[] = "inet_ntoa_r.h";
char value8[] = "Makefile.b32";
char type2[] = "image/gif";
char type7[] = "text/html";
int name3length = strlen(name3);
int value3length = strlen(value3);
- int value5length = strlen(value4);
- int value6length = strlen(value5);
+ int value5length = strlen(value5);
+ int value6length = strlen(value6);
int errors = 0;
CURLcode rc;
- size_t size;
+ curl_off_t size;
size_t nread;
char buffer[4096];
struct curl_httppost *httppost=NULL;
struct FormData *form;
struct Form formread;
+ (void) argc;
+ (void) argv;
+
if (FormAddTest("simple COPYCONTENTS test", &httppost, &last_post,
CURLFORM_COPYNAME, name1, CURLFORM_COPYCONTENTS, value1,
CURLFORM_END))
fwrite(buffer, nread, 1, stdout);
} while(1);
- fprintf(stdout, "size: %d\n", size);
+ fprintf(stdout, "size: ");
+ fprintf(stdout, CURL_FORMAT_OFF_T, size);
+ fprintf(stdout, "\n");
if (errors)
fprintf(stdout, "\n==> %d Test(s) failed!\n", errors);
else