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-04.txt < prev    next >
Text File  |  1996-12-17  |  18KB  |  505 lines

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