RFC 2389
Feature negotiation mechanism for the File Transfer Protocol
RFC 2389 π Feature negotiation mechanism for the File Transfer Protocol
- Network Working Group π
- Author: P. Hethmon, Hethmon Brothers β¨
- Author: R. Elz, University of Melbourne β¨
- Category: Standards Track π¦
- Date: August 1998 πΈ
- See Also: 959 (nothing is listed under obsoletes or updates in this title block) π§
Status of this Memo πΈ
okay so this doc is an Internet standards track protocol for the whole Internet community, and it's literally asking everyone for discussion and suggestions for improvements π«Ά. For the standardization state and status of this protocol, go check the current edition of "Internet Official Protocol Standards" (STD 1). Distribution of this memo is unlimited, so share away π .
Abstract π¦
The File Transfer Protocol keeps getting new commands and facilities over time π. You can't just assume every FTP implementation has rushed to build every newly defined mechanism, because that's not how life works π. So this document gives FTP clients a way to figure out which new features a particular FTP server supports β¨.
Table of Contents π§
Abstract ................................................ 1
1 Introduction ............................................ 2
2 Document Conventions .................................... 2
2.1 Basic Tokens ............................................ 3
2.2 Server Replies .......................................... 3
3 Knowledge of Extra Capabilities - the FEAT Command ...... 3
3.1 Feature (FEAT) Command Syntax ........................... 4
3.2 FEAT Command Responses .................................. 4
3.3 Rationale for FEAT ...................................... 6
4 The OPTS Command ........................................ 6
5 Security Considerations ................................. 7
6 References .............................................. 8
Acknowledgements ........................................ 8
Editors' Addresses ...................................... 8
Full Copyright Statement ................................ 9
1. Introduction β¨
okay bestie, this doc amends the File Transfer Protocol (FTP) [1] π. Two new commands get added: "FEAT" and "OPTS" π.
These commands let a client find out which optional commands a server supports and how they're supported π. They also let the client pick between the various options that any FTP command might support π.
2. Document Conventions π
This document uses the document conventions from BCP14 [2] π«Ά. That's what tells you how to read capitalized words like MUST, SHOULD, etc. π₯
Terms defined in [1] mean the same thing here that they meant there π. That includes ASCII, reply, server-FTP process, user-FTP process, server-PI, user-PI, and user β¨.
The syntax is written in Augmented BNF, as defined in [3] π§. A few general ABNF definitions are needed all through the document, and those get defined right here πΈ. On your first read, it's smart to just remember that these definitions exist and then skip ahead to the next section π.
2.1. Basic Tokens π
This document pulls in the definitions from Appendix A of [3] π¦. You'll find basic ABNF elements like ALPHA, DIGIT, VCHAR, SP, etc. in there π. On top of that, this doc adds the following term for its own use π .
TCHAR = VCHAR / SP / HTAB ; visible plus white space
TCHAR and VCHAR from [3] are the basic character types, pulled from different subsets of ASCII, that show up in commands and responses π.
error-response = error-code SP *TCHAR CRLF
error-code = ("4" / "5") 2DIGIT
In ABNF, string literals are case insensitive, and this doc keeps that convention π«Ά. But heads up, ALPHA is case sensitive, and so are VCHAR and TCHAR π.
2.2. Server Replies π¦
Section 4.2 of [1] explains the format and meaning of replies the server-PI sends back to the user-PI's FTP commands β¨. This doc uses those reply conventions exactly as they are π . Implementors should know that the ABNF in this doc, and in other FTP-related docs, sometimes shows replies in the one-line format π§. Unless it's explicitly said otherwise, that doesn't mean multi-line responses aren't allowed πΈ. So implementors should assume that any reply to any FTP command (including QUIT) may come in the multiline format described in [1] π.
Throughout this doc, a reply gets identified by the three-digit code at the start of it π. So when you see "500 Reply," it means a reply from the server-PI using the three-digit code "500" π₯.
3. Knowledge of Extra Capabilities - the FEAT Command π
Real talk, not every server is going to support every new command from every future FTP update π. So clients need a way to check which new commands a server supports without just guessing and trying each one π. That's why this doc adds one new command to the FTP repertoire β¨. It asks the server to list all of its extension commands, or extended mechanisms π. Every defined and specified command or feature that isn't already defined in [1] or in this doc must show up in the FEAT output, in the form given by the document that defines that extension π.
User-FTP PIs must expect to see unknown features listed in FEAT responses π«Ά. That's not an error π . It just means the server-FTP implementor has seen and implemented a new feature the user-FTP doesn't know about yet π¦.
3.1. Feature (FEAT) Command Syntax π
feat = "Feat" CRLF
The FEAT command is just the word "FEAT" and nothing else π . It takes no parameters or arguments π§.
3.2. FEAT Command Responses π
If a server-FTP process doesn't support the FEAT command, it's going to reply with a 500 or 502 reply π. That's just the normal "unrecognized command" reply any unknown command gets πΈ. Mistakes in the command syntax, like passing parameters, get a 501 reply instead π₯.
A server-FTP process that recognizes FEAT but doesn't implement any extended features, so it has nothing to report, SHOULD respond with the "no-features" 211 reply π. But honestly, that looks basically the same as a server that doesn't recognize FEAT at all, so a 500 or 502 reply MAY also be used π. The "no-features" reply MUST NOT use the multi-line response format. Exactly one response line is required and permitted π.
Replies to the FEAT command MUST follow the syntax below π. The first line of the reply is free-form text. It doesn't get interpreted, and it's not useful for anything, because it isn't expected to be shown to end users π. The syntax of the other reply lines is defined precisely, and if they're present, they MUST be exactly as specified β¨.
feat-response = error-response / no-features / feature-listing
no-features = "211" SP *TCHAR CRLF
feature-listing = "211-" *TCHAR CRLF
1*( SP feature CRLF )
"211 End" CRLF
feature = feature-label [ SP feature-parms ]
feature-label = 1*VCHAR
feature-parms = 1*TCHAR
Be careful with this one: each feature line in the feature-listing starts with a single space π«Ά. That space isn't optional, and it doesn't mean general whitespace π¦. Its whole job is to make sure a feature line can never get mistaken for the end of the listing β¨. It's required even in cases where there's no chance of confusion π .
Every extension a server supports has to be on its own line π§. That way, the parameters each extension command supports can be included too π. The feature-label used in a FEAT response gets specified when each new feature is added to the FTP command set πΈ. It's often the name of a newly added command, but that's not required π. Actually, a new feature doesn't even have to add a new command π. Any parameters get specified together with the definition of the command they belong to, and that definition also has to say how those parameters are interpreted π₯.
The feature-label and feature-parms are nominally case sensitive π. But the definitions of specific labels and parameters spell out the exact interpretation, and those definitions will usually write labels and parameters in a case-independent way π. When that's the case, implementations are recommended to use upper case letters when sending the feature response π .
The FEAT command itself doesn't show up in the list of supported features π . Instead, a server shows that it supports FEAT by sending back any reply other than a 500 or 502 reply β¨.
Here's a typical example of a multiline FEAT reply π§:
C> feat
S> 211-Extensions supported:
S> MLST size*;create;modify*;perm;media-type
S> SIZE
S> COMPRESSION
S> MDTM
S> 211 END
The extensions in this example are just examples of what other documents might define π¦. Don't read any particular meaning into them π. Also remember that the feature names returned aren't command names as such πΈ. They're just signs that the server has some attribute or other π.
The order of the returned features doesn't matter π«Ά. Server-FTP processes aren't required to use any particular order, and they don't even have to return the same order every time the command is repeated π.
Here's the important part π: FTP implementations that support FEAT MUST include, in the response to the FEAT command, every properly documented FTP extension beyond the commands and mechanisms described in RFC959 [1] π₯. That includes any extensions that existed before FEAT did π. So when a client gets a FEAT response from an FTP server, it can assume that the only extensions the server supports are the ones listed in that response π .
User-FTP processes should still be aware that several FTP extensions were developed and widely used before this document and the FEAT command were adopted π§. Because of that, an error response to FEAT doesn't necessarily mean the server-FTP process doesn't support those extensions π. If FEAT gets an error response, user-PIs should test for those extensions one at a time π.
3.3. Rationale for FEAT πΈ
FEAT isn't strictly necessary, but a standard way for the server-PI to tell the user-PI about its features and extensions still helps cut down on unnecessary traffic between the two π. More extensions are likely to show up in the future, so this matters more over time π. Without any mechanism like this, a user-FTP process would have to try each extension in turn, which means a whole series of exchanges between the user-PI and server-PI π. That can be wasteful, and it may not even always be possible π«Ά. Issuing a command just to find out whether it's supported can have some effect you don't want π.
4. The OPTS Command β¨
okay so the OPTS (options) command lets the user-PI tell the server-FTP process how it wants another FTP command (the target command) to behave, before that target command shows up π. What the options look like and how they work depends on which target command you're setting them for, and each command's own definition spells that out. If a command has no OPTS behavior defined, then it just has no options. Simple as that π
Request Syntax:
opts = opts-cmd SP command-name
[ SP command-options ] CRLF
opts-cmd = "opts"
command-name = <any FTP command which allows option setting>
command-options = <format specified by individual FTP command>
Response Syntax:
opts-response = opts-good / opts-bad
opts-good = "200" SP response-message CRLF
opts-bad = "451" SP response-message CRLF /
"501" SP response-message CRLF
response-message = *TCHAR
Okay, the replies are where it gets fun π¦ A 200 reply (opts-good) MUST be sent when the command-name in the OPTS command is recognized, AND the command-options (if there are any) are recognized and appropriate. If that's not the case, the server sends an opts-bad response instead.
A 501 reply is the one for permanent errors. That means any situation where just trying again later, without anything else changing, would give you the same error. A 451 reply is for a temporary hiccup on the server's side that has nothing to do with the state of the communication between user and server. It stops the command from being accepted right now, but if you try again later, the server's environment might have changed enough for it to work πΈ
And if the OPTS command itself isn't recognized, you'll get a 500 or 502 reply, of course π
Now the iconic bit π The OPTS command MUST be implemented whenever the FEAT command is implemented. Because of that, the list of features FEAT returns doesn't say anything about OPTS being supported, since it's already guaranteed. Neither FEAT nor OPTS has any optional functionality, so there's no "OPTS FEAT" or "OPTS OPTS" command. Don't even try, periodt π
5. Security Considerations π
no cap, this extension doesn't seem to create any significant new security issues that aren't already in the FTP protocol π«Ά BUT it does give users a way to figure out what an FTP server is capable of, and extra info might be deducible from that. The same basic info could be gathered by probing the server for various commands, but if FEAT weren't around, that probing could show up in the server's logs as attempts to access extension commands, which could reveal the attacker. This possibility isn't considered a serious enough threat to justify any remedial action, so we're chilling on that one π
The security of any additional features that FEAT might report, and that OPTS might manipulate, should be addressed where those features are defined π§
6. References π
- [1] Postel, J. and J. Reynolds, "File Transfer Protocol (FTP)", STD 9, RFC 959, October 1985.
- [2] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
- [3] Crocker, D. and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", RFC 2234, November 1997.
Acknowledgements π
this protocol extension was built in the FTPEXT Working Group of the IETF, and every member of that group gets credit as its creators π«Άβ¨
Editors' Addresses π
Paul Hethmon
Hethmon Brothers
2305 Chukar Road
Knoxville, TN 37923 USA
Phone: +1 423 690 8990
Email: phethmon@hethmon.com
Robert Elz
University of Melbourne
Department of Computer Science
Parkville, Vic 3052
Australia
Email: kre@munnari.OZ.AU
Full Copyright Statement βοΈ
Copyright (C) The Internet Society (1998). All Rights Reserved.
This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English.
The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns.
This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. π
π¦ where this page comes from
- ietf: rfc2389 1998-08
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms