1
2
3
4
5
6
7Network Working Group D. Cridland
8Request for Comments: 5524 Isode Limited
9Category: Standards Track May 2009
10
11
12 Extended URLFETCH for Binary and Converted Parts
13
14Status of This Memo
15
16 This document specifies an Internet standards track protocol for the
17 Internet community, and requests discussion and suggestions for
18 improvements. Please refer to the current edition of the "Internet
19 Official Protocol Standards" (STD 1) for the standardization state
20 and status of this protocol. Distribution of this memo is unlimited.
21
22Copyright Notice
23
24 Copyright (c) 2009 IETF Trust and the persons identified as the
25 document authors. All rights reserved.
26
27 This document is subject to BCP 78 and the IETF Trust's Legal
28 Provisions Relating to IETF Documents in effect on the date of
29 publication of this document (http://trustee.ietf.org/license-info).
30 Please review these documents carefully, as they describe your rights
31 and restrictions with respect to this document.
32
33Abstract
34
35 The URLFETCH command defined as part of URLAUTH provides a mechanism
36 for third parties to gain access to data held within messages in a
37 user's private store; however, this data is sent verbatim, which is
38 not suitable for a number of applications. This memo specifies a
39 method for obtaining data in forms suitable for non-mail
40 applications.
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58Cridland Standards Track [Page 1]
59
60RFC 5524 URLFETCH Binary May 2009
61
62
63Table of Contents
64
65 1. Introduction ....................................................2
66 2. Conventions Used in This Document ...............................2
67 3. Extended URLFETCH ...............................................2
68 3.1. Command Parameters .........................................3
69 3.2. Response Metadata ..........................................3
70 4. Example Exchanges ...............................................4
71 5. Formal Syntax ...................................................6
72 6. IANA Considerations .............................................7
73 7. Security Considerations .........................................7
74 8. Acknowledgements ................................................7
75 9. References ......................................................8
76 9.1. Normative References .......................................8
77 9.2. Informative References .....................................8
78
791. Introduction
80
81 Although [URLAUTH] provides a URLFETCH command that can be used to
82 dereference a URL and return the body-part data, it does so by
83 returning the encoded form, without sufficient metadata to decode.
84 This is suitable for use in mail applications such as [BURL], where
85 the encoded form is suitable, but not where access to the actual
86 content is required, such as in [STREAMING].
87
88 This memo specifies a mechanism that returns additional metadata
89 about the part, such as its [MEDIATYPE] type, as well as removes any
90 content transfer encoding that was used on the body part.
91
922. Conventions Used in This Document
93
94 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
95 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
96 document are to be interpreted as described in RFC 2119 [KEYWORDS].
97
98 Protocol examples are line-wrapped for clarity. Protocol strings are
99 prefixed with C: and S: for client and server respectively, and
100 elided data is represented by [...]. Implementors should note these
101 notations are for editorial clarity only.
102
1033. Extended URLFETCH
104
105 This extension is available in any IMAP server implementation that
106 includes URLAUTH=BINARY within its capability string.
107
108 Such servers accept additional, per-URL parameters to the URLFETCH
109 command and will provide, upon request, specific data for each URL
110 dereferenced.
111
112
113
114Cridland Standards Track [Page 2]
115
116RFC 5524 URLFETCH Binary May 2009
117
118
1193.1. Command Parameters
120
121 The URLFETCH command is extended by the provision of optional
122 parameters. The extended URLFETCH command is distinct by enclosing
123 each URL and associated parameters in a parenthesized list. Cases
124 where there is an absence of any parameters or where the URL is sent
125 unenclosed cause the command to behave precisely as specified in
126 [URLAUTH].
127
128 Similarly, if the URL is invalid, the command will behave precisely
129 as specified in [URLAUTH] and return a simple NIL.
130
131 Available parameters are:
132
133 BODYPARTSTRUCTURE
134 Provide a BODYPARTSTRUCTURE.
135
136 BODYPARTSTRUCTURE is defined in [CONVERT] and provides metadata
137 useful for processing applications, such as the type of data.
138
139 BINARY
140 Provide the data without any Content-Transfer-Encoding.
141
142 In particular, this means that the data MAY contain NUL octets and
143 not be formed from textual lines. Data containing NUL octets MUST
144 be transferred using the literal8 syntax defined in [BINARY].
145
146 BODY
147 Provide the data as-is.
148
149 This will provide the same data as the unextended [URLAUTH] as a
150 metadata item.
151
152 Metadata items MUST NOT appear more than once per URL requested, and
153 clients MUST NOT request both BINARY and BODY.
154
1553.2. Response Metadata
156
157 In order to carry any requested metadata and provide additional
158 information to the consumer, the URLFETCH response is similarly
159 extended.
160
161 Following the URL itself, servers will include a series of
162 parenthesized metadata elements. Defined metadata elements are as
163 follows:
164
165
166
167
168
169
170Cridland Standards Track [Page 3]
171
172RFC 5524 URLFETCH Binary May 2009
173
174
175 BODYPARTSTRUCTURE
176 The BODYPARTSTRUCTURE provides information about the data
177 contained in the response, as it has been returned. It will
178 reflect any conversions or decoding that have taken place. In
179 particular, this will show an identity encoding if BINARY is also
180 requested.
181
182 BINARY
183 The BINARY item provides the content, without any content transfer
184 encoding applied. If this is not possible (for example, the
185 content transfer encoding is unknown to the server), then this MAY
186 contain NIL. Servers MUST understand all identity content
187 transfer encodings defined in [MIME], as well as the
188 transformation encodings "Base64" [BASE64] and "Quoted-Printable"
189 [MIME].
190
191 BODY
192 The BODY item provides the content as found in the message, with
193 any content transfer encoding still applied. Requesting only the
194 BODY will provide equivalent functionality to the unextended
195 [URLAUTH], however, using the extended syntax described herein.
196
197 Note that unlike [CONVERT], BODYPARTSTRUCTURE is not appended with
198 the part specifier, as this is implicit in the URL.
199
2004. Example Exchanges
201
202 A client requests the data with no content transfer encoding.
203
204 C: A001 URLFETCH ("imap://joe@example.com/INBOX/;uid=20/;
205 section=1.2;urlauth=anonymous:internal:
206 91354a473744909de610943775f92038" BINARY)
207 S: * URLFETCH "imap://joe@example.com/INBOX/;uid=20/;
208 section=1.2;urlauth=anonymous:internal:
209 91354a473744909de610943775f92038" (BINARY {28}
210 S: Si vis pacem, para bellum.
211 S:
212 S: )
213 S: A001 OK URLFETCH completed
214
215 Note that the data here does not contain a NUL octet; therefore, a
216 literal -- not literal8 -- syntax has been used.
217
218 A client again requests data with no content transfer encoding, but
219 this time requests the body structure.
220
221
222
223
224
225
226Cridland Standards Track [Page 4]
227
228RFC 5524 URLFETCH Binary May 2009
229
230
231 C: A001 URLFETCH ("imap://joe@example.com/INBOX/;uid=20/;
232 section=1.3;urlauth=anonymous:internal:
233 ae354a473744909de610943775f92038" BINARY BODYPARTSTRUCTURE)
234 S: * URLFETCH "imap://joe@example.com/INBOX/;uid=20/;
235 section=1.3;urlauth=anonymous:internal:
236 ae354a473744909de610943775f92038" (BODYPARTSTRUCTURE
237 ("IMAGE" "PNG" () NIL NIL "BINARY" 123)) (BINARY ~{123}
238 S: [123 octets of data, some of which is NUL])
239 S: A001 OK URLFETCH completed
240
241 A client requests only the body structure.
242
243 C: A001 URLFETCH ("imap://joe@example.com/INBOX/;uid=20/;
244 section=1.3;urlauth=anonymous:internal:
245 ae354a473744909de610943775f92038" BODYPARTSTRUCTURE)
246 S: * URLFETCH "imap://joe@example.com/INBOX/;uid=20/;
247 section=1.3;urlauth=anonymous:internal:
248 ae354a473744909de610943775f92038" (BODYPARTSTRUCTURE
249 ("IMAGE" "PNG" () NIL NIL "BASE64" 164))
250 S: A001 OK URLFETCH completed
251
252 A client requests the body structure and the original content.
253
254 C: A001 URLFETCH ("imap://joe@example.com/INBOX/;uid=20/;
255 section=1.3;urlauth=anonymous:internal:
256 ae354a473744909de610943775f92038" BODYPARTSTRUCTURE BODY)
257 S: * URLFETCH "imap://joe@example.com/INBOX/;uid=20/;
258 section=1.3;urlauth=anonymous:internal:
259 ae354a473744909de610943775f92038" (BODYPARTSTRUCTURE
260 ("IMAGE" "PNG" () NIL NIL "BASE64" 164)) (BODY {164}
261 S: [164 octets of base64 encoded data])
262 S: A001 OK URLFETCH completed
263
264 Some parts cannot be decoded, so the server will provide the
265 BODYPARTSTRUCTURE of the part as is and provide NIL for the binary
266 content:
267
268 C: A001 URLFETCH ("imap://joe@example.com/INBOX/;uid=20/;
269 section=1.4;urlauth=anonymous:internal:
270 87ecbd02095b815e699503fc20d869c8" BODYPARTSTRUCTURE BINARY)
271 S: * URLFETCH "imap://joe@example.com/INBOX/;uid=20/;
272 section=1.4;urlauth=anonymous:internal:
273 87ecbd02095b815e699503fc20d869c8" (BODYPARTSTRUCTURE
274 ("IMAGE" "PNG" () NIL NIL "X-BLURDYBLOOP" 123))
275 (BINARY NIL)
276 S: A001 OK URLFETCH completed
277
278
279
280
281
282Cridland Standards Track [Page 5]
283
284RFC 5524 URLFETCH Binary May 2009
285
286
287 If a part simply doesn't exist, however, or the URI is invalid for
288 some other reason, then NIL is returned instead of metadata:
289
290 C: A001 URLFETCH ("imap://joe@example.com/INBOX/;uid=20/;
291 section=200;urlauth=anonymous:internal:
292 88066d37e2e5410e1a6486350a8836ee" BODYPARTSTRUCTURE BODY)
293 S: * URLFETCH "imap://joe@example.com/INBOX/;uid=20/;
294 section=200;urlauth=anonymous:internal:
295 88066d37e2e5410e1a6486350a8836ee" NIL
296 S: A001 OK URLFETCH completed
297
2985. Formal Syntax
299
300 This formal syntax uses ABNF as specified in [ABNF], and includes
301 productions defined in [URLAUTH], [BINARY], and [IMAP].
302
303 capability =/ "URLAUTH=BINARY"
304
305 ; Command parameters; see Section 3.1
306
307 urlfetch = "URLFETCH" 1*(SP url-fetch-arg)
308
309 url-fetch-arg = url-fetch-simple / url-fetch-ext
310
311 url-fetch-simple = url-full
312 ; Unextended URLFETCH.
313
314 url-fetch-ext = "(" url-full *(SP url-fetch-param) ")"
315 ; If no url-fetch-param present, as unextended.
316
317 url-fetch-param = "BODY" / "BINARY" / "BODYPARTSTRUCTURE" / atom
318
319 ; Response; see Section 3.2
320
321 urlfetch-data = "*" SP "URLFETCH"
322 1*(SP (urldata-simple / urldata-ext /
323 urldata-error))
324
325 urldata-error = SP url-full SP nil
326
327 urldata-simple = SP url-full SP nstring
328 ; If client issues url-fetch-simple, server MUST respond with
329 ; urldata-simple.
330
331 urldata-ext = SP url-full url-metadata
332
333 url-metadata = 1*(SP "(" url-metadata-el ")")
334
335
336
337
338Cridland Standards Track [Page 6]
339
340RFC 5524 URLFETCH Binary May 2009
341
342
343 url-metadata-el = url-meta-bodystruct / url-meta-body /
344 url-meta-binary
345
346 url-meta-bodystruct = "BODYPARTSTRUCTURE" SP body
347
348 url-meta-binary = "BINARY" SP ( nstring / literal8 )
349 ; If content contains a NUL octet, literal8 MUST be used.
350 ; Otherwise, content SHOULD use nstring.
351 ; On decoding error, NIL should be used.
352
353 url-meta-body = "BODY" SP nstring
354
3556. IANA Considerations
356
357 IMAP4 capabilities are registered by publishing a Standards Track or
358 IESG-approved Experimental RFC.
359
360 This document defines the URLFETCH=BINARY IMAP capability. IANA has
361 added it to the registry accordingly.
362
3637. Security Considerations
364
365 Implementors are directed to the security considerations within
366 [IMAP], [URLAUTH], and [BINARY].
367
368 The ability of the holder of a URL to be able to fetch metadata about
369 the content pointed to by the URL as well as the content itself
370 allows a potential attacker to discover more about the content than
371 was previously possible, including its original filename and user-
372 supplied description.
373
374 The additional value of this information to an attacker is marginal,
375 and applies only to those URLs for which the attacker does not have
376 direct access, such as those produced by [URLAUTH]. Implementors are
377 therefore directed to the security considerations present in
378 [URLAUTH].
379
3808. Acknowledgements
381
382 Comments were received on this idea and/or document from Neil Cook,
383 Philip Guenther, Alexey Melnikov, Ken Murchison, and others. Whether
384 in agreement or dissent, the comments have refined and otherwise
385 influenced this document.
386
387
388
389
390
391
392
393
394Cridland Standards Track [Page 7]
395
396RFC 5524 URLFETCH Binary May 2009
397
398
3999. References
400
4019.1. Normative References
402
403 [ABNF] Crocker, D. and P. Overell, "Augmented BNF for Syntax
404 Specifications: ABNF", STD 68, RFC 5234, January 2008.
405
406 [BASE64] Josefsson, S., "The Base16, Base32, and Base64 Data
407 Encodings", RFC 4648, October 2006.
408
409 [BINARY] Nerenberg, L., "IMAP4 Binary Content Extension",
410 RFC 3516, April 2003.
411
412 [CONVERT] Melnikov, A. and P. Coates, "Internet Message Access
413 Protocol - CONVERT Extension", RFC 5259, July 2008.
414
415 [IMAP] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION
416 4rev1", RFC 3501, March 2003.
417
418 [KEYWORDS] Bradner, S., "Key words for use in RFCs to Indicate
419 Requirement Levels", BCP 14, RFC 2119, March 1997.
420
421 [MIME] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
422 Extensions (MIME) Part One: Format of Internet Message
423 Bodies", RFC 2045, November 1996.
424
425 [URLAUTH] Crispin, M., "Internet Message Access Protocol (IMAP) -
426 URLAUTH Extension", RFC 4467, May 2006.
427
4289.2. Informative References
429
430 [BURL] Newman, C., "Message Submission BURL Extension",
431 RFC 4468, May 2006.
432
433 [MEDIATYPE] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
434 Extensions (MIME) Part Two: Media Types", RFC 2046,
435 November 1996.
436
437 [STREAMING] Cook, N., "Streaming Internet Messaging Attachments",
438 Work in Progress, March 2009.
439
440
441
442
443
444
445
446
447
448
449
450Cridland Standards Track [Page 8]
451
452RFC 5524 URLFETCH Binary May 2009
453
454
455Author's Address
456
457 Dave Cridland
458 Isode Limited
459 5 Castle Business Village
460 36, Station Road
461 Hampton, Middlesex TW12 2BX
462 GB
463
464 EMail: dave.cridland@isode.com
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506Cridland Standards Track [Page 9]
507
508