home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / drafts / draft_n_r / draft-newman-url-imap-05.txt < prev    next >
Text File  |  1997-01-29  |  21KB  |  563 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                          C. Newman
  8. Internet Draft: IMAP URL Scheme                                 Innosoft
  9. Document: draft-newman-url-imap-05.txt                      January 1997
  10.  
  11.  
  12.                             IMAP URL Scheme
  13.  
  14.  
  15. Status of this memo
  16.  
  17.      This document is an Internet Draft.  Internet Drafts are working
  18.      documents of the Internet Engineering Task Force (IETF), its Areas,
  19.      and its Working Groups.  Note that other groups may also distribute
  20.      working documents as Internet Drafts.
  21.  
  22.      Internet Drafts are draft documents valid for a maximum of six
  23.      months.  Internet Drafts may be updated, replaced, or obsoleted by
  24.      other documents at any time.  It is not appropriate to use Internet
  25.      Drafts as reference material or to cite them other than as a
  26.      ``working draft'' or ``work in progress``.
  27.  
  28.      To learn the current status of any Internet-Draft, please check the
  29.      1id-abstracts.txt listing contained in the Internet-Drafts Shadow
  30.      Directories on ds.internic.net, nic.nordu.net, ftp.isi.edu, or
  31.      munnari.oz.au.
  32.  
  33.      A revised version of this draft document will be submitted to the
  34.      RFC editor as a Proposed Standard for the Internet Community.
  35.      Discussion and suggestions for improvement are requested.  This
  36.      document will expire six months after publication.  Distribution of
  37.      this draft is unlimited.
  38.  
  39.  
  40.  
  41. 1. Introduction
  42.  
  43.      IMAP [IMAP4] is a rich protocol for accessing remote message
  44.      stores.  It provides an ideal mechanism for accessing public
  45.      mailing list archives as well as private and shared message stores.
  46.      This document defines a URL scheme for referencing objects on an
  47.      IMAP server.
  48.  
  49.  
  50. 2. Conventions used in this document
  51.  
  52.      The key words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", and "MAY"
  53.      in this document are to be interpreted as defined in this section.
  54.  
  55.  
  56.  
  57.  
  58. Newman                                                          [Page 1]
  59.  
  60. Internet Draft              IMAP URL Scheme                 January 1997
  61.  
  62.  
  63.      1. MUST   This word means that the definition is an absolute
  64.         requirement of the specification.
  65.  
  66.      2. MUST NOT   This phrase means that the definition is an absolute
  67.         prohibition of the specification.
  68.  
  69.      3. SHOULD   This word means that there may exist valid reasons in
  70.         particular circumstances to ignore a particular item, but the
  71.         full implications must be understood and carefully weighed
  72.         before choosing a different course.
  73.  
  74.      4. SHOULD NOT   This phrase means that there may exist valid
  75.         reasons in particular circumstances when the particular behavior
  76.         is acceptable or even useful, but the full implications should
  77.         be understood and the case carefully weighed before implementing
  78.         any behavior described with this label.
  79.  
  80.      5. MAY   This word means that an item is truly optional.  One
  81.         vendor may choose to include the item because a particular
  82.         marketplace requires it or because the vendor feels that it
  83.         enhances the product while another vendor may omit the same
  84.         item. An implementation which does not include a particular
  85.         option MUST be prepared to interoperate with another
  86.         implementation which does include the option, though perhaps
  87.         with reduced functionality. In the same vein an implementation
  88.         which does include a particular option MUST be prepared to
  89.         interoperate with another implementation which does not include
  90.         the option (except, of course, for the feature the option
  91.         provides.)
  92.  
  93. 3. IMAP scheme
  94.  
  95.      The IMAP URL scheme is used to designate mailboxes, messages, MIME
  96.      bodies [MIME], and search programs on Internet hosts accessible
  97.      using the IMAP protocol.
  98.  
  99.      The IMAP URL follows the common Internet scheme syntax as defined
  100.      in RFC 1738 [RFC1738].  If :<port> is omitted, the port defaults to
  101.      143.
  102.  
  103.      An IMAP URL takes one of the following forms:
  104.  
  105.          imap://<iserver>/<enc_list_mailbox>;TYPE=<list_type>
  106.          imap://<iserver>/<enc_mailbox>[uidvalidity]?<enc_search_program>
  107.          imap://<iserver>/<enc_mailbox>[uidvalidity]<iuid>[isection]
  108.  
  109.      The first form is used to refer to a list of mailboxes, the second
  110.      form refers to a list of messages, and the final form refers to a
  111.  
  112.  
  113.  
  114. Newman                                                          [Page 2]
  115.  
  116. Internet Draft              IMAP URL Scheme                 January 1997
  117.  
  118.  
  119.      specific message or message part.
  120.  
  121.  
  122. 4. IMAP User Name, Authentication Mechanism and Password
  123.  
  124.      A user name, authentication mechanism and/or password may be
  125.      supplied.  They are used in the "LOGIN" or "AUTHENTICATE" commands
  126.      after making the connection to the IMAP server.  If no user name,
  127.      authentication mechanism or password is supplied, the user name
  128.      "anonymous" is used with the "LOGIN" command and the password is
  129.      supplied as the Internet e-mail address of the end user accessing
  130.      the resource.  If the URL supplies a user name but no password, the
  131.      program interpreting the IMAP URL SHOULD request one from the user
  132.      if necessary.
  133.  
  134.      An authentication mechanism can be expressed by adding
  135.      ";AUTH=<enc_auth_type>" to the end of the user name.  When such an
  136.      <enc_auth_type> is indicated, the client SHOULD request appropriate
  137.      credentials from that mechanism and use the "AUTHENTICATE" command
  138.      instead of the "LOGIN" command.  If no user name is specified, one
  139.      SHOULD be obtained from the mechanism or requested from the user as
  140.      appropriate.
  141.  
  142.      The string ";AUTH=*" indicates that the client SHOULD select an
  143.      appropriate authentication mechanism.  It MAY use any mechanism
  144.      listed in the CAPABILITY command or use an out of band security
  145.      service resulting in a PREAUTH connection.  If no user name is
  146.      specified and no appropriate authentication mechanisms are
  147.      available, the client SHOULD fall back to anonymous login as
  148.      described above.  This allows a URL which grants read-write access
  149.      to authorized users, and read-only anonymous access to other users.
  150.  
  151.      Note that if unsafe or reserved characters such as " " or ";" are
  152.      present in the user name, authentication mechanism or password,
  153.      they MUST be encoded as described in RFC 1738 [RFC1738].
  154.  
  155.  
  156. 5. Lists of mailboxes
  157.  
  158.      An IMAP URL referring to a list of mailboxes has the following
  159.      form:
  160.  
  161.          imap://<iserver>/<enc_list_mailbox>;TYPE=<list_type>
  162.  
  163.      The <list_type> may be either "LIST" or "LSUB", and is case
  164.      insensitive.  The field ";TYPE=<list_type>" MUST be included.
  165.  
  166.      The <enc_list_mailbox> is any argument suitable for the
  167.  
  168.  
  169.  
  170. Newman                                                          [Page 3]
  171.  
  172. Internet Draft              IMAP URL Scheme                 January 1997
  173.  
  174.  
  175.      list_mailbox field of the IMAP [IMAP4] LIST or LSUB commands.  The
  176.      field <enc_list_mailbox> may be omitted, in which case the program
  177.      interpreting the IMAP URL may use "*" or "%" as the
  178.      <enc_list_mailbox>.  The program SHOULD use "%" if it supports a
  179.      hierarchical view, otherwise it SHOULD use "*".
  180.  
  181.      Note that if unsafe or reserved characters such as " " or "%" are
  182.      present in <enc_list_mailbox> they MUST be encoded as described in
  183.      RFC 1738 [RFC1738].  If the character "/" is present in
  184.      enc_list_mailbox, it SHOULD NOT be encoded.
  185.  
  186.  
  187. 6. Lists of messages
  188.  
  189.      An IMAP URL referring to a list of messages has the following form:
  190.  
  191.          imap://<iserver>/<enc_mailbox>[uidvalidity]?<enc_search_program>
  192.  
  193.      The <enc_mailbox> field is used as the argument to the IMAP4
  194.      "SELECT" command.  Note that if unsafe or reserved characters such
  195.      as " ", ";", or "?" are present in <enc_mailbox> they MUST be
  196.      encoded as described in RFC 1738 [RFC1738].  If the character "/"
  197.      is present in enc_mailbox, it SHOULD NOT be encoded.
  198.  
  199.      The [uidvalidity] field is optional.  If it is present, it MUST be
  200.      the argument to the IMAP4 UIDVALIDITY status response at the time
  201.      the URL was created.  This SHOULD be used by the program
  202.      interpreting the IMAP URL to determine if the URL is stale.
  203.  
  204.      The "?<enc_search_program>" field is optional.  If it is not
  205.      present, a list of all messages in the mailbox SHOULD be presented
  206.      by the program interpreting the URL.  If it is present, it SHOULD
  207.      be used as the arguments following an IMAP4 SEARCH command with
  208.      unsafe characters such as " " (which are likely to be present in
  209.      the <enc_search_program>) encoded as described in RFC 1738
  210.      [RFC1738].
  211.  
  212.  
  213. 7. A specific message or message part
  214.  
  215.      An IMAP URL referring to a specific message or message part has the
  216.      following form:
  217.  
  218.          imap://<iserver>/<enc_mailbox>[uidvalidity]<iuid>[isection]
  219.  
  220.      The <enc_mailbox> and [uidvalidity] are as defined above.
  221.  
  222.      If [uidvalidity] is present in this form, it SHOULD be used by the
  223.  
  224.  
  225.  
  226. Newman                                                          [Page 4]
  227.  
  228. Internet Draft              IMAP URL Scheme                 January 1997
  229.  
  230.  
  231.      program interpreting the URL to determine if the URL is stale.
  232.  
  233.      The <uid> refers to an IMAP4 message UID, and SHOULD be used as the
  234.      <set> argument to the IMAP4 "UID FETCH" command.
  235.  
  236.      The [isection] field is optional.  If not present, the URL refers
  237.      to the entire RFC 822 message as returned by the IMAP command "UID
  238.      FETCH <uid> RFC822.PEEK".  If present, the URL refers to the object
  239.      returned by a "UID FETCH <uid> BODY.PEEK[<section>]" command.  The
  240.      type of the object may be determined with a "UID FETCH <uid>
  241.      BODYSTRUCTURE" command and locating the appropriate part in the
  242.      resulting BODYSTRUCTURE.  Note that unsafe characters in
  243.      [isection], such as " " MUST be encoded as described in RFC 1738
  244.      [RFC1738].
  245.  
  246.  
  247. 8. Relative IMAP URLs
  248.  
  249.      Relative IMAP URLs are permitted and are resolved according to the
  250.      rules defined in RFC 1808 [RFC1808] with one exception.  When the
  251.      relative URL includes a "SECTION=" parameter and does not include a
  252.      "UID=" parameter, then the "UID=" parameter is inherited from the
  253.      base URL.  The following observations are also important:
  254.  
  255.      The <iauth> grammar element is considered part of the user name for
  256.      purposes of resolving relative IMAP URLs.  This means that unless a
  257.      new login/server specification is included in the relative URL, the
  258.      authentication mechanism is inherited from a base IMAP URL.
  259.  
  260.      URLs always use "/" as the hierarchy delimiter for the purpose of
  261.      resolving paths in relative URLs.  IMAP4 permits the use of any
  262.      hierarchy delimiter in mailbox names.  For this reason, relative
  263.      mailbox paths will only work if the mailbox uses "/" as the
  264.      hierarchy delimiter.  Relative URLs may be used on mailboxes which
  265.      use other delimiters, but in that case, the entire mailbox name
  266.      MUST be specified in the relative URL or inherited as a whole from
  267.      the base URL.
  268.  
  269.      The base URL for a list of mailboxes or messages which was referred
  270.      to by an IMAP URL is always the referring IMAP URL itself.  The
  271.      base URL for a message or message part which was referred to by an
  272.      IMAP URL may be more complicated to determine.  The program
  273.      interpreting the relative URL will have to check the headers of the
  274.      MIME entity and any enclosing MIME entities in order to locate the
  275.      "Content-Base" and "Content-Location" headers.  These headers are
  276.      used to determine the base URL as defined in [HTTP].  For example,
  277.      if the referring IMAP URL contains a ";SECTION=1.2" parameter, then
  278.      the MIME headers for section 1.2, for section 1, and for the
  279.  
  280.  
  281.  
  282. Newman                                                          [Page 5]
  283.  
  284. Internet Draft              IMAP URL Scheme                 January 1997
  285.  
  286.  
  287.      enclosing message itself SHOULD be checked in that order for
  288.      "Content-Base" or "Content-Location" headers.
  289.  
  290.  
  291. 9. Examples
  292.  
  293.      The following examples demonstrate how an IMAP4 client program
  294.      might translate various IMAP4 URL into a series of IMAP4 commands.
  295.      Commands sent from the client to the server are prefixed with "C:",
  296.      and responses sent from the server to the client are prefixed with
  297.      "S:".
  298.  
  299.      The URL:
  300.  
  301.          <imap://minbari.org/gray-council;UIDVALIDITY=385759045;UID=20>
  302.  
  303.      Results in the following client commands:
  304.  
  305.          <connect to minbari.org, port 143>
  306.          C: A001 LOGIN ANONYMOUS sheridan@babylon5.org
  307.          C: A002 SELECT gray-council
  308.          <client verifies the UIDVALIDITY matches>
  309.          C: A003 UID FETCH 20 RFC822.PEEK
  310.  
  311.      The URL:
  312.  
  313.          <imap://michael@minbari.org/users.*;type=list>
  314.  
  315.      Results in the following client commands:
  316.  
  317.          <client requests password from user>
  318.          <connect to minbari.org, port 143>
  319.          C: A001 LOGIN MICHAEL zipper
  320.          C: A002 LIST "" users.*
  321.  
  322.      The URL:
  323.  
  324.          <imap://;AUTH=KERBEROS_V4@minbari.org/gray-council;uid=20;section=1.2>
  325.  
  326.      Results in the following client commands:
  327.  
  328.          <connect to minbari.org, port 143>
  329.          C: A001 AUTHENTICATE KERBEROS_V4
  330.          <authentication exchange>
  331.          C: A002 SELECT gray-council
  332.          C: A003 UID FETCH 20 BODY.PEEK[1.2]
  333.  
  334.  
  335.  
  336.  
  337.  
  338. Newman                                                          [Page 6]
  339.  
  340. Internet Draft              IMAP URL Scheme                 January 1997
  341.  
  342.  
  343.      If the following relative URL is located in that body part:
  344.  
  345.           <;section=1.4>
  346.  
  347.      This could result in the following client commands:
  348.  
  349.          C: A004 UID FETCH 20 (BODY.PEEK[1.2.MIME]
  350.                  BODY.PEEK[1.MIME]
  351.                  BODY.PEEK[HEADER.FIELDS (Content-Base Content-Location)])
  352.          <Client looks for Content-Base or Content-Location headers in
  353.           result.  If no such headers, then it does the following>
  354.          C: A005 UID FETCH 20 BODY.PEEK[1.4]
  355.  
  356.      The URL:
  357.  
  358.          <imap://;AUTH=*@minbari.org/gray%20council?SUBJECT%20shadows>
  359.  
  360.      Could result in the following:
  361.  
  362.          <connect to minbari.org, port 143>
  363.          C: A001 CAPABILITY
  364.          S: * CAPABILITY IMAP4rev1 AUTH=GSSAPI
  365.          S: A001 OK
  366.          C: A002 AUTHENTICATE GSSAPI
  367.          <authentication exchange>
  368.          S: A002 OK user lennier authenticated
  369.          C: A003 SELECT "gray council"
  370.          ...
  371.          C: A004 SEARCH SUBJECT shadows
  372.          S: * SEARCH 8 10 13 14 15 16
  373.          S: A004 OK SEARCH completed
  374.          C: A005 FETCH 8,10,13:16 ALL
  375.          ...
  376.  
  377.      NOTE: In this final example, the client has implementation dependent
  378.      choices.  The authentication mechanism could be anything, including
  379.      PREAUTH.  And the final FETCH command could fetch more or less
  380.      information about the messages, depending on what it wishes to display
  381.      to the user.
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394. Newman                                                          [Page 7]
  395.  
  396. Internet Draft              IMAP URL Scheme                 January 1997
  397.  
  398.  
  399. 10. ABNF for IMAP URL scheme
  400.  
  401.      This uses ABNF as used in the IMAP specification [IMAP4].
  402.      Terminals from the BNF for URLs [RFC1738] are also used.  Strings
  403.      are not case sensitive.
  404.  
  405.      achar            ::= uchar / "&" / "=" / "~"
  406.                              ; see RFC 1738 for "uchar" definition
  407.  
  408.      bchar            ::= achar / ":" / "@" / "/"
  409.  
  410.      enc_auth_type    ::= 1*achar
  411.                              ; encoded version of [IMAP-AUTH] "auth_type"
  412.  
  413.      enc_list_mailbox ::= 1*bchar
  414.                              ; encoded version of [IMAP4] "list_mailbox"
  415.  
  416.      enc_mailbox      ::= 1*bchar
  417.                              ; encoded version of [IMAP4] "mailbox"
  418.  
  419.      enc_pass         ::= *achar
  420.                              ; encoded version of [IMAP4] "password"
  421.  
  422.      enc_search_program
  423.                       ::= 1*bchar
  424.                              ; encoded version of search_program below
  425.  
  426.      enc_section      ::= 1*bchar
  427.                              ; encoded version of section below
  428.  
  429.      enc_user         ::= *achar
  430.                              ; encoded version of [IMAP4] "userid"
  431.  
  432.      imapurl          ::= "imap://" iserver "/" [ icommand ] [ iauth ]
  433.  
  434.      iauth            ::= ";AUTH=" ( "*" / enc_auth_type )
  435.  
  436.      icommand         ::= imailboxlist / ipath / isearch
  437.  
  438.      imailboxlist     ::= [enc_list_mailbox] [ ";TYPE=" list_type ]
  439.  
  440.      ipath            ::= enc_mailbox [uidvalidity] iuid [isection]
  441.  
  442.      isearch          ::= enc_mailbox [ "?" enc_search_program ] [uidvalidity]
  443.  
  444.      isection         ::= ";SECTION=" enc_section
  445.  
  446.  
  447.  
  448.  
  449.  
  450. Newman                                                          [Page 8]
  451.  
  452. Internet Draft              IMAP URL Scheme                 January 1997
  453.  
  454.  
  455.      iserver          ::= [enc_user [ iauth ] [ ":" enc_pass ] "@"] hostport
  456.                              ; See RFC 1738 for "hostport" definition
  457.  
  458.      iuid             ::= ";UID=" nz_number
  459.                              ; See [IMAP4] for "nz_number" definition
  460.  
  461.      list_type        ::= "LIST" / "LSUB"
  462.  
  463.      search_program   ::= ["CHARSET" SPACE astring SPACE] 1#search_key
  464.                              ; IMAP4 literals may not be used
  465.                              ; See [IMAP4] for "astring" and "search_key"
  466.  
  467.      section          ::= section_text / (nz_number *["." nz_number]
  468.                          ["." (section_text / "MIME")])
  469.                  ; See [IMAP4] for "section_text" and "nz_number"
  470.  
  471.      uidvalidity      ::= ";UIDVALIDITY=" nz_number
  472.                              ; See [IMAP4] for "nz_number" definition
  473.  
  474.  
  475. 11. References
  476.  
  477.      [IMAP4] Crispin, M., "Internet Message Access Protocol - Version
  478.      4rev1", RFC 2060, University of Washington, December 1996.
  479.  
  480.          <ftp://ds.internic.net/rfc/rfc2060.txt>
  481.  
  482.      [IMAP-AUTH] Myers, J., "IMAP4 Authentication Mechanism", RFC 1731,
  483.      Carnegie-Mellon University, December 1994.
  484.  
  485.          <ftp://ds.internic.net/rfc/rfc1731.txt>
  486.  
  487.      [MIME] Freed, N., Borenstein, N., "Multipurpose Internet Mail
  488.      Extensions", RFC 2045, Innosoft, First Virtual, November 1996.
  489.  
  490.         <ftp://ds.internic.net/rfc/rfc2045.txt>
  491.  
  492.      [RFC1738] Berners-Lee, Masinter, McCahill, "Uniform Resource
  493.      Locators (URL)", RFC 1738, CERN, Xerox Coproration, University of
  494.      Minnesota, December 1994.
  495.  
  496.          <ftp://ds.internic.net/rfc/rfc1738.txt>
  497.  
  498.      [RFC1808] Fielding, "Relative Uniform Resource Locators", RFC 1808,
  499.      UC Irvine, June 1995.
  500.  
  501.          <ftp://ds.internic.net/rfc/rfc1808.txt>
  502.  
  503.  
  504.  
  505.  
  506. Newman                                                          [Page 9]
  507.  
  508. Internet Draft              IMAP URL Scheme                 January 1997
  509.  
  510.  
  511.      [HTTP] Fielding, Gettys, Mogul, Frystyk, Berners-Lee, "Hypertext
  512.      Transfer Protocol -- HTTP/1.1", RFC 2068, UC Irvine, DEC, MIT/LCS,
  513.      January 1997.
  514.  
  515.          <ftp://ds.internic.net/rfc/rfc2068.txt>
  516.  
  517.  
  518. 12. Security Considerations
  519.  
  520.      IMAP URLs have the same security considerations as general Internet
  521.      URLs [RFC1738].  Specifically, including passwords in the URL makes
  522.      the password vulnerable to network eavesdroppers both when the URL
  523.      is transmitted and when the "LOGIN" command is sent to the IMAP
  524.      server.  Some web browsers store URLs in history files which may
  525.      expose them further.  For these reasons, passwords SHOULD NOT be in
  526.      the URL.
  527.  
  528.      Security considerations discussed in the IMAP specification [IMAP4]
  529.      are also relevant.
  530.  
  531.      Client authors SHOULD be careful when selecting an authentication
  532.      mechanism if ";AUTH=*" is specified.  Clients SHOULD NOT fall back
  533.      to the "LOGIN" command with a user other than "anonymous".  A
  534.      client which violates this rule is vulnerable to an active attacker
  535.      which spoofs the server and does not declare support for any
  536.      AUTHENTICATE mechanisms.
  537.  
  538.      Many email clients store the plain text password for later use
  539.      after logging into an IMAP server.  Such clients MUST NOT use a
  540.      stored password in response to an IMAP URL without explicit
  541.      permission from the user to supply that password to the specified
  542.      host name.
  543.  
  544.  
  545. 13. Author's Address
  546.  
  547.      Chris Newman
  548.      Innosoft International, Inc.
  549.      1050 East Garvey Ave. South
  550.      West Covina, CA 91790 USA
  551.  
  552.      Email: chris.newman@innosoft.com
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562. Newman                                                         [Page 10]
  563.