| *** /homes/qradlsg/curl-org/lib/formdata.c Thu Oct 14 00:27:12 1999 |
| --- formdata.c Mon Nov 22 16:55:20 1999 |
| *************** |
| *** 41,47 **** |
| /* |
| Debug the form generator stand-alone by compiling this source file with: |
| |
| ! 'make formdata' |
| |
| run the 'formdata' executable and make sure the output is ok! |
| |
| --- 41,47 ---- |
| /* |
| Debug the form generator stand-alone by compiling this source file with: |
| |
| ! gcc -DHAVE_CONFIG_H -I../ -g -D_FORM_DEBUG -o formdata -I../include formdata.c |
| |
| run the 'formdata' executable and make sure the output is ok! |
| |
| *************** |
| *** 313,320 **** |
| if(!length) |
| length = strlen((char *)line); |
| |
| ! newform->line = (char *)malloc(length); |
| ! memcpy(newform->line, line, length); |
| newform->length = length; |
| |
| if(*formp) { |
| --- 313,320 ---- |
| if(!length) |
| length = strlen((char *)line); |
| |
| ! newform->line = (char *)malloc(length+1); |
| ! memcpy(newform->line, line, length+1); |
| newform->length = length; |
| |
| if(*formp) { |
| *************** |
| *** 499,504 **** |
| --- 499,505 ---- |
| size += AddFormDataf(&form, |
| "\r\n--%s--", |
| fileboundary); |
| + free(fileboundary); |
| } |
| |
| } while((post=post->next)); /* for each field */ |
| *************** |
| *** 511,518 **** |
| *sizep = size; |
| |
| free(boundary); |
| - if(fileboundary) |
| - free(fileboundary); |
| |
| return firstform; |
| } |
| --- 512,517 ---- |
| *************** |
| *** 572,577 **** |
| --- 571,583 ---- |
| |
| form->data = form->data->next; /* advance */ |
| |
| + if(!gotsize && form->data) { |
| + /* If we got an empty line and we have more data, we proceed to the next |
| + line immediately to avoid returning zero before we've reached the end. |
| + This is the bug reported November 22 1999 on curl 6.3. (Daniel) */ |
| + gotsize = FormReader(buffer, size, nitems, mydata); |
| + } |
| + |
| return gotsize; |
| } |
| |
| *************** |
| *** 615,621 **** |
| FormInit(&formread, form); |
| |
| while(nread = FormReader(buffer, 1, sizeof(buffer), (FILE *)&formread)) { |
| ! fwrite(buffer, nread, 1, stdout); |
| } |
| |
| fprintf(stderr, "size: %d\n", size); |
| --- 621,627 ---- |
| FormInit(&formread, form); |
| |
| while(nread = FormReader(buffer, 1, sizeof(buffer), (FILE *)&formread)) { |
| ! fwrite(buffer, nread, 1, stderr); |
| } |
| |
| fprintf(stderr, "size: %d\n", size); |