|
290 | 290 | <get url='https://download.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/tr%C3%A8s%20cool.jpg' />
|
291 | 291 | </slot>
|
292 | 292 | </iq>]]></example>
|
| 293 | +</section1> |
| 294 | +<section1 topic='Upload purpose' anchor='purpose'> |
| 295 | + |
| 296 | + <p>Retention policy is out of scope for this document. However, common retention strategies include enforcing user quotas that trigger the deletion of the oldest files when exceeded, and automatically deleting files older than a specified timeframe. This retention policy works well for message attachments, which are downloaded once per recipient device, but it may not be suitable for files requiring longer availability, like user avatars or microblog post images. To alleviate this problem, the requesting entity MAY specify a purpose when requesting an upload slot. This allows the upload service to sort files into different 'buckets' and apply different retention periods to those buckets. If no purpose is specified, the service MUST assume 'message' as the default purpose.</p> |
| 297 | + |
| 298 | +<section2 topic='Message' anchor='purpose-message'> |
| 299 | + <p>An entity advertises support for the 'message' purpose by including "urn:xmpp:http:upload:purpose:0#message" in its service discovery features.</p> |
| 300 | + <p>The requesting entity indicates that the upload slot is meant to be used for messaging purposes by including an element 'message' qualified by the 'urn:xmpp:http:upload:purpose:0' namespace.</p> |
| 301 | + <p class="note">Note: As the 'message' purpose is the default, explicitly announcing the feature and including this purpose in the slot request is technically redundant and is done solely for the sake of completeness.</p> |
| 302 | + <example caption='Client requests a slot for the purpose of sending it as a message'><![CDATA[ |
| 303 | +<iq from='[email protected]/garden' |
| 304 | + id='step_03' |
| 305 | + to='upload.montague.tld' |
| 306 | + type='get'> |
| 307 | + <request xmlns='urn:xmpp:http:upload:0' |
| 308 | + filename='hi.jpg' |
| 309 | + size='23425' |
| 310 | + content-type='image/jpeg'> |
| 311 | + <message xmlns="urn:xmpp:http:upload:purpose:0" /> |
| 312 | + </request> |
| 313 | +</iq>]]></example> |
| 314 | + |
| 315 | +</section2> |
| 316 | + |
| 317 | +<section2 topic='Profile' anchor='purpose-profile'> |
| 318 | + <p>An entity advertises support for the 'profile' purpose by including "urn:xmpp:http:upload:purpose:0#profile" in its service discovery features.</p> |
| 319 | + |
| 320 | + <p>The requesting entity indicates that the upload slot is meant to be used for profile purposes by including a 'profile' element, qualified by the urn:xmpp:http:upload:purpose:0 namespace. This purpose is for files, such as avatars (&xep0084;) or cover photos, that require longer retention, are smaller in size, and need a significantly lower overall quota.</p> |
| 321 | + |
| 322 | + <example caption='Client requests an HTTP upload slot for the purpose of uploading an avatar'><![CDATA[ |
| 323 | +<iq from='[email protected]/garden' |
| 324 | + id='step_03' |
| 325 | + to='upload.montague.tld' |
| 326 | + type='get'> |
| 327 | + <request xmlns='urn:xmpp:http:upload:0' |
| 328 | + filename='avatar.jpg' |
| 329 | + size='100' |
| 330 | + content-type='image/jpeg'> |
| 331 | + <profile xmlns="urn:xmpp:http:upload:purpose:0"/> |
| 332 | + </request> |
| 333 | +</iq>]]></example> |
| 334 | + |
| 335 | +</section2> |
| 336 | + |
| 337 | +<section2 topic='Ephemeral' anchor='purpose-ephemeral'> |
| 338 | + <p>An entity advertises support for the ephemeral purpose by including "urn:xmpp:http:upload:purpose:0#ephemeral" in its service discovery features.</p> |
| 339 | + |
| 340 | + <p>The requesting entity indicates that the upload slot is meant to be used for ephemeral purposes by including an 'ephemeral' element, qualified by the urn:xmpp:http:upload:purpose:0 namespace. The element MUST have an attribute called 'expire-before' that contains a DateTime as specified in &xep0082;. This purpose is similar to the default 'message' purpose but imposes an upper limit on the retention period, as specified by the requesting entity. The upload service MAY delete the file earlier based on its own retention policies, but MUST NOT make the file available after the time specified in the expire-before attribute.<br/>Example use cases for this purpose include, but are not limited to &xep0466; or 'Stories' that expire after 24 hours.</p> |
| 341 | + |
| 342 | + <example caption='Client requests a slot with a limited lifetime'><![CDATA[ |
| 343 | +<iq from='[email protected]/garden' |
| 344 | + id='step_03' |
| 345 | + to='upload.montague.tld' |
| 346 | + type='get'> |
| 347 | + <request xmlns='urn:xmpp:http:upload:0' |
| 348 | + filename='eiffel-tower-status-picture.jpg' |
| 349 | + size='100' |
| 350 | + content-type='image/jpeg'> |
| 351 | + <ephemeral xmlns="urn:xmpp:http:upload:purpose:0" |
| 352 | + expire-before="2025-09-10T23:08:25Z" /> |
| 353 | + </request> |
| 354 | +</iq>]]></example> |
| 355 | + |
| 356 | +</section2> |
| 357 | + |
| 358 | +<section2 topic='Permanent' anchor='purpose-permanent'> |
| 359 | + <p>An entity advertises support for the permanent purpose by including "urn:xmpp:http:upload:purpose:0#permanent" in its service discovery features.</p> |
| 360 | + |
| 361 | + <p>The requesting entity indicates that the upload slot is meant for long term storage by including a 'permanent' element, qualified by the urn:xmpp:http:upload:purpose:0 namespace.<br/>Example use cases for this purpose include, but are not limited to &xep0277; and &xep0472;.<br/>Support for this purpose - like any other specific purpose - is OPTIONAL.</p> |
| 362 | + |
| 363 | + <example caption='Client requests a slot for permanent storage'><![CDATA[ |
| 364 | +<iq from='[email protected]/garden' |
| 365 | + id='step_03' |
| 366 | + to='upload.montague.tld' |
| 367 | + type='get'> |
| 368 | + <request xmlns='urn:xmpp:http:upload:0' |
| 369 | + filename='pubsub-blog-picture.jpg' |
| 370 | + size='42000' |
| 371 | + content-type='image/jpeg'> |
| 372 | + <permanent xmlns="urn:xmpp:http:upload:purpose:0" /> |
| 373 | + </request> |
| 374 | +</iq>]]></example> |
| 375 | + |
| 376 | +</section2> |
| 377 | + |
293 | 378 | </section1>
|
294 | 379 | <section1 topic='Error conditions' anchor='errors'>
|
295 | 380 | <p>Instead of providing the client with a slot the service MAY respond with an error if the requested file size is too large. In addition the entity MAY inform the requester about the maximum file size.</p>
|
|
0 commit comments