cURL / Mailing Lists / curl-users / Single Mail

curl-users

[ curl-Bugs-524440 ] HTTP header is not replaced in POST req.

From: <noreply_at_sourceforge.net>
Date: Fri, 01 Mar 2002 09:27:57 -0800

Bugs item #524440, was opened at 2002-03-01 09:27
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=100976&aid=524440&group_id=976

Category: http
Group: bad behaviour
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Daniel Stenberg (bagder)
Summary: HTTP header is not replaced in POST req.

Initial Comment:
Linux xxxxxxxxx 2.4.7-10 #1 Thu Sep 6 17:27:27 EDT
2001 i686 unknown

Using curl-7.9.4, the libcurl.so

The following code was used to replace the Content-
Type header, with a different one. Based on the
documentation, I expected that setting the HTTPHEADER
would replace the curl-generated Content-Type:

  struct HttpPost *post = NULL;
  struct HttpPost *last = NULL;
  struct curl_slist *end_slist;

  /* Add simple name/content section */
  tdata->curl_status = curl_formadd (&post, &last,
CURLFORM_COPYNAME, "name",
                                     
CURLFORM_COPYCONTENTS, "content", CURLFORM_END);
  TRACE(tdata->curl_status);
  
  /* Set the form info */
  tdata->curl_status = curl_easy_setopt (tdata-
>curl_handle, CURLOPT_HTTPPOST, post);
  TRACE(tdata->curl_status);
  
  /* Replace the Content-type header */
  end_slist = curl_slist_append( NULL, "Content-Type:
application/http;
boundary=rdg_curltnjSQzg6idA3mzNi9gfxtKhOmru" );

  /* Set the form info */
  tdata->curl_status = curl_easy_setopt (tdata-
>curl_handle, CURLOPT_HTTPHEADER, end_slist );
  TRACE(tdata->curl_status);

The resulting HTTP header looks like this:
POST /f1.html HTTP/1.1
Host: aaa.aaa.aaa.aaa:xxxx
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg,
image/pjpeg, */*
Content-Type: application/http;
boundary=qwerty_curltnjSQzg6idA3mzNi9gfxtKhOmru
Content-Length: 126
Expect: 100-continue
Content-Type: multipart/form-data;
boundary=curlUCDP8lTwpeerbfeSnan2sOO59bS

The content-type is found twice in the header, which
was not expected.

----------------------------------------------------------------------

You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=100976&aid=524440&group_id=976
Received on 2002-03-01