No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0096.xml 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. %ents;
  5. ]>
  6. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  7. <xep>
  8. <header>
  9. <title>SI File Transfer</title>
  10. <abstract>This specification defines a profile of the XMPP stream initiation extension for transferring files between two entities. The protocol provides a modular framework that enables the exchange of information about the file to be transferred as well as the negotiation of parameters such as the transport to be used.</abstract>
  11. &LEGALNOTICE;
  12. <number>0096</number>
  13. <status>Deprecated</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <dependencies>
  17. <spec>XMPP Core</spec>
  18. <spec>XEP-0095</spec>
  19. </dependencies>
  20. <supersedes/>
  21. <supersededby><spec>XEP-0234</spec></supersededby>
  22. <shortname>si-filetransfer</shortname>
  23. <schemaloc>
  24. <url>http://www.xmpp.org/schemas/file-transfer.xsd</url>
  25. </schemaloc>
  26. &temas;
  27. &linuxwolf;
  28. &reatmon;
  29. &stpeter;
  30. <revision>
  31. <version>1.3</version>
  32. <date>2017-11-29</date>
  33. <initials>XEP Editor (ssw)</initials>
  34. <remark>Deprecated by vote of the council.</remark>
  35. </revision>
  36. <revision>
  37. <version>1.2</version>
  38. <date>2004-04-13</date>
  39. <initials>psa</initials>
  40. <remark>More fully defined the XMPP Registrar considerations.</remark>
  41. </revision>
  42. <revision>
  43. <version>1.1</version>
  44. <date>2003-12-30</date>
  45. <initials>psa</initials>
  46. <remark>Improved explanatory text; fixed several errors in the schema.</remark>
  47. </revision>
  48. <revision>
  49. <version>1.0</version>
  50. <date>2003-10-17</date>
  51. <initials>psa</initials>
  52. <remark>Per a vote of the Jabber Council, advanced status to Draft.</remark>
  53. </revision>
  54. <revision>
  55. <version>0.7</version>
  56. <date>2003-10-07</date>
  57. <initials>tjm</initials>
  58. <remark>Added IBB as a MUST requirement.</remark>
  59. </revision>
  60. <revision>
  61. <version>0.6</version>
  62. <date>2003-08-18</date>
  63. <initials>tjm</initials>
  64. <remark>Cleaned up some namespace inconsistencies, added the &lt;desc&gt;
  65. element for file descriptions.</remark>
  66. </revision>
  67. <revision>
  68. <version>0.5</version>
  69. <date>2003-07-15</date>
  70. <initials>rwe</initials>
  71. <remark>Stream ids not needed on return results. Moved s5b, ibb, and url-data to the actual namespaces of the stream protocols.</remark>
  72. </revision>
  73. <revision>
  74. <version>0.4</version>
  75. <date>2003-06-30</date>
  76. <initials>lw</initials>
  77. <remark>Fixed various typos and inconsistencies</remark>
  78. </revision>
  79. <revision>
  80. <version>0.3</version>
  81. <date>2003-06-30</date>
  82. <initials>lw</initials>
  83. <remark>Added XML Schema</remark>
  84. </revision>
  85. <revision>
  86. <version>0.2</version>
  87. <date>2003-06-24</date>
  88. <initials>tjm</initials>
  89. <remark>
  90. Clarified many examples, added linuxwolf as an author (again, my bad,
  91. should have been there), clarified the allowed streams and how data is
  92. sent over it.
  93. </remark>
  94. </revision>
  95. <revision>
  96. <version>0.1</version>
  97. <date>2003-06-10</date>
  98. <initials>tjm</initials>
  99. <remark>Initial version.</remark>
  100. </revision>
  101. </header>
  102. <section1 topic='Introduction' anchor='intro'>
  103. <p>The traditional mechanism for transferring files in the Jabber community is the &xep0066; protocol. That protocol has several drawbacks:</p>
  104. <ol>
  105. <li>It is not reliable.</li>
  106. <li>It does not work when one of the parties is behind a firewall.</li>
  107. <li>It provides limited metadata about files to be exchanged.</li>
  108. </ol>
  109. <p>The current document defines a profile of &xep0095; that solves the problems with out-of-band data, thus providing a robust, reliable mechanism for file transfers over the Jabber network. Implementors are referred to XEP-0095 regarding the underlying concepts of stream initiation.</p>
  110. </section1>
  111. <section1 topic='Requirements' anchor='reqs'>
  112. <ul>
  113. <li>Enable seamless file transfer, including fall-back mechanisms as appropriate.</li>
  114. <li>Ensure that the profile will work even when one or both parties are behind a firewall.</li>
  115. <li><p>Define a full-featured set of metadata for file transfers, including the following:</p>
  116. <ul>
  117. <li>description</li>
  118. <li>size</li>
  119. <li>name</li>
  120. <li>date</li>
  121. <li>hash</li>
  122. </ul>
  123. </li>
  124. <li>Optionally support ranged transfers.</li>
  125. </ul>
  126. </section1>
  127. <section1 topic='Protocol' anchor='protocol'>
  128. <p>
  129. The file transfer profile is in the
  130. "http://jabber.org/protocol/si/profile/file-transfer" namespace.
  131. The profile is fairly simple: it consists of the root element
  132. with the possibility of one child describing the optional ranged transfers.
  133. </p>
  134. <p>
  135. The root element is &lt;file&gt; and has four attributes. The attributes
  136. are used only during the offer stage of stream initiation:</p>
  137. <ul>
  138. <li><em>size</em> - The size, in bytes, of the data to be sent.</li>
  139. <li><em>name</em> - The name of the file that the Sender wishes to send.</li>
  140. <li><em>date</em> - The last modification time of the file. This is
  141. specified using the DateTime profile as described in &xep0082;.</li>
  142. <li><em>hash</em> - The MD5 sum of the file contents.</li>
  143. </ul>
  144. <p>The <em>size</em> and <em>name</em> attributes MUST be present in the
  145. profile. The other attributes MAY be present.
  146. </p>
  147. <p>
  148. There are two possible child elements of the root: &lt;desc&gt; and
  149. &lt;range&gt;. Both are OPTIONAL.
  150. </p>
  151. <p>
  152. &lt;desc&gt; is used to provide a sender-generated description of the file so
  153. the receiver can better understand what is being sent. It MUST NOT be sent in
  154. the result.
  155. </p>
  156. <p>
  157. When &lt;range&gt; is sent in the offer, it should have no
  158. attributes. This signifies that the
  159. sender can do ranged transfers. When a Stream Initiation result is sent
  160. with the &lt;range&gt; element, it uses these attributes:</p>
  161. <ul>
  162. <li>
  163. <em>offset</em> - Specifies the position, in bytes, to start
  164. transferring the file data from. This defaults to zero (0) if not
  165. specified.
  166. </li>
  167. <li>
  168. <em>length</em> - Specifies the number of bytes to retrieve starting
  169. at offset. This defaults to the length of the file from offset to the
  170. end.
  171. </li>
  172. </ul>
  173. <p>Both attributes are OPTIONAL on the &lt;range&gt; element. Sending no
  174. attributes is synonymous with not sending the &lt;range&gt;
  175. element. When no &lt;range&gt; element is sent in the
  176. Stream Initiation result, the Sender MUST send the complete file starting at
  177. offset 0. More generally, data is sent over the stream byte for byte starting
  178. at the offset position for the length specified.
  179. </p>
  180. <section2 topic='Mandatory-to-Implement Technologies' anchor='protocol-tech'>
  181. <p>In order to enable seamless file transfer and appropriate fall-back mechanisms, implementations of this profile MUST support both &xep0065; and &xep0047;, to be preferred in that order. The associated namespaces are to be included as option values for the "stream-method" variable as shown in the examples below.</p>
  182. <p>Additionally, implementations MAY support other mechanisms.</p>
  183. </section2>
  184. </section1>
  185. <section1 topic='Examples' anchor='examples'>
  186. <example caption='Simple Profile Usage in Stream Initiation Offer'>
  187. <![CDATA[
  188. <iq type='set' id='offer1' to='receiver@jabber.org/resource'>
  189. <si xmlns='http://jabber.org/protocol/si'
  190. id='a0'
  191. mime-type='text/plain'
  192. profile='http://jabber.org/protocol/si/profile/file-transfer'>
  193. <file xmlns='http://jabber.org/protocol/si/profile/file-transfer'
  194. name='test.txt'
  195. size='1022'/>
  196. <feature xmlns='http://jabber.org/protocol/feature-neg'>
  197. <x xmlns='jabber:x:data' type='form'>
  198. <field var='stream-method' type='list-single'>
  199. <option><value>http://jabber.org/protocol/bytestreams</value></option>
  200. <option><value>http://jabber.org/protocol/ibb</value></option>
  201. </field>
  202. </x>
  203. </feature>
  204. </si>
  205. </iq>
  206. ]]>
  207. </example>
  208. <example caption='Simple Profile Usage in Stream Initiation Result'>
  209. <![CDATA[
  210. <iq type='result' to='sender@jabber.org/resource' id='offer1'>
  211. <si xmlns='http://jabber.org/protocol/si'>
  212. <feature xmlns='http://jabber.org/protocol/feature-neg'>
  213. <x xmlns='jabber:x:data' type='submit'>
  214. <field var='stream-method'>
  215. <value>http://jabber.org/protocol/bytestreams</value>
  216. </field>
  217. </x>
  218. </feature>
  219. </si>
  220. </iq>
  221. ]]>
  222. </example>
  223. <example caption='Complete Profile Usage in Stream Initiation Offer'>
  224. <![CDATA[
  225. <iq type='set' id='offer1' to='receiver@jabber.org/resource'>
  226. <si xmlns='http://jabber.org/protocol/si'
  227. id='a0'
  228. mime-type='text/plain'
  229. profile='http://jabber.org/protocol/si/profile/file-transfer'>
  230. <file xmlns='http://jabber.org/protocol/si/profile/file-transfer'
  231. name='test.txt'
  232. size='1022'
  233. hash='552da749930852c69ae5d2141d3766b1'
  234. date='1969-07-21T02:56:15Z'>
  235. <desc>This is a test. If this were a real file...</desc>
  236. </file>
  237. <feature xmlns='http://jabber.org/protocol/feature-neg'>
  238. <x xmlns='jabber:x:data' type='form'>
  239. <field var='stream-method' type='list-single'>
  240. <option><value>http://jabber.org/protocol/bytestreams</value></option>
  241. <option><value>http://jabber.org/protocol/ibb</value></option>
  242. </field>
  243. </x>
  244. </feature>
  245. </si>
  246. </iq>
  247. ]]>
  248. </example>
  249. <example caption='Complete Profile Usage in Stream Initiation Result'>
  250. <![CDATA[
  251. <iq type='result' to='sender@jabber.org/resource' id='offer1'>
  252. <si xmlns='http://jabber.org/protocol/si'>
  253. <file xmlns='http://jabber.org/protocol/si/profile/file-transfer'/>
  254. <feature xmlns='http://jabber.org/protocol/feature-neg'>
  255. <x xmlns='jabber:x:data' type='submit'>
  256. <field var='stream-method'>
  257. <value>http://jabber.org/protocol/bytestreams</value>
  258. </field>
  259. </x>
  260. </feature>
  261. </si>
  262. </iq>
  263. ]]>
  264. </example>
  265. <p>This range should retrieve 256 bytes from the beginning of the file:</p>
  266. <example>
  267. <![CDATA[
  268. <range length='256'/>
  269. ]]>
  270. </example>
  271. <p>This range should retrieve 256 bytes starting from the 128th byte in the file:</p>
  272. <example>
  273. <![CDATA[
  274. <range offset='128' length='256'/>
  275. ]]>
  276. </example>
  277. <p>This range should retrieve the remainder of the file starting at the 128th byte in the file:</p>
  278. <example>
  279. <![CDATA[
  280. <range offset='128'/>
  281. ]]>
  282. </example>
  283. <p>This range is the same as having not sent the range request and the entire file is sent:</p>
  284. <example>
  285. <![CDATA[
  286. <range/>
  287. ]]>
  288. </example>
  289. </section1>
  290. <section1 topic='IANA Considerations' anchor='iana'>
  291. <p>No interaction with &IANA; is required as a result of this document.</p>
  292. </section1>
  293. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  294. <section2 topic='Stream Initiation Profiles' anchor='registrar-siprofiles'>
  295. <p>The profile described in this document is included in the stream initiation profiles registry maintained by the &REGISTRAR; (see &SIPROFILES;). The registry submission is as follows:</p>
  296. <code><![CDATA[
  297. <profile>
  298. <name>http://jabber.org/protocol/si/profile/file-transfer</name>
  299. <doc>XEP-0096</doc>
  300. <desc>A profile for file transfer between any two entities.</desc>
  301. </profile>
  302. ]]></code>
  303. </section2>
  304. <section2 topic='URI Query Types' anchor='registrar-querytypes'>
  305. <p>As authorized by &xep0147;, the XMPP Registrar maintains a registry of queries and key-value pairs for use in XMPP URIs (see &QUERYTYPES;).</p>
  306. <p>As described below, the registered querytypes for file transfer actions are "sendfile" and "recvfile". Note well that "sendfile" means a second entity will send a file to the XMPP entity that controls the IRI/URI and that "recvfile" means a second entity will receive a file from the XMPP entity that controls the IRI/URI.</p>
  307. <section3 topic='sendfile' anchor='registrar-querytypes-sendfile'>
  308. <p>To enable a second entity to send a file, the IRI/URI is of the following form:</p>
  309. <example caption='Sending a File: IRI/URI'><![CDATA[
  310. xmpp:romeo@montague.net/orchard?sendfile
  311. ]]></example>
  312. <p>The application SHOULD then present an interface enabling the user to provide information about the file to be sent (e.g., by "browsing" the file system of the user's computer in order to choose a file). As a result, the application SHOULD then send a &xep0137; message to the XMPP address encapsulated in the IRI/URI:</p>
  313. <example caption='Sending a File: Resulting Stanza'><![CDATA[
  314. <message from='juliet@capulet.com/balcony' to='romeo@montague.net'>
  315. <sipub xmlns='http://jabber.org/protocol/si-pub'
  316. id='publish-0123'
  317. mime-type='text/plain'
  318. profile='http://jabber.org/protocol/si/profile/file-transfer'>
  319. <file xmlns='http://jabber.org/protocol/si/profile/file-transfer'
  320. name='missive.txt'
  321. size='1024'
  322. date='2005-11-29T11:21Z'/>
  323. </sipub>
  324. </message>
  325. ]]></example>
  326. <p>The following submission registers the "sendfile" querytype.</p>
  327. <code><![CDATA[
  328. <querytype>
  329. <name>sendfile</name>
  330. <proto>http://jabber.org/protocol/si/profile/file-transfer</proto>
  331. <desc>enables initiation of an inbound file transfer to XMPP entity</desc>
  332. <doc>XEP-0096</doc>
  333. </querytype>
  334. ]]></code>
  335. </section3>
  336. <section3 topic='recvfile' anchor='registrar-querytypes-recvfile'>
  337. <p>To enable a second entity to receive a file, the IRI/URI is of the following form:</p>
  338. <example caption='Receiving a File: IRI/URI'><![CDATA[
  339. xmpp:romeo@montague.net/orchard?recvfile;sid=pub234;mime-type=text%2Fplain;name=reply.txt;size=2048
  340. ]]></example>
  341. <p>That IRI/URI is equivalent to the following XML stanza:</p>
  342. <example caption='Receiving a File: Equivalent Stanza'><![CDATA[
  343. <message from='romeo@montague.net' to='juliet@capulet.com/balcony'>
  344. <sipub xmlns='http://jabber.org/protocol/si-pub'
  345. id='pub234'
  346. mime-type='text/plain'
  347. profile='http://jabber.org/protocol/si/profile/file-transfer'>
  348. <file xmlns='http://jabber.org/protocol/si/profile/file-transfer'
  349. name='reply.txt'
  350. size='2048'/>
  351. </sipub>
  352. </message>
  353. ]]></example>
  354. <p>In accordance with <cite>XEP-0137</cite>, the application SHOULD then initiate a file transfer exchange with by sending a stanza of the following form:</p>
  355. <example caption='Receiving a File: Resulting Stanza'><![CDATA[
  356. <iq from='juliet@capulet.com/balcony' to='romeo@montague.net/orchard'>
  357. <start xmlns='http://jabber.org/protocol/si-pub' id='pub234'/>
  358. </iq>
  359. ]]></example>
  360. <p>Note well that the request to begin the stream is sent to the full JID (user@host/resource) of the XMPP entity identified by the XMPP IRI/URI. Therefore, the IRI/URI SHOULD include a full JID. If it does not, the receiver MUST discover a full JID via presence or service discovery. If the receiver cannot discover a full JID for the sender (e.g., in the last resort through sending a presence subscription request to the sender and receiving presence from the sender's resources), then it SHOULD abort the file transfer exchange.</p>
  361. <p>The following submission registers the "recvfile" querytype.</p>
  362. <code><![CDATA[
  363. <querytype>
  364. <name>recvfile</name>
  365. <proto>http://jabber.org/protocol/si/profile/file-transfer</proto>
  366. <desc>enables initiation of an outbound file transfer from XMPP entity</desc>
  367. <doc>XEP-0096</doc>
  368. <keys>
  369. <key>
  370. <name>algo</name>
  371. <desc>the hash algorithm used to generate the checksum</desc>
  372. </key>
  373. <key>
  374. <name>hash</name>
  375. <desc>a checksum of the file contents</desc>
  376. </key>
  377. <key>
  378. <name>mime-type</name>
  379. <desc>the MIME type of the file being offered</desc>
  380. </key>
  381. <key>
  382. <name>name</name>
  383. <desc>the name of the file being offered</desc>
  384. </key>
  385. <key>
  386. <name>sid</name>
  387. <desc>the session ID associated with the file being offered</desc>
  388. </key>
  389. <key>
  390. <name>size</name>
  391. <desc>the size in bytes of the file being offered</desc>
  392. </key>
  393. </keys>
  394. </querytype>
  395. ]]></code>
  396. </section3>
  397. </section2>
  398. </section1>
  399. <section1 topic='XML Schema' anchor='schema'>
  400. <code><![CDATA[
  401. <?xml version='1.0' encoding='UTF-8'?>
  402. <xs:schema
  403. xmlns:xs='http://www.w3.org/2001/XMLSchema'
  404. targetNamespace='http://jabber.org/protocol/si/profile/file-transfer'
  405. xmlns='http://jabber.org/protocol/si/profile/file-transfer'
  406. elementFormDefault='qualified'>
  407. <xs:annotation>
  408. <xs:documentation>
  409. The protocol documented by this schema is defined in
  410. XEP-0096: http://www.xmpp.org/extensions/xep-0096.html
  411. </xs:documentation>
  412. </xs:annotation>
  413. <xs:element name='file'>
  414. <xs:complexType>
  415. <xs:sequence minOccurs='0'>
  416. <xs:element name='desc' type='xs:string'/>
  417. <xs:element ref='range'/>
  418. </xs:sequence>
  419. <xs:attribute name='date' type='xs:string' use='optional'/>
  420. <xs:attribute name='hash' type='xs:string' use='optional'/>
  421. <xs:attribute name='name' type='xs:string' use='required'/>
  422. <xs:attribute name='size' type='xs:integer' use='required'/>
  423. </xs:complexType>
  424. </xs:element>
  425. <xs:element name='range'>
  426. <xs:complexType>
  427. <xs:simpleContent>
  428. <xs:extension base='empty'>
  429. <xs:attribute name='length' type='xs:integer' use='optional'/>
  430. <xs:attribute name='offset' type='xs:integer' use='optional'/>
  431. </xs:extension>
  432. </xs:simpleContent>
  433. </xs:complexType>
  434. </xs:element>
  435. <xs:simpleType name='empty'>
  436. <xs:restriction base='xs:string'>
  437. <xs:enumeration value=''/>
  438. </xs:restriction>
  439. </xs:simpleType>
  440. </xs:schema>
  441. ]]></code>
  442. </section1>
  443. </xep>