📄 rfc2229.txt
字号:
domain = msg-atom *("." msg-atom) Note that, in contrast to [RFC822], spaces and quoted pairs are not allowed in the msg-id. This restriction makes the msg-id much easier for the client to locate and parse but does not significantly decrease any security benefits, since the msg-id may be arbitrarily long (as bounded by the response length limits set forth elsewhere in this document). Note also that the open and close brackets are part of the msg-id and should be included in the string that is used to compute the MD5 checksum. This message id will be used by the client when formulating the authentication string used in the AUTH command. If the client's IP is not allowed to connect, then a code 530 is sent instead: 530 Access denied Transient failure responses are also possible: 420 Server temporarily unavailable 421 Server shutting down at operator requestFaith & Martin Informational [Page 8]RFC 2229 A Dictionary Server Protocol October 1997 For example, response code 420 should be used if the server cannot currently fork a server process (or cannot currently obtain other resources required to proceed with a usable connection), but expects to be able to fork or obtain these resources in the near future. Response code 421 should be used when the server has been shut down at operator request, or when conditions indicate that the ability to service more requests in the near future will be impossible. This may be used to allow a graceful operator-mediated temporary shutdown of a server, or to indicate that a well known server has been permanently removed from service (in which case, the text message might provide more information).3.2. The DEFINE Command DEFINE database word3.2.1. Description This command will look up the specified word in the specified database. All DICT servers MUST implement this command. If the database name is specified with an exclamation point (decimal code 33, "!"), then all of the databases will be searched until a match is found, and all matches in that database will be displayed. If the database name is specified with a star (decimal code 42, "*"), then all of the matches in all available databases will be displayed. In both of these special cases, the databases will be searched in the same order as that printed by the "SHOW DB" command. If the word was not found, then status code 552 is sent. If the word was found, then status code 150 is sent, indicating that one or more definitions follow. For each definition, status code 151 is sent, followed by the textual body of the definition. The first three space-delimited parameters following status code 151 give the word retrieved, the name of the database (which is the same as the first column of the SHOW DB command), and a short description for the database (which is the same as the second column of the SHOW DB command). The short name is suitable for printing as: From name: before the definition is printed. This provides source information for the user.Faith & Martin Informational [Page 9]RFC 2229 A Dictionary Server Protocol October 1997 The textual body of each definition is terminated with a CRLF period CRLF sequence. After all of the definitions have been sent, status code 250 is sent. This command can provide optional timing information (which is server dependent and is not intended to be parsable by the client). This additional information is useful when debugging and tuning the server.3.2.2. Responses 550 Invalid database, use "SHOW DB" for list of databases 552 No match 150 n definitions retrieved - definitions follow 151 word database name - text follows 250 ok (optional timing information here) Response codes 150 and 151 require special parameters as part of their text. The client can use these parameters to display information on the user's terminal. For code 150, parameters 1 indicates the number of definitions retrieved. For code 151, parameter 1 is the word retrieved, parameter 2 is the database name (the first name as shown by "SHOW DB") from which the definition has been retrieved, and parameter 3 is the the short database description (the second column of the "SHOW DB" command).3.3. The MATCH Command MATCH database strategy word3.3.1. Description This command searches an index for the dictionary, and reports words which were found using a particular strategy. Not all strategies are useful for all dictionaries, and some dictionaries may support additional search strategies (e.g., reverse lookup). All DICT servers MUST implement the MATCH command, and MUST support the "exact" and "prefix" strategies. These are easy to implement and are generally the most useful. Other strategies are server dependent. The "exact" strategy matches a word exactly, although different servers may treat non-alphanumeric data differently. We have found that a case-insensitive comparison which ignores non-alphanumericFaith & Martin Informational [Page 10]RFC 2229 A Dictionary Server Protocol October 1997 characters and which folds whitespace is useful for English-language dictionaries. Other comparisons may be more appropriate for other languages or when using extended character sets. The "prefix" strategy is similar to "exact", except that it only compares the first part of the word. Different servers may implement these algorithms differently. The requirement is that strategies with the names "exact" and "prefix" exist so that a simple client can use them. Other strategies that might be considered by a server implementor are matches based on substring, suffix, regular expressions, soundex [KNUTH73], and Levenshtein [PZ85] algorithms. These last two are especially useful for correcting spelling errors. Other useful strategies perform some sort of "reverse" lookup (i.e., by searching definitions to find the word that the query suggests). If the database name is specified with an exclamation point (decimal code 33, "!"), then all of the databases will be searched until a match is found, and all matches in that database will be displayed. If the database name is specified with a star (decimal code 42, "*"), then all of the matches in all available databases will be displayed. In both of these special cases, the databases will be searched in the same order as that printed by the "SHOW DB" command. If the strategy is specified using a period (decimal code 46, "."), then the word will be matched using a server-dependent default strategy, which should be the best strategy available for interactive spell checking. This is usually a derivative of the Levenshtein algorithm [PZ85]. If no matches are found in any of the searched databases, then status code 552 will be returned. Otherwise, status code 152 will be returned followed by a list of matched words, one per line, in the form: database word This makes the responses directly useful in a DEFINE command. The textual body of the match list is terminated with a CRLF period CRLF sequence. Following the list, status code 250 is sent, which may include server-specific timing and statistical information, as discussed in the section on the DEFINE command.Faith & Martin Informational [Page 11]RFC 2229 A Dictionary Server Protocol October 19973.3.2. Responses 550 Invalid database, use "SHOW DB" for list of databases 551 Invalid strategy, use "SHOW STRAT" for a list of strategies 552 No match 152 n matches found - text follows 250 ok (optional timing information here) Response code 152 requires a special parameter as part of its text. Parameter 1 must be the number of matches retrieved.3.4. A Note on Virtual Databases The ability to search all of the provided databases using a single command is given using the special "*" and "!" databases. However, sometimes, a client may want to search over some but not all of the databases that a particular server provides. One alternative is for the client to use the SHOW DB command to obtain a list of databases and descriptions, and then (perhaps with the help of a human), select a subset of these databases for an interactive search. Once this selection has been done once, the results can be saved, for example, in a client configuration file. Another alternative is for the server to provide "virtual" databases which merge several of the regular databases into one. For example, a virtual database may be provided which includes all of the translating dictionaries, but which does not include regular dictionaries or thesauri. The special "*" and "!" databases can be considered as names of virtual databases which provide access to all of the databases. If a server implements virtual databases, then the special "*" and "!" databases should probably exclude other virtual databases (since they merely provide information duplicated in other databases). If virtual databases are supported, they should be listed as a regular database with the SHOW DB command (although, since "*" and "!" are required, they need not be listed). Virtual databases are an implementation-specific detail which has absolutely no impact on the DICT protocol. The DICT protocol views virtual and non-virtual databases the same way. We mention virtual databases here, however, because they solve a problem of database selection which could also have been solved by changes in the protocol. For example, each dictionary could be assigned attributes, and the protocol could be extended to specify searches over databases with certain attributes. However, this needlessly complicates the parsing and analysis that must be performed by the implementation. Further, unless the classificationFaith & Martin Informational [Page 12]RFC 2229 A Dictionary Server Protocol October 1997 system is extremely general, there is a risk that it would restrict the types of databases that can be used with the DICT protocol (although the protocol has been designed with human-language databases in mind, it is applicable to any read-only database application, especially those with a single semi-unique alphanumeric key and textual data).3.5. The SHOW Command3.5.1. SHOW DB SHOW DB SHOW DATABASES3.5.1.1. Description Displays the list of currently accessible databases, one per line, in the form: database description The textual body of the database list is terminated with a CRLF period CRLF sequence. All DICT servers MUST implement this command. Note that some databases may be restricted due to client domain or lack of user authentication (see the AUTH and SASLAUTH commands in sections 3.11 and 3.12). Information about these databases is not available until authentication is performed. Until that time, the client will interact with the server as if the additional databases did not exist.3.5.1.2. Responses 110 n databases present - text follows 554 No databases present Response code 110 requires a special parameter. Parameter 1 must be the number of databases available to the user.3.5.2. SHOW STRAT SHOW STRAT SHOW STRATEGIESFaith & Martin Informational [Page 13]RFC 2229 A Dictionary Server Protocol October 19973.5.2.1. Description Displays the list of currently supported search strategies, one per line, in the form: strategy description The textual body of the strategy list is terminated with a CRLF period CRLF sequence. All DICT servers MUST implement this command.3.5.2.2. Responses 111 n strategies available - text follows 555 No strategies available Response code 111 requires a special parameter. Parameter 1 must be the number of strategies available.3.5.3. SHOW INFO SHOW INFO database3.5.3.1. Description Displays the source, copyright, and licensing information about the specified database. The information is free-form text and is suitable for display to the user in the same manner as a definition. The textual body of the information is terminated with a CRLF period CRLF sequence. All DICT servers MUST implement this command.3.5.3.2. Responses 550 Invalid database, use "SHOW DB" for list of databases 112 database information follows These response codes require no special parameters.3.5.4. SHOW SERVER SHOW SERVER3.5.4.1. Description Displays local server information written by the local administrator. This could include information about local databases or strategies, or administrative information such as who to contact for access to databases requiring authentication. All DICT servers MUST implement this command.Faith & Martin Informational [Page 14]RFC 2229 A Dictionary Server Protocol October 19973.5.4.2. Responses 114 server information follows This response code requires no special parameters.3.6. The CLIENT Command CLIENT text3.6.1. Description This command allows the client to provide information about itself for possible logging and statistical purposes. All clients SHOULD send this command after connecting to the server. All DICT servers MUST implement this command (note, though, that the server doesn't have to do anything with the information provided by the client).3.6.2. Responses 250 ok (optional timing information here) This response code requires no special parameters.3.7. The STATUS Command STATUS3.7.1. Description Display some server-specific timing or debugging information. This information may be useful in debugging or tuning a DICT server. All DICT servers MUST implement this command (note, though, that the text part of the response is not specified and may be omitted).3.7.2. Responses 210 (optional timing and statistical information here) This response code requires no special parameters.3.8. The HELP Command HELPFaith & Martin Informational [Page 15]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -