title: How do I process multipart http responses in Ruby Net:HTTP?
body: <p>There is so much information out there on how to generate multipart responses or do multipart file uploads. I can't seem to find any information on how to process a multipart http response. Here is some IRB output from a multipart http response I am working with. </p>
  
  <pre><code>&gt;&gt; response.http.content_type
  =&gt; "multipart/related"
  &gt;&gt; response.http.body[0..2048]
  =&gt; "\r\n------=_Part_3_806633756.1271797659309\r\nContent-Type: text/xml; charset=UTF-8\r\nContent-Transfer-Encoding: binary\r\nContent-Id: &lt;A0FCC4333C6D0FCA346B97FAB6B61818&gt;\r\n\r\n&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;&lt;soapenv:Body&gt;&lt;ns1:runReportResponse soapenv:encodingStyle="http://www.w3.org/2003/05/soap-encoding" xmlns:ns1="http://192.168.1.200:8080/jasperserver/services/repository"&gt;&lt;ns2:result xmlns:ns2="http://www.w3.org/2003/05/soap-rpc"&gt;runReportReturn&lt;/ns2:result&gt;&lt;runReportReturn xsi:type="xsd:string"&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;\n&amp;lt;operationResult version=&amp;quot;2.0.1&amp;quot;&amp;gt;\n\t&amp;lt;returnCode&amp;gt;&amp;lt;![CDATA[0]]&amp;gt;&amp;lt;/returnCode&amp;gt;\n&amp;lt;/operationResult&amp;gt;\n&lt;/runReportReturn&gt;&lt;/ns1:runReportResponse&gt;&lt;/soapenv:Body&gt;&lt;/soapenv:Envelope&gt;\r\n------=_Part_3_806633756.1271797659309\r\nContent-Type: application/pdf\r\nContent-Transfer-Encoding: binary\r\nContent-Id: &lt;report&gt;\r\n\r\n%PDF-1.4\n%\342\343\317\323\n3 0 obj 
  </code></pre>