cURL / Mailing Lists / curl-users / Single Mail

curl-users

Removing "bondary" tag from http post request.

From: shivpratap <shivpratap_chauhan_at_persistent.co.in>
Date: Mon, 17 Sep 2007 19:48:20 +0530

Hi All,

I am facing a problem with http post request, whene ever i try to post a
file, libcurl add a boundary tag into it, i want to send a xml file,
without introducing the "boundary tags in http post request.

This is the code to send a file:

URL *curl;
           CURLcode res;
 
           struct curl_httppost *formpost=NULL;
           struct curl_httppost *lastptr=NULL;
           struct curl_slist *headerlist=NULL;
           char buf[] = "Expect:";
 
        curl_global_init(CURL_GLOBAL_ALL);
         
           /* Fill in the file upload field like a html file upload form
        * this will simulate an equavalent request in html as:
        * <input type="file" name="">
        */
        curl_formadd(&formpost,&lastptr,CURLFORM_COPYNAME,
"temp1.xml",CURLFORM_FILECONTENT, temp_pathname,CURLFORM_END);

        curl = curl_easy_init();
         if(curl)
        {
                    curl_easy_setopt(curl, CURLOPT_URL, server_address);
                     curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
                     res = curl_easy_perform(curl);
                     curl_easy_cleanup(curl);
                     curl_formfree(formpost);
                     curl_slist_free_all (headerlist);
           }

This is the http request for this, that have been intercepted by
"tcpmon" utility.

POST /cms/remote/email-inject HTTP/1.1
Host: 192.168.2.213:8084
Pragma: no-cache
Accept: */*
Content-Length: 3702
Expect: 100-continue
Content-Type: multipart/form-data;
boundary=----------------------------5856b4d0d088

------------------------------5856b4d0d088
< Here are the Contents of the xml file >
------------------------------5856b4d0d088--

Here boundary tag in red, i want this should not appear in http post
request.

Any help will be appreciated.

--
Thanks,
-shiv
DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.
Received on 2007-09-17