curl-library
RE: Problems with 7.9.4 and http-posts
Date: Fri, 8 Feb 2002 13:30:50 +0100
> On Fri, 8 Feb 2002, Hanno L. Kranzhoff wrote:
>
> > I just compiled and tested libcurl 7.9.4 on win32. I'm using it to
> upload
> > files via CURLOPT_HTTPPOST and formadd() and CURLFORM_PTRCONTENTS to
a
> > Linux server running PHP.
> >
> > The last version I used was 7.9.2 which worked just fine.
>
> I pleed guilty. I broke it in 7.9.4. :-(
>
> > There are 2 problems occurring with 7.9.4: 1) Removing the "Expect:
> > 100-continue" header in the way presented in the curl guide leads to
a
> > corrupted header and sometimes crashes libcurl. Maybe there's some
> > incorrect length calculation ?
>
> Ugha. I haven't seen this one. There *is* indeed an incorrect length
> calculation, but it affects the Content-Length: header libcurl issues
in
> the
> request, nothing else (that I've seen).
>
> The content-length problem is fixed this patch:
> http://cvs.sourceforge.net/cgi-
> bin/viewcvs.cgi/curl/curl/lib/http.c.diff?r1=1.87&r2=1.88
>
> > Removing the lines in libcurl source which automatically add the
> > "Expect:..." header for http-posts solves the problem.
>
> We need to check this out.
>
> > 2) Uploading more than one file using formadd() and
CURLFORM_PTRCONTENTS
> > leads to corrupted formdata in the way, that only the first file is
> being
> > recognized by Apache.
>
> This is my fault and you can fix this with this patch:
>
> http://cvs.sourceforge.net/cgi-
> bin/viewcvs.cgi/curl/curl/lib/formdata.c.diff?r1=1.30&r2=1.31
>
> > I'm a little surprised as I didn't see major changes concerning
headers
> and
> > formadd() between 7.9.2 and 7.9.4 in the changelog.
>
> That's my fault too. I didn't properly write what I did and didn't in
> regard
> to my formpost changes.
>
> > Did anyone else experience similar problems using 7.9.4 ?
>
> Larry Fahnoe did and thanks to his tests and my patches, we made it
work
> again.
>
> I'm still worried about that Expect: behavior you mention though. Can
you
> try
> some more with the above mentioned fixes applied (or possibly by
getting
> the
> 7.9.5-pre1 package) and see if it still happens?
>
> --
> Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
I checked 7.9.5-pre1.
The second error with sending multiple files is solved.
Removing the "Expect: 100..." header by
##
m_headerlist = curl_slist_append(m_headerlist, "Expect:");
##
still corrupts the header.
Removing the lines in libcurl source (http.c) which by default add the
"Expect: 100..." header still works though.
I did some investigation on that yesterday.
The problem only occurs when removing this particular "Expect:..:"
header.
Removing e.g. "Accept:..." (a default header, too) does not
corrupt the header.
If I see it right "Expect: 100-continue" is somehow different from other
default headers, as you have to "remove" it before it was actually added
to the headerlist, right ?
Maybe that's what makes the difference ?
Thanks for your lightning fast reply!
-- Hanno L. KranzhoffReceived on 2002-02-08