cURL / Mailing Lists / curl-library / Single Mail

curl-library

How to change Content-Type & boundary?

From: 时有 <shiyou_at_nextbase.cn>
Date: Fri, 14 Sep 2007 11:10:12 +0800

 Dear all:

      I have some problem with change the Conten-Type & boundary,please help:
I changed content-type in the header: Content-Type: multipart/related;boundary="END_OF_PART",
But how to change in the follow? It still the curl internal generated things:
Content-Type: multipart/form-data; boundary=--------------------
--------f7b04d5f6e80

== Info: About to connect() to picasaweb.google.com port 80
== Info: Trying 72.14.255.91... == Info: connected
== Info: Connected to picasaweb.google.com (72.14.255.91) port 80
=> Send header, 242 bytes (0xf2)
0000: POST /data/feed/api/user/oursrainbow/album/landscape HTTP/1.1
003f: Host: picasaweb.google.com
005b: Pragma: no-cache
006d: Accept: */*
007a: Content-Type: multipart/related;boundary="END_OF_PART"
00b2: MIME-version: 1.0
00c5: Content-Length: 558
00da: Expect: 100-continue
00f0:
=> Send data, 596 bytes (0x254)
0000: Content-Type: multipart/form-data; boundary=--------------------
0040: --------f7b04d5f6e80
0056: ------------------------------f7b04d5f6e80
0082: Content-Disposition: form-data; name=""
00ab: Content-Type: application/atom+xml
00cf:
00d1: <entry xmlns='http://www.w3.org/2005/Atom'>..<title>darcy-beach.
0111: jpg</title>..<summary>Darcy on the beach</summary>..<category sc
0151: heme="http://schemas.google.com/g/2005#kind"..term="http://schem
0191: as.google.com/photos/2007#photo"/>..</entry>..
01c1: ------------------------------f7b04d5f6e80
01ed: Content-Disposition: form-data; name=""; filename="./bak_picasa_
022d: test.jpg"
0238: Content-Type: image/jpeg
0252:

Source code:
res = curl_formadd(&formpost,&lastptr,
                                                 CURLFORM_COPYNAME,"",
                                                 CURLFORM_CONTENTTYPE,"application/atom+xml",
                                                CURLFORM_COPYCONTENTS, ac_xmlreq,
                                                CURLFORM_END);
                         
                         printf("1res=%d\n",res);
                         
                         res = curl_formadd(&formpost,&lastptr,
                                                 CURLFORM_COPYNAME,"",
                                                CURLFORM_FILE,"./bak_picasa_test.jpg",
                                                CURLFORM_END);

                         printf("1res=%d\n",res);

                        struct curl_slist *slist=NULL;
                slist = curl_slist_append(slist, "Content-Type: multipart/related;boundary=\"END_OF_PART\"");
            slist = curl_slist_append(slist, "MIME-version: 1.0");
                        slist = curl_slist_append(slist, "Media multipart posting");
     
                                 
--------------
aaron_shi
2007-09-14
Received on 2007-09-14