INTERNET-DRAFT M. Yevstifeyev Intended Status: Standards Track May 27, 2011 Updates: 959, 1738 (if approved) Expires: November 28, 2011 The 'ftp' URI Scheme draft-yevstifeyev-ftp-uri-scheme-01 Abstract This document specifies the 'ftp' Uniform Resource Identifier (URI) scheme, that is used to refer to resources accessible via File Transfer Protocol (FTP). It updates RFC 959 and RFC 1738. Status of this Memo This Internet-Draft is submitted to IETF in full conformance with the provisions of BCP 78 and BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet-Drafts. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." The list of current Internet-Drafts can be accessed at http://www.ietf.org/1id-abstracts.html The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html Copyright and License Notice Copyright (c) 2011 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must Yevstifeyev Expires November 28, 2011 [Page 1] INTERNET DRAFT The 'ftp' URI Scheme May 27, 2011 include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License. Table of Contents 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1 Terminology . . . . . . . . . . . . . . . . . . . . . . . . 3 2. URI Scheme Specification . . . . . . . . . . . . . . . . . . . 3 2.1. URI Scheme Syntax . . . . . . . . . . . . . . . . . . . . . 3 2.2. URI Scheme Semantics . . . . . . . . . . . . . . . . . . . 4 2.2.1. The Part . . . . . . . . . . . . . . . . . 4 2.2.2. The Part . . . . . . . . . . . . . . . . . 5 2.2.3. The Part . . . . . . . . . . . . . . . . . . 5 2.2.3.1. A Note on Part . . . . . . . . . . 7 2.2.4. Errors Handling . . . . . . . . . . . . . . . . . . . . 7 2.2.4.1. Handling 4xx Errors . . . . . . . . . . . . . . . . 7 2.2.4.2. Handling 5xx Errors . . . . . . . . . . . . . . . . 7 2.2.4.3. Handling 6xx Errors . . . . . . . . . . . . . . . . 8 2.3. Encoding Considerations . . . . . . . . . . . . . . . . . . 8 3. Security Considerations . . . . . . . . . . . . . . . . . . . 8 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 8 5. References . . . . . . . . . . . . . . . . . . . . . . . . . . 9 5.1. Normative References . . . . . . . . . . . . . . . . . . . 9 5.2. Informative References . . . . . . . . . . . . . . . . . . 10 Appendix A. List of Changes since RFC 1738 . . . . . . . . . . . 11 Appendix B. Acknowledgments . . . . . . . . . . . . . . . . . . . 11 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 12 1 Introduction File Transfer Protocol (FTP) is a standard network protocol used to copy a file from one host to another over a TCP-based network. It has had a very long history; the protocol is rooted in the early 1970s, the times of ARPANET, with the first specification being RFC 114 [RFC0114]; the most current FTP specification is RFC 959 [RFC0959]. (Also visit Section 4 of RFC 1123 [RFC1123] for "narrative" description of FTP.) Historically, there has been a Uniform Resource Identifier (URI) scheme for referencing resources accessible via FTP - 'ftp' URI scheme. The first mention of it appears in RFC 1630 [RFC1630] - pre- Standard Track RFC on URIs. Later, RFC 1738 [RFC1738], Section 3.2 specified this scheme on IETF Standards Track. Subsequently, RFC 1738 was formally obsoleted by RFC 4248 [RFC4248] and RFC 4266 [RFC4266]; in fact RFC 2396 [RFC2396] and its successor - RFC 3986 Yevstifeyev Expires November 28, 2011 [Page 2] INTERNET DRAFT The 'ftp' URI Scheme May 27, 2011 [RFC3986] - replaced and deprecated it (formally they both updated RFC 1738). Currently, almost all of URI schemes specified in RFC 1738 have been given a separate specification; one of the rare exceptions is the 'ftp' URI scheme. This document removes this uncertainty; it gives the 'ftp' URI scheme an official, Standard Track documentation. It updates RFC 959 [RFC0959] and RFC 1738 [RFC1738]. Please note that this document does not attempt to make radical changes to the existing 'ftp' URI scheme specification (even though they are considered necessary), but rather address various major and minor issues in it as well as copies its definition from obsoleted RFC 1738 to allow it to remain on Standard Track. Generic URI syntax is described in RFC 3986 [RFC3986]; registration procedures for new URI schemes - in RFC 4395 [RFC4395]. 1.1 Terminology The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119]. 2. URI Scheme Specification 2.1. URI Scheme Syntax The 'ftp' URI takes the form of rule below, specified using Augmented Backus-Naur Form (ABNF) [RFC5234]: ftp-uri = "ftp:" ftp-hier-part ftp-hier-part = "//" [ user-pass "@" ] host-port [ ftp-path ] user-pass = user [ ":" pass ] user = *usp-char pass = *usp-char usp-char = *( unreserved / pct-encoded / sub-delims ) host-port = host [ ":" port ] ftp-path = path-abempty [ typecode-part ] typecode-part = ";typecode=" typecode typecode = "a" / "i" / "d" where the , , , , and rules are defined in RFC 3986 [RFC3986], Appendix A. Section 2.2.3 of this document gives the another ABNF definition, which is, though, compatible with the aforementioned. Yevstifeyev Expires November 28, 2011 [Page 3] INTERNET DRAFT The 'ftp' URI Scheme May 27, 2011 The semantics of each part are defined below, in Section 2.2. 2.2. URI Scheme Semantics The 'ftp' URI specifies either a FTP server for establishing a connection (when is omitted) or a resource on such FTP server (when is present). The application resolving the 'ftp' URI SHALL follow the following algorithm: o Request the password, if not supplied in the URI (per Section 2.1.1); o Establish the Transmission Control Protocol (TCP) [RFC0793] connection to the resource identified by the on the port identified by the (or 21, if not supplied there); o Authenticate itself to the server, using either the credentials of the URI, those requested from the user or anonymous FTP [RFC1635], if the authentication is requested by it; o Perform a series of commands according to part (see Section 2.2.3), if it is present. 'ftp' URIs may also be used for other operations; for instance, it is possible to update or remove a file on a remote file server. The mechanism for doing so is not specified in this document. Note: The 'ftp' URI scheme supports FTP over TCP only; such derivations as FTP over User Datagram Protocol (UDP) [RFC0768] are not supported by it. Note: The 'ftp' and the 'file' URI are not the same, even though they both may refer to the resource on the local host. More detailed description of each URI's parts' semantics is below. 2.2.1. The Part The part of the 'ftp' URI specifies the user name that will be used for FTP authentication; part - the password. The user name and password SHALL be transmitted using the "USER" and "PASS" FTP commands, respectively, defined in RFC 959 [RFC0959], when requested by the server. The user name and password are delimited by the colon (":") character (ASCII [ASCII] character 0x3A). The part is not intended Yevstifeyev Expires November 28, 2011 [Page 4] INTERNET DRAFT The 'ftp' URI Scheme May 27, 2011 to define information which should be used if the authentication is performed using the AUTH command or other mechanism spelled out in RFC 2228 [RFC2228]; see Section 3 of this document. The part is OPTIONAL in 'ftp' URIs. Thus, if the whole part is omitted, the following "anonymous FTP" convention [RFC1635] SHOULD be used: (1) the user name "anonymous"; and (2) the password that is an e-mail address [RFC5322] of the client is supplied. However, the user may choose to denote authentication credentials by themselves; thus the FTP clients SHALL provide a way to choose whether anonymous FTP will be used. The part in the is OPTIONAL as well. Therefore, if there is a user name but no password supplied in the 'ftp' URI, it SHALL be requested from the user. The and parts of the URI are composed of the characters of ABNF production; any other characters SHALL be percent- encoded, if occur in these parts. The rule includes characters allowed in RFC 3986 production, excluding the colon (":") character, whose use is explicitly specified above. RFC 3986 deprecated the use of "user:pass" pair in the part of URIs. However, for some historical reasons, the benefits of the use of such construction for denoting the user information are valuable enough to overlook this issue. 2.2.2. The Part The part specifies the FTP server the resource identified by a particular 'ftp' URI is located on. If the (in the part) in couple with the preceding colon (":") character is omitted, the port SHALL default to 21, as registered in [IANA-PORTREG]. 2.2.3. The Part The part, which is OPTIONAL, has the following non- normative syntax: //...//;type= Yevstifeyev Expires November 28, 2011 [Page 5] INTERNET DRAFT The 'ftp' URI Scheme May 27, 2011 where ";type=" is OPTIONAL as well. Each of the parts MAY be null, as allowed by RFC 3986 syntax for ABNF production. In the and parts any ";" characters SHALL be escaped by percent-encoding. The part can be described in the ABNF as follows: ftp-path =/ [ ( [ cwd-part ] [ name ] ) ] [ typecode-part ] cwd-part = *( "/" cwd ) cwd = segment name = segment-nz typecode-part = where the and rules are defined in RFC 3986 [RFC3986], Appendix A. The ";" character, even allowed by RFC 3986 is the aforementioned productions, SHALL be escaped by percent encoding. This syntax is compatible with the definition of Section 2.1 and production of RFC 3986, modulo scheme-specific part. The part SHALL be interpreted as follows: (1a) each of parts are consistently supplied as arguments to the CWD (change working directory) FTP command after establishing the FTP connection to the server identified by the part of the URI; (1b) the whole is submitted as an argument to the aforementioned command under the same circumstances; Note: Any null parts, allowed above, MUST NOT cause sending CWD comands, since they might be erroneously interpreted by some FTP servers. Note: The step (1b) below is NOT RECOMMENDED for action by this specification; it is only included for compatibility with some FTP clients. FTP servers SHOULD support both variants and MUST support the (1a) behavior. (2a) if the is equal to "d", the NLST (name list) FTP command (see Section 4.1.3 of RFC 959 [RFC0959]) with as the argument is sent out; (2b) otherwise, the TYPE FTP command (see Section 3.1.1 of RFC 959 [RFC0959]) with the as an argument is performed; Note: If the is absent in the URI, but there is a , the typecode denoted by it concerns the root FTP Yevstifeyev Expires November 28, 2011 [Page 6] INTERNET DRAFT The 'ftp' URI Scheme May 27, 2011 directory on the . (3) access the file identified by the in an appropriate way, eg. using the RETR command. 2.2.3.1. A Note on Part The part has rarely been seen in the wide development. It is not often used in 'ftp' URIs and is included in this specification for historical reasons. Thus, if the is omitted, the client program interpreting the URI SHOULD guess the appropriate mode to use. 2.2.4. Errors Handling During processing the 'ftp' URI, some errors might occur with the server. This section specifies the client's behavior under such circumstances. 2.2.4.1. Handling 4xx Errors If the client receives either 421, 426 or 434 response codes, which stand for "service not available", "connection closed" and "host not available", respectively, it SHALL stop handling the 'ftp' URI, notify the user and take no further actions. If the client receives either 425, 450, 451 or 452 response codes, which stand for "cannot open data connection", "file action not taken", "requested action aborted per local problems" and "file currently unavailable", respectively, upon processing the , it SHALL stop processing the 'ftp' URI, notify the user and retain the most currently accessed directory active to allow them to decide on further actions. If the client receives the 430 response code, which stands for "user name or password invalid" upon processing the part, it SHALL suspend handling the 'ftp' URI, either request another credentials from the user or allow them to use anonymous FTP, proceed not authenticated or terminate the connection. 2.2.4.2. Handling 5xx Errors If the client receives either 501, 502, 503 or 504 response code, which stand for "syntax error", "command not implemented", "bad sequence of commands" and "command not implemented for a particular parameter", respectively, it SHALL stop processing the 'ftp' URI, notify the user and retain the most currently accessed directory active to allow them to decide on further actions. Yevstifeyev Expires November 28, 2011 [Page 7] INTERNET DRAFT The 'ftp' URI Scheme May 27, 2011 If the client receives the 530 response code, which stands for "not logged on", it SHALL suspend handling the 'ftp' URI and first try to authenticate itself using the credentials in it, if they are present. If the credentials are omitted, they SHALL be requested from the user; unless the FTP client is authenticated using them, it SHALL act as specified in Section 2.2.4.1 for the case of 430 response code received. If the client receives either 550, 551, 552 or 553 response codes, which stand for "file unavailable", "requested action aborted", "exceeded storage allocation" and "file name not allowed", respectively, upon processing the , it SHALL stop processing the 'ftp' URI, notify the user and retain the most currently accessed directory active to allow them to decide on further actions. 2.2.4.3. Handling 6xx Errors 6xx errors, introduced by RFC 2228 [RFC2228], are truly believed not to occur during handling the 'ftp' URIs, since they concern mechanism specified in the aforementioned document, whose use cannot be denoted by 'ftp' URI; see Section 3 of this document. 2.3. Encoding Considerations The 'ftp' URIs may contain characters form the Universal Character Set (UCS) [UCS], encoded using UTF-8 character encoding [RFC3629], as suggested by RFC 3986 [RFC3986]. Those octets that do not correspond to the characters in the unreserved set of RFC 3986 SHALL be percent- encoded. In fact, there are no other encoding considerations for 'ftp' URIs not addressed in Section 2 of RFC 3986. Please visit RFC 3536 [RFC3536] for definitions of the terms related to encoding and internalization. 3. Security Considerations Generic security considerations for URIs are discussed in Section 7 of RFC 3986 [RFC3986]. Security considerations for FTP are addressed in RFC 2577 [RFC2577]. RFC 2228 [RFC2228] and RFC 4217 [RFC4217] provided a bunch of ways for securing FTP. However, the 'ftp' URI does not allow to denote whether any of these ways should be used. 4. IANA Considerations Yevstifeyev Expires November 28, 2011 [Page 8] INTERNET DRAFT The 'ftp' URI Scheme May 27, 2011 IANA is asked to update the registration of the 'ftp' URI scheme with the reference to this document using the following template, per RFC 4395 [RFC4395]: o URI scheme name: ftp o Status: Permanent o URI scheme syntax: see Section 2.1 of RFC xxxx o URI scheme semantics: see Section 2.2 of RFC xxxx o URI scheme encoding considerations: see Section 2.3 of RFC xxxx o Protocols that use the scheme: File Transfer Protocol (FTP) [RFC0959] o Security considerations: see Section 3 of RFC xxxx o Contact: IESG o Author/Change controller: IETF o References: see Section 5 of RFC xxxx [RFC Editor: Please replace xxxx with assigned RFC number] 5. References 5.1. Normative References [RFC0793] Postel, J., "Transmission Control Protocol", STD 7, RFC 793, September 1981. [RFC0959] Postel, J. and J. Reynolds, "File Transfer Protocol", STD 9, RFC 959, October 1985. [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 10646", STD 63, RFC 3629, November 2003. [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifier (URI): Generic Syntax", STD 66, RFC 3986, January 2005. Yevstifeyev Expires November 28, 2011 [Page 9] INTERNET DRAFT The 'ftp' URI Scheme May 27, 2011 [RFC5234] Crocker, D., Ed., and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", STD 68, RFC 5234, January 2008. 5.2. Informative References [ASCII] American National Standards Institute (ANSI), "Coded Character Set -- 7-bit American Standard Code for Information Interchange", ANSI X3.4, 1986. [IANA-PORTREG] Internet Assigned Numbers Authority (IANA), "Port Numbers". [RFC0114] Bhushan, A., "File Transfer Protocol", RFC 114, April 1971. [RFC0768] Postel, J., "User Datagram Protocol", STD 6, RFC 768, August 1980. [RFC1123] Braden, R., Ed., "Requirements for Internet Hosts - Application and Support", STD 3, RFC 1123, October 1989. [RFC1630] Berners-Lee, T., "Universal Resource Identifiers in WWW: A Unifying Syntax for the Expression of Names and Addresses of Objects on the Network as used in the World-Wide Web", RFC 1630, June 1994. [RFC1635] Deutsch, P., Emtage, A., and A. Marine, "How to Use Anonymous FTP", FYI 24, RFC 1635, May 1994. [RFC1738] Berners-Lee, T., Masinter, L., and M. McCahill, "Uniform Resource Locators (URL)", RFC 1738, December 1994. [RFC2228] Horowitz, M. and S. Lunt, "FTP Security Extensions", RFC 2228, October 1997. [RFC2396] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifiers (URI): Generic Syntax", RFC 2396, August 1998. [RFC2577] Allman, M. and S. Ostermann, "FTP Security Considerations", RFC 2577, May 1999. [RFC3536] Hoffman, P., "Terminology Used in Internationalization in the IETF", RFC 3536, May 2003. [RFC4217] Ford-Hutchinson, P., "Securing FTP with TLS", RFC 4217, Yevstifeyev Expires November 28, 2011 [Page 10] INTERNET DRAFT The 'ftp' URI Scheme May 27, 2011 October 2005. [RFC4248] Hoffman, P., "The telnet URI Scheme", RFC 4248, October 2005. [RFC4266] Hoffman, P., "The gopher URI Scheme", RFC 4266, November 2005. [RFC4395] Hansen, T., Hardie, T., and L. Masinter, "Guidelines and Registration Procedures for New URI Schemes", BCP 35, RFC 4395, February 2006. [RFC5322] Resnick, P., Ed., "Internet Message Format", RFC 5322, October 2008. [UCS] International Organization for Standardization (ISO), "Information Technology - Universal Multiple-Octet Coded Character Set (UCS)", ISO/IEC Standard 10646, December 2003. Appendix A. List of Changes since RFC 1738 The first specification of the 'ftp' URI is RFC 1738. This appendix lists main changes since that document. Updated syntax specification to use ABNF. Specification changed to suit RFC 3986. Given more detailed description of semantics. Clarified the syntax. Given detailed algorithm of handling . Clarified client's handling null s in . Specified rules for handling errors. Clarified encoding considerations. Various editorial changes/corrections. Added appropriate IANA Considerations section. Appendix B. Acknowledgments The authors of RFC 1738 were Tim Berners-Lee, Larry Masinter and Mark McCahill, who worked on the initial 'ftp' URI scheme definition. Another attempts to specify this URI scheme were undertaken by Paul Hoffman, {who else?}. Considerable input to this document was provided by (in alphabetical order) John Klensin and Daniel Stenberg. Yevstifeyev Expires November 28, 2011 [Page 11] INTERNET DRAFT The 'ftp' URI Scheme May 27, 2011 Authors' Addresses Mykyta Yevstifeyev 8 Kuzovkov St., flat 25 Kotovsk Ukraine EMail: evnikita2@gmail.com Yevstifeyev Expires November 28, 2011 [Page 12]