aboutsummaryrefslogtreecommitdiff
path: root/curl_63_form.patch
blob: 03738dbc037c1ff723ef4fe469e402bda88c70a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
*** /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);