aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2000-06-15 14:33:17 +0000
committerDaniel Stenberg <daniel@haxx.se>2000-06-15 14:33:17 +0000
commite9957b87cddec5ebba678be944c3d410843907e4 (patch)
tree1ba84f493b4144a8af7204b70e87bd450ffb8159 /lib
parentf93baee5948f9ee69bd4caae3e4c3250f5a6df33 (diff)
removed the last \r\n\r\n bytes
now returns -1 from FormReader() when the last form data has been read!
Diffstat (limited to 'lib')
-rw-r--r--lib/formdata.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/formdata.c b/lib/formdata.c
index 4eb2d94c2..0cdf56889 100644
--- a/lib/formdata.c
+++ b/lib/formdata.c
@@ -318,6 +318,7 @@ static int AddFormData(struct FormData **formp,
newform->line = (char *)malloc(length+1);
memcpy(newform->line, line, length+1);
newform->length = length;
+ newform->line[length]=0; /* zero terminate for easier debugging */
if(*formp) {
(*formp)->next = newform;
@@ -517,12 +518,20 @@ int FormInit(struct Form *form, struct FormData *formdata )
{
if(!formdata)
return 1; /* error */
-
- /* First, make sure that we'll send a nice terminating sequence at the end
+
+#if 0
+ struct FormData *lastnode=formdata;
+
+ /* find the last node in the list */
+ while(lastnode->next) {
+ lastnode = lastnode->next;
+ }
+
+ /* Now, make sure that we'll send a nice terminating sequence at the end
* of the post. We *DONT* add this string to the size of the data since this
* is actually AFTER the data. */
- AddFormDataf(&formdata, "\r\n\r\n");
-
+ AddFormDataf(&lastnode, "\r\n\r\n");
+#endif
form->data = formdata;
form->sent = 0;
@@ -544,7 +553,7 @@ int FormReader(char *buffer,
wantedsize = size * nitems;
if(!form->data)
- return 0; /* nothing, error, empty */
+ return -1; /* nothing, error, empty */
do {