<abstract>This specification defines two Jingle transport methods for establishing HTTP connections for either uploading or downloading data.</abstract>
<remark><p>Renamed <uploaded/> to <completed/>, and made it a child of the <transport/> element in transport-info events.</p></remark>
<p>&xep0166; defines a framework for negotiating and managing out-of-band data sessions over XMPP. In order to provide a flexible framework, the base Jingle specification defines neither data transport methods nor application formats, leaving that up to separate specifications.</p>
<p>The current document defines two transport methods for establishing and managing data exchanges between XMPP entities using the Hyper Text Transfer Protocol (HTTP, see &rfc2616;); one method is for sharing via pulling data from an HTTP URI (http-download), and the other is for sharing via pushing data to an HTTP URI (http-upload).</p>
</section1>
<section1topic='Requirements'anchor='reqs'>
<p>Historically, &xep0066; has been used to trigger downloading files via HTTP, as well as initiating the use of any other known URI scheme. However, it has several limitations:</p>
<ul>
<li>It only allows for the downloading of files via HTTP, not uploading.</li>
<li>It can not specify any additional headers that might be necessary for downloading files (authentication tokens, etc).</li>
<li>The allowance of any URI scheme makes it too unwieldy to be integrated into Jingle the way SOCKS5 Bytestreams and In-Band Bytestreams were (see &xep0260; and &xep0261;).</li>
</ul>
<p>As such, this document defines two Jingle mechanisms designed to meet the following requirements:</p>
<ul>
<li>Allow for both uploading and downloading of data via HTTP.</li>
<li>Allow additional HTTP headers to be specified.</li>
<p>In accordance with Section 12 of <cite>XEP-0166</cite>, this document specifies the following information related to both the Jingle http-download and http-upload transport methods:</p>
<ol>
<li><p>The transport negotiation process for http-download is defined in the <linkurl='#download'>Negotiating HTTP Download</link> section of this document, and the negotation process for http-upload is defined in the <linkurl='#upload'>Negotiating HTTP Upload</link> section of this document.</p></li>
<li><p>The semantics of the &TRANSPORT; element are defined in the <linkurl='#download'>Negotiating HTTP Download</link> and <linkurl='#upload'>Negotiating HTTP Upload</link> sections of this document.</p></li>
<li><p>Successful negotiation of both the http-download and http-upload methods results in use of a streaming transport method suitable for use in Jingle application types where packet loss cannot be tolerated (e.g., file transfer).</p></li>
<li><p>Multiple components are not supported by http-download or http-upload.</p></li>
<p>Negotiating HTTP downloads is done by using a &TRANSPORT; element with the 'urn:xmpp:jingle:transports:http:0' namespace, &VNOTE;. This element MAY include <candidate/> elements which represent URIs where data can be downloaded. Each <candidate/> element MUST include a 'uri' attribute, and MAY contain <header/> elements whose 'name' attribute is an HTTP header and whose text content is the HTTP header value.</p>
<p>Multiple candidates MAY be provided, indicating that there are multiple URIs from which the data can be retrieved (e.g. multiple candidates could be included to list the primary URI of a file along with several known mirrors).</p>
<p>The generation of candidates is based on the Jingle content senders, and only the parties specified to send data SHOULD provide candidates.</p>
<p>Upon receiving an HTTP download candidate, parties that are to receive data (based on the Jingle content senders) SHOULD use an HTTP GET request to the candidate URI to fetch the data.</p>
<p>Entities MAY initially provide an empty set of candidates if a suitable download URI is not yet known; advertising candidates later is done with transport-info actions.</p>
<tablecaption='Summary of Roles in Jingle HTTP Download'>
<p>Negotiating HTTP uploads is done by using a &TRANSPORT; element with the 'urn:xmpp:jingle:transports:http:upload:0' namespace, &VNOTE;. This element MAY include a <candidate/> element which represents a URI where data can be uploaded. The <candidate/> element MUST include a 'uri' attribute, and MAY contain <header/> elements whose 'name' attribute is an HTTP header and whose text content is the HTTP header value.</p>
<p>The generation of candidates is based on the Jingle content senders, and only the parties specified to receive data SHOULD provide candidates.</p>
<p>Upon receiving an HTTP upload candidate, parties that are to send data (based on the Jingle content senders) SHOULD use an HTTP PUT request to the candidate URI, where the request body is the data to be transferred.</p>
<tablecaption='Summary of Roles in Jingle HTTP Upload'>
<tr>
<th>Content Creator</th>
<th>Content Senders</th>
<th>Who Sends Upload Candidates</th>
<th>Who Performs HTTP PUT</th>
</tr>
<tr>
<tdrowspan='4'>initiator</td>
<td>initiator</td>
<td>responder</td>
<td>initiator</td>
</tr>
<tr>
<td>responder</td>
<td>initiator</td>
<td>responder</td>
</tr>
<tr>
<td>both</td>
<td>both</td>
<td>both</td>
</tr>
<tr>
<td>none</td>
<td>none</td>
<td>none</td>
</tr>
<tr>
<tdrowspan='4'>responder</td>
<td>initiator</td>
<td>responder</td>
<td>initiator</td>
</tr>
<tr>
<td>responder</td>
<td>initiator</td>
<td>responder</td>
</tr>
<tr>
<td>both</td>
<td>both</td>
<td>both</td>
</tr>
<tr>
<td>none</td>
<td>none</td>
<td>none</td>
</tr>
</table>
<p>See <linkurl='#upload-complete'>Upload Complete</link> for signaling that the upload process has been completed.</p>
<p>A common case for using http-upload is to delegate the storage of the uploaded data to an external hosting service, which means that the receiver might not have the direct ability to know when the uploaded data is ready.</p>
<p>As such, when an upload transfer is used, the party uploading content SHOULD signal when the upload has completed by sending a Jingle transport-info event that specifies the content for which uploading has completed, and includes a <transport/> element qualified by the 'urn:xmpp:jingle:transports:http:upload:0' namespace, which in turn contains a <completed /> element.</p>
<p>To advertise its support for the Jingle HTTP Transport Method, when replying to &xep0030; information requests an entity MUST return URNs for any version of this protocol that the entity supports -- e.g., "urn:xmpp:jingle:transports:http:0" for this version &VNOTE;.</p>
<examplecaption="Service discovery information request"><![CDATA[
<p>In order for an application to determine whether an entity supports this protocol, where possible it SHOULD use the dynamic, presence-based profile of service discovery defined in &xep0115;. However, if an application has not received entity capabilities information from an entity, it SHOULD use explicit service discovery instead.</p>
<p>This specification defines the following XML namespaces:</p>
<ul>
<li>urn:xmpp:jingle:transports:http:0</li>
<li>urn:xmpp:jingle:transports:http:upload:0</li>
<li>urn:xmpp:jingle:transports:http:info:0</li>
</ul>
<p>The ®ISTRAR; includes the foregoing namespace in its registry of protocol namespaces at &NAMESPACES;, as described in Section 4 of &xep0053;.</p>
<section2topic='Jingle Transport Methods'anchor='registrar-content'>
<p>The ®ISTRAR; includes "http-download" in its registry of Jingle transport methods at &JINGLETRANSPORTS;. The registry submission is as follows:</p>
<code><![CDATA[
<transport>
<name>http-download</name>
<desc>
A method for negotiating data exchange via HTTP URI retrieval.
</desc>
<type>streaming</type>
<doc>XEP-XXXX</doc>
</transport>]]></code>
<p>The ®ISTRAR; includes "http-upload" in its registry of Jingle transport methods at &JINGLETRANSPORTS;. The registry submission is as follows:</p>
<code><![CDATA[
<transport>
<name>http-upload</name>
<desc>
A method for negotiating data exchange via uploading to HTTP URIs.