cURL / Mailing Lists / curl-users / Single Mail

curl-users

RE: v8 --enable-dream-mode

From: Marcus Webster <marcus.webster_at_phocis.com>
Date: Thu, 13 Dec 2001 09:55:55 -0000

In response to Daniel Stenberg...
I have used "diff -u" for this attachment.
 
In response to Kevin Roth...
I am primarily a Windows programmer, but that doesn't prevent me from having to write software for Solaris every now and then. Fortunately for me, samba enables me to use my favourite C++ editor - you can probably guess the one, and make files aren't that hard to write.
 
Below is an abbreviated SOAP message that I send
 
POST /soap/servlet/rpcrouter HTTP/1.1
Host: sdx.phocis.com
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
SOAPAction: ""
Content-Length: 182255
Content-Type: multipart/form-data; boundary=curllfRmE4z/WAHTycf4xS3blcKjavw
 
--curllfRmE4z/WAHTycf4xS3blcKjavw
Content-Disposition: form-data; name="XmlBody"
Content-Type: text/xml; charset=utf-8
 
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV=" http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC= http://schemas.xmlsoap.org/soap/encoding/
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd=" http://www.w3.org/2001/XMLSchema">
xmlns:soap=" http://schemas.xmlsoap.org/wsdl/soap/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:processSoapRequest xmlns:ns1="urn:sdxRequest"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<xmlData xsi:type="xsd:string> -- The SOAP message goes in here -- </xmlData>
<RawContent href="cid:f816ce43537cbd7a2e5d18f1ceb1d537.phocis.com"/>
</ns1:processSoapRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
 

--curllfRmE4z/WAHTycf4xS3blcKjavw
Content-Disposition: form-data; name="Attachment"
Content-Type: application/octet-stream
Content-Transfer-Encoding: 8bit
Content-ID: <f816ce43537cbd7a2e5d18f1ceb1d537.phocis.com>
Content-Length: 180288
 
...
...
...
 
--curllfRmE4z/WAHTycf4xS3blcKjavw--
 
The bit that my code adds is the headers for the attachment(s), curl does the Content-Disposition, and Content-Type, but I need to add Content-Transfer-Encoding, Content-ID & Content-Length. As you can see the headers Curl supplies for the SOAP envelope is good enough, but the SOAP body refers to other attachments in the POST by Content-ID.
 
So the code I use sets up a curl_slist ...
 
 sContentId = szContentID;
 sContentId += ".phocis.com";
 
 list = curl_slist_append( list, "Content-Transfer-Encoding: 8bit" );
 
 ssTemp << "Content-ID: <" << sContentId << ">";
 list = curl_slist_append( list, ssTemp.str().c_str() );
 
 ssTemp.str().erase();
 ssTemp << "Content-Length: " << iContentLength;
 list = curl_slist_append( list, ssTemp.str().c_str() );
 
Then when I add the attachment to the POST data, the header list gets incorporated...
 
   //Add more parts to the request as necessary
   curl_formadd( &m_formpost,
        &m_lastpost,
        CURLFORM_PTRNAME, szAttName,
        CURLFORM_PTRCONTENTS, v,
        CURLFORM_CONTENTTYPE, "application/octet-stream",
        CURLFORM_CONTENTSLENGTH, iLen,
        CURLFORM_CONTENTHEADER, list,
        CURLFORM_END );

Received on 2001-12-13