%ents; ]>
HTTP File Upload This specification defines a protocol to request permissions from another entity to upload a file to a specific path on an HTTP server and at the same time receive a URL from which that file can later be downloaded again. &LEGALNOTICE; 0363 Experimental Standards Track Standards Council XMPP Core XEP-0030 XEP-0128 NOT_YET_ASSIGNED Daniel Gultsch daniel@gultsch.de daniel@gultsch.de 0.2.4 2016-10-28 dg (XEP Editor: ssw)

Fix TLS reference

0.2.3 2016-07-11 wjt (XEP Editor: ssw)

Typo fixes

0.2.2 2016-03-30 ssw

Typo fix

0.2.1 2016-03-16 XEP Editor (ssw)

Minor dependency and citation fixes (fs).

0.2 2016-03-07 dg

Announce maximum file size by means of &xep0128;

0.1.2 2016-02-16 XEP Editor (mam)

Fix typo of discovery (Philipp Hancke).

0.1.1 2016-01-05 XEP Editor (ssw)

Fix invalid XML in examples (tpa).

0.1 2015-08-27 XEP Editor (mam)

Initial published version approved by the XMPP Council.

0.0.1 2015-07-25 dg

First draft.

XMPP protocol extensions already define methods for peer-to-peer file transfer such as &xep0096; or &xep0234; however due to their very nature of being peer-to-peer they don't work very well in scenarios where it is requeried to send a file to multiple recipients or multiple resources of the same recipient at once. They also don’t work alongside offline storage, MUC history and &xep0313;.

Uploading files manually to an HTTP server and sharing the link has been a workaround for this for a long time now. While users have a variety of services to choose from the downside of this manual approach is that an XMPP client can not automate this process on behalf of the user since these services don’t share a common API. Furthermore using a third party service would probably require the user to enter additional credentials into their XMPP client specifically for the file upload.

This XEP defines an approach to request permissions from another entity to upload a file to a specific path on an HTTP server and at the same time receive an URL from which that file can later be downloaded again. These tuples consisting of a PUT and a GET-URL are called slots.

An entity advertises support for this protocol by including the "urn:xmpp:http:upload" in its service discovery information features as specified in &xep0030; or section 6.3 of &xep0115;. To avoid unnecessary round trips an entity SHOULD also include the maximum file size as specified in &xep0128; if such a limitation exists. The field name MUST be "max-file-size" and the value MUST be in bytes.

A users server SHOULD include any known entities that provide such services into its service discovery items.

]]> ]]> ]]> urn:xmpp:http:upload 5242880 ]]>

A client requests a new upload slot by sending an IQ-get to the upload service containing a <request> child element qualified by the urn:xmpp:http:upload namespace. This element MUST include elements <filename> and <size> containing the file name and size respectively.

An additional element <content-type> containing the Content-Type is OPTIONAL.

my_juliet.png 23456 image/jpeg ]]>

The upload service responds with both a PUT and a GET URL wrapped by a <slot> element. The service SHOULD keep the file name and especially the file ending intact. Using the same hostname for PUT and GET is OPTIONAL. The host SHOULD provide Transport Layer Security (&rfc5246;).

https://upload.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my_juliet.png https://download.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my_juliet.png ]]>

Instead of providing the client with a slot the service MAY respond with an error if the requested file size is too large.

my_juliet.png 23456 20000 ]]>

For any other type of error the service SHOULD respond with appropriate error types to indicate temporary or permanent errors.

my_juliet.png 23456 my_juliet.png 23456

The actual upload of the file happens via HTTP-PUT and is out of scope of this document. The upload service MUST reject the file upload if the Content-Length does not match the size of the slot request. The service SHOULD reject the file if the Content-Type has been specified beforehand and does not match. The service MAY assume application/octet-stream as a Content-Type if it the client did not specify a Content-Type at all.

There is no further XMPP communication required between the upload service and the client. A HTTP status Code of 201 means that the server is now ready to serve the file via the provided GET URL. If the upload fails for whatever reasons the client MAY request a new slot.

The upload service SHOULD choose an appropriate timeout for the validity of the PUT URL. Since there is no reason for a client to wait between requesting the slot and starting the upload, relatively low timeout values of around 60s are RECOMMENDED.

It is RECOMMENDED that the service stores the files for as long as possible which is of course limited by storage capacity. A service MAY choose to store the latest x MiB of a given user.

This document requires no interaction with the Internet Assigned Numbers Authority (IANA).

This specification defines the following XML namespace:

  • urn:xmpp:http:upload

Upon advancement of this specification from a status of Experimental to a status of Draft, the ®ISTRAR; shall add the foregoing namespace to the registry located at &NAMESPACES;, as described in Section 4 of &xep0053;.

tbd