cURL / Mailing Lists / curl-library / Single Mail

curl-library

[patch] RE: Problems with 7.9.4 and http-posts

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 8 Feb 2002 13:44:22 +0100 (MET)

On Fri, 8 Feb 2002, Hanno L. Kranzhoff wrote:

> 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. ^

I took another look on the code that does this and I don't have a shadow of a
doubt that this doesn't work! Further, this hasn't worked in a long while.

> The problem only occurs when removing this particular "Expect:..:" header.
> Removing e.g. "Accept:..." (a default header, too) does not corrupt the
> header.

Right, each of those disables are treated separately.

> 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 ?

They all work that way, more or less.

> Maybe that's what makes the difference ?

Disabling the Expect: header also mistakenly disables the Content-Type header
and the CRLF ending of the request!

Try this patch:

Index: http.c
===================================================================
RCS file: /cvsroot/curl/curl/lib/http.c,v
retrieving revision 1.88
diff -u -r1.88 http.c
--- http.c 7 Feb 2002 09:32:40 -0000 1.88
+++ http.c 8 Feb 2002 12:38:44 -0000
@@ -840,23 +840,23 @@
         add_bufferf(req_buffer,
                     "Expect: 100-continue\r\n");
         data->set.expect100header = TRUE;
+ }

- /* Get Content-Type: line from Curl_FormReadOneLine, which happens
- to always be the first line. We can know this for sure since
- we always build the formpost linked list the same way! */
- linelength = Curl_FormReadOneLine (contentType,
- sizeof(contentType),
- 1,
- (FILE *)&http->form);
- if(linelength == -1) {
- failf(data, "Could not get Content-Type header line!");
- return CURLE_HTTP_POST_ERROR;
- }
- add_buffer(req_buffer, contentType, linelength);
-
- /* make the request end in a true CRLF */
- add_buffer(req_buffer, "\r\n", 2);
+ /* Get Content-Type: line from Curl_FormReadOneLine, which happens
+ to always be the first line. We can know this for sure since
+ we always build the formpost linked list the same way! */
+ linelength = Curl_FormReadOneLine (contentType,
+ sizeof(contentType),
+ 1,
+ (FILE *)&http->form);
+ if(linelength == -1) {
+ failf(data, "Could not get Content-Type header line!");
+ return CURLE_HTTP_POST_ERROR;
       }
+ add_buffer(req_buffer, contentType, linelength);
+
+ /* make the request end in a true CRLF */
+ add_buffer(req_buffer, "\r\n", 2);

       /* set upload size to the progress meter */
       Curl_pgrsSetUploadSize(data, http->postsize);

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2002-02-08