idnits 2.17.1 draft-ietf-nntpext-base-25.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** It looks like you're using RFC 3978 boilerplate. You should update this to the boilerplate described in the IETF Trust License Policy document (see https://trustee.ietf.org/license-info), which is required now. -- Found old boilerplate from RFC 3978, Section 5.1.a on line 15. -- Found old boilerplate from RFC 3978, Section 5.5 on line 4930. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 4907. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 4914. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 4920. ** The document seems to lack an RFC 3978 Section 5.1 IPR Disclosure Acknowledgement. ** This document has an original RFC 3978 Section 5.4 Copyright Line, instead of the newer IETF Trust Copyright according to RFC 4748. ** This document has an original RFC 3978 Section 5.5 Disclaimer, instead of the newer disclaimer which includes the IETF Trust according to RFC 4748. ** The document uses RFC 3667 boilerplate or RFC 3978-like boilerplate instead of verbatim RFC 3978 boilerplate. After 6 May 2005, submission of drafts without verbatim RFC 3978 boilerplate is not accepted. The following non-3978 patterns matched text found in the document. That text should be removed or replaced: This document is an Internet-Draft and is subject to all provisions of Section 3 of RFC 3667. By submitting this Internet-Draft, each author represents that any applicable patent or other IPR claims of which he or she is aware have been or will be disclosed, and any of which he or she becomes aware will be disclosed, in accordance with Section 6 of BCP 79. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- == No 'Intended status' indicated for this document; assuming Proposed Standard == It seems as if not all pages are separated by form feeds - found 0 form feeds but 113 pages Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The abstract seems to contain references ([RFC2629]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. == There are 52 instances of lines with non-RFC2606-compliant FQDNs in the document. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the RFC 3978 Section 5.4 Copyright Line does not match the current year == Line 227 has weird spacing: '...cal|bar indic...' == Line 1163 has weird spacing: '...abc,def the t...' == Line 2495 has weird spacing: '...dhhmmss serv...' -- The exact meaning of the all-uppercase expression 'MAY NOT' is not defined in RFC 2119. If it is intended as a requirements expression, it should be rewritten using one of the combinations defined in RFC 2119; otherwise it should not be all-uppercase. == The expression 'MAY NOT', while looking like RFC 2119 requirements text, is not defined in RFC 2119, and should not be used. Consider using 'MUST NOT' instead (if that is what you mean). Found 'MAY NOT' in this paragraph: A private extension MAY or MAY NOT be included in the capabilities list. If it is, the capability label MUST begin with "X". A server MAY provide additional keywords - for new commands and also for new variants of existing commands - as part of a private extension. To avoid the risk of a clash with a future registered extension, these keywords SHOULD begin with "X". == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: A mode-switching server has two modes: o Transit mode, which applies after the initial connection: * it MUST advertise the MODE-READER capability; * it MUST NOT advertise the READER capability. However, the server MAY cease to advertise the MODE-READER capability after the client uses any command except CAPABILITIES. o Reading mode, after a successful MODE READER (Section 5.3) command: * it MUST not advertise the MODE-READER capability; * it MUST advertise the READER capability; * it MAY NOT advertise the IHAVE capability even if it was advertising it in transit mode. == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: This command MUST NOT be pipelined. Responses 200 Service available, posting allowed [1] 201 Service available, posting prohibited [1] 400 Service temporarily unavailable [1][2] 502 Service permanently unavailable [1][2] [1] These are the only valid response codes for the initial greeting; the server MUST not return any other generic response code. [2] Following a 400 or 502 response the server MUST immediately close the connection. -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (February 10, 2005) is 7008 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'C' is mentioned on line 4288, but not defined == Missing Reference: 'S' is mentioned on line 4289, but not defined -- Looks like a reference, but probably isn't: '1' on line 3725 -- Looks like a reference, but probably isn't: '2' on line 1194 == Missing Reference: 'GMT' is mentioned on line 2619, but not defined -- Possible downref: Non-RFC (?) normative reference: ref. 'ANSI1986' ** Obsolete normative reference: RFC 2234 (Obsoleted by RFC 4234) ** Obsolete normative reference: RFC 3548 (Obsoleted by RFC 4648) ** Obsolete normative reference: RFC 977 (Obsoleted by RFC 3977) == Outdated reference: A later version (-10) exists of draft-ietf-nntpext-authinfo-06 == Outdated reference: A later version (-06) exists of draft-ietf-nntpext-streaming-03 == Outdated reference: A later version (-09) exists of draft-ietf-nntpext-tls-nntp-04 -- Obsolete informational reference (is this intentional?): RFC 1036 (Obsoleted by RFC 5536, RFC 5537) -- Obsolete informational reference (is this intentional?): RFC 1305 (Obsoleted by RFC 5905) -- Obsolete informational reference (is this intentional?): RFC 1869 (Obsoleted by RFC 2821) -- Obsolete informational reference (is this intentional?): RFC 2616 (Obsoleted by RFC 7230, RFC 7231, RFC 7232, RFC 7233, RFC 7234, RFC 7235) -- Obsolete informational reference (is this intentional?): RFC 2629 (Obsoleted by RFC 7749) -- Obsolete informational reference (is this intentional?): RFC 2822 (Obsoleted by RFC 5322) Summary: 9 errors (**), 0 flaws (~~), 16 warnings (==), 17 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 NNTP C. Feather 2 Internet-Draft Thus plc 3 Expires: August 14, 2005 February 10, 2005 5 Network News Transfer Protocol 6 draft-ietf-nntpext-base-25 8 Status of this Memo 10 This document is an Internet-Draft and is subject to all provisions 11 of Section 3 of RFC 3667. By submitting this Internet-Draft, each 12 author represents that any applicable patent or other IPR claims of 13 which he or she is aware have been or will be disclosed, and any of 14 which he or she become aware will be disclosed, in accordance with 15 RFC 3668. 17 Internet-Drafts are working documents of the Internet Engineering 18 Task Force (IETF), its areas, and its working groups. Note that 19 other groups may also distribute working documents as 20 Internet-Drafts. 22 Internet-Drafts are draft documents valid for a maximum of six months 23 and may be updated, replaced, or obsoleted by other documents at any 24 time. It is inappropriate to use Internet-Drafts as reference 25 material or to cite them other than as "work in progress." 27 The list of current Internet-Drafts can be accessed at 28 http://www.ietf.org/ietf/1id-abstracts.txt. 30 The list of Internet-Draft Shadow Directories can be accessed at 31 http://www.ietf.org/shadow.html. 33 This Internet-Draft will expire on August 14, 2005. 35 Copyright Notice 37 Copyright (C) The Internet Society (2005). 39 Abstract 41 The Network News Transfer Protocol (NNTP) has been in use in the 42 Internet for a decade and remains one of the most popular protocols 43 (by volume) in use today. This document is a replacement for RFC 977 44 and officially updates the protocol specification. It clarifies some 45 vagueness in RFC 977, includes some new base functionality, and 46 provides a specific mechanism to add standardized extensions to NNTP. 48 Administration 50 This document is a product of the NNTP Working Group, chaired by Russ 51 Allbery and Ned Freed. 53 This is draft 25. 55 Author's Note 57 This document is written in XML using an NNTP-specific DTD. Custom 58 software is used to convert this to RFC 2629 [RFC2629] format, and 59 then the public "xml2rfc" package to further reduce this to text, 60 nroff source, and HTML. 62 No perl was used in producing this document. 64 Rights 66 UNIX is a registered trademark of The Open Group. 68 Table of Contents 70 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 6 71 2. Notation . . . . . . . . . . . . . . . . . . . . . . . . . . 7 72 3. Basic Concepts . . . . . . . . . . . . . . . . . . . . . . . 9 73 3.1 Commands and Responses . . . . . . . . . . . . . . . . . 9 74 3.2 Response Codes . . . . . . . . . . . . . . . . . . . . . 11 75 3.2.1 Generic Response Codes . . . . . . . . . . . . . . . 12 76 3.2.1.1 Examples . . . . . . . . . . . . . . . . . . . . 14 77 3.3 Capabilities and Extensions . . . . . . . . . . . . . . 15 78 3.3.1 Capability descriptions . . . . . . . . . . . . . . 16 79 3.3.2 Standard capabilities . . . . . . . . . . . . . . . 16 80 3.3.3 Extensions . . . . . . . . . . . . . . . . . . . . . 18 81 3.3.4 Initial IANA register . . . . . . . . . . . . . . . 19 82 3.4 Mandatory and Optional Commands . . . . . . . . . . . . 20 83 3.4.1 Reading and Transit Servers . . . . . . . . . . . . 21 84 3.4.2 Mode switching . . . . . . . . . . . . . . . . . . . 22 85 3.5 Pipelining . . . . . . . . . . . . . . . . . . . . . . . 23 86 3.5.1 Examples . . . . . . . . . . . . . . . . . . . . . . 24 87 3.6 Articles . . . . . . . . . . . . . . . . . . . . . . . . 24 88 4. The WILDMAT format . . . . . . . . . . . . . . . . . . . . . 26 89 4.1 Wildmat syntax . . . . . . . . . . . . . . . . . . . . . 26 90 4.2 Wildmat semantics . . . . . . . . . . . . . . . . . . . 26 91 4.3 Extensions . . . . . . . . . . . . . . . . . . . . . . . 27 92 4.4 Examples . . . . . . . . . . . . . . . . . . . . . . . . 27 93 5. Session administration commands . . . . . . . . . . . . . . 28 94 5.1 Initial Connection . . . . . . . . . . . . . . . . . . . 28 95 5.2 CAPABILITIES . . . . . . . . . . . . . . . . . . . . . . 29 96 5.3 MODE READER . . . . . . . . . . . . . . . . . . . . . . 31 97 5.4 QUIT . . . . . . . . . . . . . . . . . . . . . . . . . . 33 98 6. Article posting and retrieval . . . . . . . . . . . . . . . 35 99 6.1 Group and article selection . . . . . . . . . . . . . . 35 100 6.1.1 GROUP . . . . . . . . . . . . . . . . . . . . . . . 35 101 6.1.2 LISTGROUP . . . . . . . . . . . . . . . . . . . . . 38 102 6.1.3 LAST . . . . . . . . . . . . . . . . . . . . . . . . 39 103 6.1.4 NEXT . . . . . . . . . . . . . . . . . . . . . . . . 40 104 6.2 Retrieval of articles and article sections . . . . . . . 42 105 6.2.1 ARTICLE . . . . . . . . . . . . . . . . . . . . . . 42 106 6.2.2 HEAD . . . . . . . . . . . . . . . . . . . . . . . . 45 107 6.2.3 BODY . . . . . . . . . . . . . . . . . . . . . . . . 47 108 6.2.4 STAT . . . . . . . . . . . . . . . . . . . . . . . . 48 109 6.3 Article posting . . . . . . . . . . . . . . . . . . . . 51 110 6.3.1 POST . . . . . . . . . . . . . . . . . . . . . . . . 51 111 6.3.2 IHAVE . . . . . . . . . . . . . . . . . . . . . . . 53 112 7. Information commands . . . . . . . . . . . . . . . . . . . . 56 113 7.1 DATE . . . . . . . . . . . . . . . . . . . . . . . . . . 56 114 7.2 HELP . . . . . . . . . . . . . . . . . . . . . . . . . . 56 115 7.3 NEWGROUPS . . . . . . . . . . . . . . . . . . . . . . . 57 116 7.4 NEWNEWS . . . . . . . . . . . . . . . . . . . . . . . . 58 117 7.5 Time . . . . . . . . . . . . . . . . . . . . . . . . . . 59 118 7.5.1 Examples . . . . . . . . . . . . . . . . . . . . . . 60 119 7.6 The LIST commands . . . . . . . . . . . . . . . . . . . 60 120 7.6.1 LIST . . . . . . . . . . . . . . . . . . . . . . . . 61 121 7.6.2 Standard LIST keywords . . . . . . . . . . . . . . . 63 122 7.6.3 LIST ACTIVE . . . . . . . . . . . . . . . . . . . . 63 123 7.6.4 LIST ACTIVE.TIMES . . . . . . . . . . . . . . . . . 65 124 7.6.5 LIST DISTRIB.PATS . . . . . . . . . . . . . . . . . 66 125 7.6.6 LIST NEWSGROUPS . . . . . . . . . . . . . . . . . . 66 126 8. Article field access commands . . . . . . . . . . . . . . . 68 127 8.1 Article metadata . . . . . . . . . . . . . . . . . . . . 68 128 8.1.1 The :bytes metadata item . . . . . . . . . . . . . . 68 129 8.1.2 The :lines metadata item . . . . . . . . . . . . . . 69 130 8.2 Database consistency . . . . . . . . . . . . . . . . . . 69 131 8.3 OVER . . . . . . . . . . . . . . . . . . . . . . . . . . 70 132 8.4 LIST OVERVIEW.FMT . . . . . . . . . . . . . . . . . . . 74 133 8.5 HDR . . . . . . . . . . . . . . . . . . . . . . . . . . 75 134 8.6 LIST HEADERS . . . . . . . . . . . . . . . . . . . . . . 79 135 9. Augmented BNF Syntax for NNTP . . . . . . . . . . . . . . . 83 136 9.1 Commands . . . . . . . . . . . . . . . . . . . . . . . . 83 137 9.2 Command continuation . . . . . . . . . . . . . . . . . . 85 138 9.3 Responses . . . . . . . . . . . . . . . . . . . . . . . 85 139 9.3.1 Generic responses . . . . . . . . . . . . . . . . . 85 140 9.3.2 Initial response line contents . . . . . . . . . . . 86 141 9.3.3 Multi-line response contents . . . . . . . . . . . . 87 142 9.4 Capability lines . . . . . . . . . . . . . . . . . . . . 88 143 9.5 LIST variants . . . . . . . . . . . . . . . . . . . . . 88 144 9.6 Articles . . . . . . . . . . . . . . . . . . . . . . . . 89 145 9.7 General non-terminals . . . . . . . . . . . . . . . . . 90 146 9.8 Extensions and Validation . . . . . . . . . . . . . . . 91 147 10. IANA Considerations . . . . . . . . . . . . . . . . . . . 93 148 11. Security Considerations . . . . . . . . . . . . . . . . . 94 149 11.1 Personal and Proprietary Information . . . . . . . . . . 94 150 11.2 Abuse of Server Log Information . . . . . . . . . . . . 94 151 11.3 Weak Authentication and Access Control . . . . . . . . . 94 152 11.4 DNS Spoofing . . . . . . . . . . . . . . . . . . . . . . 95 153 11.5 UTF-8 issues . . . . . . . . . . . . . . . . . . . . . . 95 154 11.6 Caching of capability lists . . . . . . . . . . . . . . 96 155 12. Acknowledgements . . . . . . . . . . . . . . . . . . . . . 98 156 13. References . . . . . . . . . . . . . . . . . . . . . . . . 100 157 13.1 Normative References . . . . . . . . . . . . . . . . . . 100 158 13.2 Informative References . . . . . . . . . . . . . . . . . 100 159 Author's Address . . . . . . . . . . . . . . . . . . . . . . 101 160 A. Interaction with other specifications . . . . . . . . . . . 102 161 A.1 Header folding . . . . . . . . . . . . . . . . . . . . . 102 162 A.2 Message-IDs . . . . . . . . . . . . . . . . . . . . . . 102 163 A.3 Article posting . . . . . . . . . . . . . . . . . . . . 103 165 B. Summary of Commands . . . . . . . . . . . . . . . . . . . . 105 166 C. Summary of Response Codes . . . . . . . . . . . . . . . . . 108 167 Intellectual Property and Copyright Statements . . . . . . . 112 169 1. Introduction 171 This document specifies the Network News Transfer Protocol (NNTP), 172 which is used for the distribution, inquiry, retrieval, and posting 173 of Netnews articles using a reliable stream-based mechanism. For 174 news reading clients, NNTP enables retrieval of news articles that 175 are stored in a central database, giving subscribers the ability to 176 select only those articles they wish to read. 178 The Netnews model provides for indexing, cross-referencing, and 179 expiration of aged messages. NNTP is designed for efficient 180 transmission of Netnews articles over a reliable full duplex 181 communication channel. 183 Every attempt is made to ensure that the protocol specification in 184 this document is compatible with the version specified in RFC 977 185 [RFC977]. However, this version does not support the ill-defined 186 SLAVE command and permits four digit years to be specified in the 187 NEWNEWS and NEWGROUPS commands. It changes the default character set 188 to UTF-8 [RFC3629] instead of US-ASCII [ANSI1986] (note that US-ASCII 189 is a subset of UTF-8). It now requires all articles to have a 190 message-id, eliminating the "<0>" placeholder used in RFC 977 in some 191 responses. It also extends the newsgroup name matching capabilities 192 already documented in RFC 977. 194 Generally, new functionality is made available using new commands. A 195 number of such commands (including some commands taken from RFC 2980 196 [RFC2980]) are now mandatory. Part of the new functionality involves 197 a mechanism to discover what new functionality is available to 198 clients from a server. This mechanism can also be used to add more 199 functionality as needs merit such additions. 201 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 202 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 203 document are to be interpreted as described in RFC 2119 [RFC2119]. 205 An implementation is not compliant if it fails to satisfy one or more 206 of the MUST requirements for this protocol. An implementation that 207 satisfies all the MUST and all the SHOULD requirements for its 208 protocols is said to be "unconditionally compliant"; one that 209 satisfies all the MUST requirements but not all the SHOULD 210 requirements for NNTP is said to be "conditionally compliant". 212 For the remainder of this document, the term "client" or "client 213 host" refers to a host making use of the NNTP service, while the term 214 "server" or "server host" refers to a host that offers the NNTP 215 service. 217 2. Notation 219 The following notational conventions are used in this document. 221 UPPERCASE indicates literal text to be included in the 222 command; 223 lowercase indicates a token described elsewhere; 224 [brackets] indicate that the argument is optional; 225 ellipsis... indicates that the argument may be repeated any 226 number of times (it must occur at least once); 227 vertical|bar indicates a choice of two mutually exclusive 228 arguments (exactly one must be provided). 230 The name "message-id" for a command or response argument indicates 231 that it is the message-id of an article as described in Section 3.6, 232 including the angle brackets. 234 The name "wildmat" for an argument indicates that it is a wildmat as 235 defined in Section 4. If the argument does not meet the requirements 236 of that section (for example, if it does not fit the grammar of 237 Section 4.1) the NNTP server MAY place some interpretation on it (not 238 specified by this document) or otherwise MUST treat it as a syntax 239 error. 241 Responses for each command will be described in tables listing the 242 required format of a response followed by the meaning that should be 243 ascribed to that response. 245 The terms "NUL", "TAB", "LF", "CR, and "space" refer to the octets 246 %x00, %x09, %x0A, %x0D, and %x20 respectively (that is, the octets 247 with those codes in US-ASCII [ANSI1986] and thus UTF-8 [RFC3629]). 248 The term "CRLF" or "CRLF pair" means the sequence CR immediately 249 followed by LF (that is, %x0D.0A). A "printable US-ASCII character" 250 is an octet in the range %x21-7E. Quoted characters refer to the 251 octets with those codes in US-ASCII (so "." and "<" refer to %x2E and 252 %x3C) and will always be printable US-ASCII characters; similarly, 253 "digit" refers to the octets %x30-39. 255 A "keyword" MUST consist only of US-ASCII letters, digits, and the 256 characters dot (".") and dash ("-"), and must begin with a letter. 257 Keywords MUST be at least three characters and MUST NOT exceed 12 258 characters. 260 Examples in this document are not normative but serve to illustrate 261 usages, arguments, and responses. In the examples, a "[C]" will be 262 used to represent the client host and a "[S]" will be used to 263 represent the server host. Most of the examples do not rely on a 264 particular server state. In some cases, however, they do assume that 265 the current selected newsgroup (see the GROUP command 266 (Section 6.1.1)) is invalid; when so, this is indicated at the start 267 of the example. Examples may use commands or other keywords not 268 defined in this specification (such as an XENCRYPT command). These 269 will be used to illustrate some point and do not imply that any such 270 command is defined elsewhere or needs to exist in any particular 271 implementation. 273 Terms which might be read as specifying details of a client or server 274 implementation, such as "database", are used simply to ease 275 description. Providing that implementations conform to the protocol 276 and format specifications in this document, no specific technique is 277 mandated. 279 3. Basic Concepts 281 3.1 Commands and Responses 283 NNTP operates over any reliable data stream 8-bit-wide channel. 284 Initially, the server host starts the NNTP service by listening on a 285 TCP port. When a client host wishes to make use of the service, it 286 MUST establish a TCP connection with the server host by connecting to 287 that host on the same port on which the server is listening. When 288 the connection is established, the NNTP server host MUST send a 289 greeting. The client host and server host then exchange commands and 290 responses (respectively) until the connection is closed or aborted. 292 The character set for all NNTP commands is UTF-8 [RFC3629]. Commands 293 in NNTP MUST consist of a keyword, which MAY be followed by one or 294 more arguments. A CRLF pair MUST terminate all commands. Multiple 295 commands MUST NOT be on the same line. Unless otherwise noted 296 elsewhere in this document, arguments SHOULD consist of printable 297 US-ASCII characters. Keywords and arguments MUST be each separated 298 by one or more space or TAB characters. Command lines MUST NOT 299 exceed 512 octets, which includes the terminating CRLF pair. The 300 arguments MUST NOT exceed 497 octets. A server MAY relax these 301 limits for commands defined in an extension. 303 Where this specification permits UTF-8 characters outside the range 304 U+0000 to U+007F, implementations MUST NOT use the Byte Order Mark 305 (U+FEFF, encoding %xEF.BB.BF), and MUST use the Word Joiner (U+2060, 306 encoding %xE2.91.A0) for the meaning Zero Width No-Break Space, in 307 command lines and the initial lines of responses, and SHOULD apply 308 these same principles throughout. 310 The term "character" means a single Unicode code point and 311 implementations are not required to carry out normalisation. Thus 312 U+0084 (A-dieresis) is one character while U+0041 U+0308 (A composed 313 with dieresis) is two; the two need not be treated as equivalent. 315 Commands may have variants, using a second keyword immediately after 316 the first to indicate which variant is required. The only such 317 commands in this specification are LIST and MODE. Note that such 318 variants are sometimes referred to as if they were commands in their 319 own right: "the LIST ACTIVE" command should be read as shorthand for 320 "the ACTIVE variant of the LIST command". 322 Keywords are case-insensitive; the case of keywords for commands MUST 323 be ignored by the server. Command and response arguments are case- 324 or language-specific only when stated, either in this document or in 325 other relevant specifications. 327 Each response MUST start with a three-digit response code that is 328 sufficient to distinguish all responses. Certain valid responses are 329 defined to be multi-line; for all others, the response is contained 330 in a single line. The first or only line of the response MUST NOT 331 exceed 512 octets, which includes the response code and the 332 terminating CRLF pair; an extension MAY specify a greater maximum for 333 commands that it defines, but not for any other command. 335 All multi-line responses MUST adhere to the following format: 336 1. The response consists of a sequence of one or more "lines", each 337 being a stream of octets ending with a CRLF pair. Apart from 338 those line endings, the stream MUST NOT include the octets NUL, 339 LF, or CR. 340 2. The first such line contains the response code as with a single 341 line response. 342 3. If any subsequent line begins with the "termination octet" ("." 343 or %x2E), that line MUST be "byte-stuffed" by pre-pending an 344 additional termination octet to that line of the response. 345 4. The lines of the response MUST be followed by a terminating line 346 consisting of a single termination octet followed by a CRLF pair 347 in the normal way. Thus a multi-line response is always 348 terminated with the five octets CRLF "." CRLF (%x0D.0A.2E.0D.0A). 349 5. When interpreting a multi-line response, the "byte-stuffing" MUST 350 be undone; i.e. the client MUST ensure that, in any line 351 beginning with the termination octet followed by octets other 352 than a CRLF pair, that initial termination octet is disregarded. 353 6. Likewise, the terminating line ("." CRLF or %x2E.0D.0A) MUST NOT 354 be considered part of the multi-line response; i.e. the client 355 MUST ensure that any line beginning with the termination octet 356 followed immediately by a CRLF pair is disregarded; (the first 357 CRLF pair of the terminating CRLF "." CRLF is, of course, part of 358 the last line of the response). 360 Note that texts using an encoding (such as UTF-16 or UTF-32) that may 361 contain the octets NUL, LF, or CR other than a CRLF pair cannot be 362 reliably conveyed in the above format (that is, they violate the MUST 363 requirement above). However, except when stated otherwise, this 364 specification does not require the content to be UTF-8 and therefore 365 it MAY include octets above and below 128 mixed arbitrarily. 367 This document does not place any limit on the length of a subsequent 368 line in a multi-line response. However, the standards that define 369 the format of articles may do so. 371 An NNTP server MAY have an inactivity autologout timer. Such a timer 372 SHOULD be of at least three minutes duration, with the exception that 373 there MAY be a shorter limit on how long the server is willing to 374 wait for the first command from the client. The receipt of any 375 command from the client during the timer interval SHOULD suffice to 376 reset the autologout timer. Similarly, the receipt of any 377 significant amount of data from the client while in the midst of 378 sending a multi-line message to the server (such as during a POST or 379 IHAVE command) SHOULD suffice to reset the autologout timer. When 380 the timer expires, the server SHOULD close the TCP connection without 381 sending any response to the client. 383 3.2 Response Codes 385 Each response MUST begin with a three-digit status indicator. These 386 are status reports from the server and indicate the response to the 387 last command received from the client. 389 The first digit of the response broadly indicates the success, 390 failure, or progress of the previous command: 391 1xx - Informative message. 392 2xx - Command completed OK. 393 3xx - Command OK so far; send the rest of it. 394 4xx - Command was syntactically correct but failed for some 395 reason. 396 5xx - Command unknown, unsupported, unavailable, or syntax error. 398 The next digit in the code indicates the function response category: 399 x0x - Connection, set-up, and miscellaneous messages 400 x1x - Newsgroup selection 401 x2x - Article selection 402 x3x - Distribution functions 403 x4x - Posting 404 x8x - Reserved for authentication and privacy extensions 405 x9x - Reserved for private use (non-standard extensions) 407 Certain responses contain arguments such as numbers and names in 408 addition to the status indicator. In those cases, to simplify 409 interpretation by the client the number and type of such arguments is 410 fixed for each response code, as is whether or not the code 411 introduces a multi-line response. Any extension MUST follow this 412 principle as well. Note that, for historical reasons, the 211 413 response code is an exception to this in that the response may be 414 multi-line or not depending on the command (GROUP or LISTGROUP) that 415 generated it. In all other cases, the client MUST only use the 416 status indicator itself to determine the nature of the response. The 417 exact response codes that can be returned by any given command are 418 detailed in the description of that command. 420 Arguments MUST be separated from the numeric status indicator and 421 from each other by a single space. All numeric arguments MUST be in 422 base 10 (decimal) format, and MAY have leading zeros. String 423 arguments MUST contain at least one character and MUST NOT contain 424 TAB, LF, CR, or space. The server MAY add any text after the 425 response code or last argument as appropriate, and the client MUST 426 NOT make decisions based on this text. Such text MUST be separated 427 from the numeric status indicator or the last argument by at least 428 one space. 430 The server MUST respond to any command with the appropriate generic 431 response (given in Section 3.2.1) if it represents the situation. 432 Otherwise, each recognized command MUST return one of the response 433 codes specifically listed in its description or in an extension. A 434 server MAY provide extensions to this specification, including new 435 commands, new variants or features of existing commands, and other 436 ways of changing the internal state of the server. However, the 437 server MUST NOT produce any other responses to a client that does not 438 invoke any of the additional features. (Therefore a client that 439 restricts itself to this specification will only receive the 440 responses that are listed.) 442 If a client receives an unexpected response, it SHOULD use the first 443 digit of the response to determine the result. For example, an 444 unexpected 2xx should be taken as success and an unexpected 4xx or 445 5xx as failure. 447 Response codes not specified in this document MAY be used for any 448 installation-specific additional commands also not specified. These 449 SHOULD be chosen to fit the pattern of x9x specified above. 451 Neither this document nor any registered extension (see 452 Section 3.3.3) will specify any response codes of the x9x pattern. 453 (Implementers of extensions are accordingly cautioned not to use such 454 responses for extensions that may subsequently be submitted for 455 registration.) 457 3.2.1 Generic Response Codes 459 The server MUST respond to any command with the appropriate one of 460 the following generic responses if it represents the situation. 462 If the command is not recognized, or it is an optional command that 463 is not implemented by the server, the response code 500 MUST be 464 returned. 466 If there is a syntax error in the arguments of a recognized command, 467 including the case where more arguments are provided than the command 468 specifies or the command line is longer than the server accepts, the 469 response code 501 MUST be returned. The line MUST NOT be truncated 470 or split and then interpreted. Note that where a command has 471 variants depending on a second keyword (e.g. LIST ACTIVE and LIST 472 NEWSGROUPS), then 501 MUST be used when the base command is 473 implemented but the requested variant is not, and 500 MUST be used 474 only when the base command itself is not implemented. 476 As a special case, if an argument is required to be a base64-encoded 477 string [RFC3548] (there are no such arguments in this specification, 478 but there may be in extensions) and is not validly encoded, the 479 response code 504 MUST be returned. 481 If the server experiences an internal fault or problem that means it 482 is unable to carry out the command (for example, a necessary file is 483 missing or a necessary service could not be contacted), the response 484 code 403 MUST be returned. If the server recognizes the command but 485 does not provide an optional feature (for example because it does not 486 store the required information), or only handles a subset of 487 legitimate cases (see the HDR command (Section 8.5) for an example), 488 the response code 503 MUST be returned. 490 If the client is not authorized to use the specified facility when 491 the server is in its current state, then the appropriate one of the 492 following response codes MUST be used. 493 502: it is necessary to terminate the connection and start a new one 494 with the appropriate authority before the command can be used. 495 Historically, some mode-switching servers (see Section 3.4.1) have 496 used this response to indicate that this command will become 497 available after the MODE READER (Section 5.3) command is used, but 498 this usage is not conforming to this specification and MUST NOT be 499 used. Note that the server MUST NOT close the TCP connection 500 immediately after a 502 response except at the initial connection 501 (Section 5.1) and with the MODE READER command. 502 480: the client must authenticate itself to the server (that is, 503 provide information as to the identity of the client) before the 504 facility can be used on this connection. This will involve the 505 use of an authentication extension such as [NNTP-AUTH]. 506 483: the client must negotiate appropriate privacy protection on the 507 connection. This will involve the use of a privacy extension such 508 as [NNTP-TLS]. 509 401: the client must change the state of the connection in some other 510 manner. The first argument of the response MUST be the capability 511 label (see Section 5.2) of the facility (usually an extension, 512 which may be a private extension) that provides the necessary 513 mechanism. The server MUST NOT use this response code except as 514 specified by the definition of the capability in question. 516 If the server has to terminate the connection for some reason, it 517 MUST give a 400 response code to the next command and then 518 immediately close the TCP connection. Following a 400 response, 519 clients SHOULD NOT simply reconnect immediately and retry the same 520 actions. Rather, a client SHOULD either use an exponentially 521 increasing delay between retries (e.g. double the waiting time after 522 each 400 response) or present any associated text to the user for 523 them to decide whether and when to retry. 525 The client MUST be prepared to receive any of these responses for any 526 command (except, of course, that the server MUST NOT generate a 500 527 response code for mandatory commands). 529 3.2.1.1 Examples 531 Example of an unknown command: 532 [C] MAIL 533 [S] 500 Unknown command 535 Example of an unsupported command: 536 [C] CAPABILITIES 537 [S] 101 Capability list: 538 [S] VERSION 2 539 [S] READER LISTGROUP 540 [S] LIST ACTIVE NEWSGROUPS 541 [S] . 542 [C] OVER 543 [S] 500 Unknown command 545 Example of an unsupported variant: 546 [C] MODE POSTER 547 [S] 501 Unknown MODE option 549 Example of a syntax error: 550 [C] ARTICLE a.message.id@no.angle.brackets 551 [S] 501 Syntax error 553 Example of an overlong command line: 554 [C] HEAD 53 54 55 555 [S] 501 Too many arguments 557 Example of a bad wildmat: 558 [C] LIST ACTIVE u[ks].* 559 [S] 501 Syntax error 561 Example of a base64-encoding error (the second argument is meant to 562 be base64-encoded): 563 [C] XENCRYPT RSA abcd=efg 564 [S] 504 Base64 encoding error 566 Example of an attempt to access a facility not available to this 567 connection: 568 [C] MODE READER 569 [S] 200 Reader mode, posting permitted 570 [C] IHAVE 571 [S] 500 Permission denied 573 Example of an attempt to access a facility requiring authentication: 574 [C] GROUP secret.group 575 [S] 480 Permission denied 576 followed by a successful attempt following such authentication: 577 [C] XSECRET fred flintstone 578 [S] 290 Password for fred accepted 579 [C] GROUP secret.group 580 [S] 211 5 1 20 secret.group selected 582 Example of an attempt to access a facility requiring privacy: 583 [C] GROUP secret.group 584 [S] 483 Secure connection required 585 [C] XENCRYPT 586 [Client and server negotiate encryption on the link] 587 [S] 283 Encrypted link established 588 [C] GROUP secret.group 589 [S] 211 5 1 20 secret.group selected 591 Example of a need to change mode before using a facility: 592 [C] GROUP binary.group 593 [S] 401 XHOST Not on this virtual host 594 [C] XHOST binary.news.example.org 595 [S] 290 binary.news.example.org virtual host selected 596 [C] GROUP binary.group 597 [S] 211 5 1 77 binary.group selected 599 Example of a temporary failure: 600 [C] GROUP archive.local 601 [S] 403 Archive server temporarily offline 603 Example of the server needing to close down immediately: 604 [C] ARTICLE 123 605 [S] 400 Power supply failed, running on UPS 606 [Server closes connection.] 608 3.3 Capabilities and Extensions 610 Not all NNTP servers provide exactly the same facilities, both 611 because this specification allows variation and because servers may 612 provide extensions. A set of facilities that are related are called 613 a "capability". This specification provides a way to determine what 614 capabilities are available, includes a list of standard capabilities, 615 and includes a mechanism (the extension mechanism) for defining new 616 capabilities. 618 3.3.1 Capability descriptions 620 A client can determine the available capabilities of the server by 621 using the CAPABILITIES command (Section 5.2). This returns a 622 capability list, which is a list of capability lines. Each line 623 describes one available capability. 625 Each capability line consists of one or more tokens, which MUST be 626 separated by one or more space or TAB characters. A token is a 627 string of 1 or more printable UTF-8 characters (that is, either 628 printable US-ASCII characters or any UTF-8 sequence outside the 629 US-ASCII range, but not space or TAB). Unless stated otherwise, 630 tokens are case-insensitive. Each capability line consists of: 631 o The capability label, which is a keyword indicating the 632 capability. A capability label may be defined by this 633 specification or a successor, or may be defined by an extension. 634 o The label is then followed by zero or more tokens, which are 635 arguments of the capability. The form and meaning of these tokens 636 is specific to each capability. 638 The server MUST ensure that the capability list accurately reflects 639 the capabilities (including extensions) currently available. If a 640 capability is only available with the server in a certain state (for 641 example, only after authentication), the list MUST only include the 642 capability label when in that state. Similarly, if only some of the 643 commands in an extension will be available, or if the behaviour of 644 the extension will change in some other manner, according to the 645 state of the server, this MUST be indicated by different arguments in 646 the capability line. 648 Note that a capability line can only begin with a letter. Lines 649 beginning with other characters are reserved for future versions of 650 this specification. In order to inter-work with such versions, 651 clients MUST be prepared to receive lines beginning with other 652 characters and MUST ignore any they do not understand. 654 3.3.2 Standard capabilities 656 The following capabilities are defined by this specification. 658 VERSION 659 This capability MUST be advertised by all servers and MUST be the 660 first capability in the capability list; it indicates the 661 version(s) of NNTP that the server supports. There must be at 662 least one argument; each argument is a decimal number and MUST NOT 663 have a leading zero. Version numbers are assigned only in RFCs 664 which update or replace this specification; servers MUST NOT 665 create their own version numbers. 667 The version number of this specification is 2. 669 IHAVE 670 This capability indicates that the server implements the IHAVE 671 command. 673 READER 674 This capability indicates that the server implements the various 675 commands useful for reading clients. If and only if the LISTGROUP 676 command is implemented, there MUST be a single argument LISTGROUP. 677 If and only if posting is permitted using the POST command, there 678 MUST be a single argument POST. (These arguments may appear in 679 either order.) 681 LIST 682 This capability indicates that the server implements at least one 683 variant of the LIST command. There MUST be one argument for each 684 variant of the LIST command supported by the server, giving the 685 keyword for that variant. 687 HDR 688 This capability indicates that the server implements the header 689 access commands (HDR and LIST HEADERS). 691 OVER 692 This capability indicates that the server implements the overview 693 access commands (OVER and LIST OVERVIEW.FMT). If and only if the 694 server supports the message-id form of the OVER command, there 695 must be a single argument MSGID. 697 IMPLEMENTATION 698 This capability MAY be provided by a server. If so, the arguments 699 SHOULD be used to provide information such as the server software 700 name and version number. The client MUST NOT use this line to 701 determine capabilities of the server. (While servers often 702 provide this information in the initial greeting, clients need to 703 guess whether this is the case; this capability makes it clear 704 what the information is.) 706 MODE-READER 707 This capability indicates that the server is mode-switching 708 (Section 3.4.2) and the MODE READER command needs to be used to 709 enable the READER capability. 711 3.3.3 Extensions 713 Although NNTP is widely and robustly deployed, some parts of the 714 Internet community might wish to extend the NNTP service. It must be 715 emphasized that any extension to NNTP should not be considered 716 lightly. NNTP's strength comes primarily from its simplicity. 717 Experience with many protocols has shown that: 718 Protocols with few options tend towards ubiquity, whilst protocols 719 with many options tend towards obscurity. 720 This means that each and every extension, regardless of its benefits, 721 must be carefully scrutinized with respect to its implementation, 722 deployment, and interoperability costs. In many cases, the cost of 723 extending the NNTP service will likely outweigh the benefit. 725 An extension is a package of associated facilities, often but not 726 always including one or more new commands. Each extension MUST 727 define at least one new capability label (this will often, but need 728 not, be the name of one of these new commands). While any additional 729 capability information can normally be specified using arguments to 730 that label, an extension MAY define more than one capability label. 731 However, this SHOULD be limited to exceptional circumstances. 733 An extension is either a private extension or else its capabilities 734 are included in the IANA registry of capabilities (see Section 3.3.4) 735 and it is defined in an RFC (in which case it is a "registered 736 extension"). Such RFCs either must be on the standards track or must 737 define an IESG-approved experimental protocol. 739 The definition of an extension must include: 740 o a descriptive name for the extension; 741 o the capability label or labels defined by the extension; the 742 capability label of a registered extension MUST NOT begin with 743 "X"; 744 o the syntax, values, and meanings of any arguments for each 745 capability label defined by the extension; 746 o any new NNTP commands associated with the extension - the names of 747 commands associated with registered extensions MUST NOT begin with 748 "X"; 749 o the syntax and possible values of arguments associated with the 750 new NNTP commands; 751 o the response codes and possible values of arguments for the 752 responses of the new NNTP commands; 753 o any new arguments the extension associates with any other 754 pre-existing NNTP commands; 755 o any increase in the maximum length of commands and initial 756 response lines over the value specified in this document; 757 o a specific statement about the effect on pipelining this extension 758 may have (if any); 760 o a specific statement about the circumstances when use of this 761 extension can alter the contents of the capabilities list (other 762 than the new capability labels it defines); 763 o the circumstances under which the extension can cause any 764 pre-existing command to produce a 401, 480, or 483 response; 765 o how the use of MODE READER on a mode-switching server interacts 766 with the extension; 767 o how support for the extension affects the behaviour of a server 768 and NNTP client in any other manner not outlined above; 769 o formal syntax as described in Section 9.8. 771 A private extension MAY or MAY NOT be included in the capabilities 772 list. If it is, the capability label MUST begin with "X". A server 773 MAY provide additional keywords - for new commands and also for new 774 variants of existing commands - as part of a private extension. To 775 avoid the risk of a clash with a future registered extension, these 776 keywords SHOULD begin with "X". 778 If the server advertises a capability defined by a registered 779 extension, it MUST implement the extension so as to fully conform 780 with the specification (for example, it MUST implement all of the 781 commands that the extension describes as mandatory). If it does not 782 implement the extension as specified, it MUST NOT list the extension 783 in the capabilities list under its registered name; in this case it 784 MAY, but SHOULD NOT, provide a private extension (not listed, or 785 listed with a different name) that implements part of the extension 786 or implements the commands of the extension with a different meaning. 788 A server MUST NOT send different response codes to basic NNTP 789 commands documented here or commands documented in registered 790 extensions in response to the availability or use of a private 791 extension. 793 3.3.4 Initial IANA register 795 IANA is requested to maintain a registry of NNTP capability labels. 796 All capability labels in the registry MUST be keywords and MUST NOT 797 begin with X. 799 The initial contents of the registry consists of these entries: 801 +--------------------+-------------------------+--------------------+ 802 | Label | Meaning | Definition | 803 +--------------------+-------------------------+--------------------+ 804 | AUTHINFO | Authentication | [NNTP-AUTH] | 805 | | | | 806 | HDR | Batched header | Section 3.3.2, | 807 | | retrieval | Section 8.5, and | 808 | | | Section 8.6 | 809 | | | | 810 | IHAVE | IHAVE command available | Section 3.3.2 and | 811 | | | Section 6.3.2 | 812 | | | | 813 | IMPLEMENTATION | Server | Section 3.3.2 | 814 | | implementation-specific | | 815 | | information | | 816 | | | | 817 | LIST | LIST command variants | Section 3.3.2 and | 818 | | | Section 7.6.1 | 819 | | | | 820 | MODE-READER | Mode-switching server | Section 3.4.2 | 821 | | and MODE READER command | | 822 | | available | | 823 | | | | 824 | OVER | Overview support | Section 3.3.2, | 825 | | | Section 8.3, and | 826 | | | Section 8.4 | 827 | | | | 828 | READER | Reader commands | Section 3.3.2 | 829 | | available | | 830 | | | | 831 | SASL | Supported SASL | [NNTP-AUTH] | 832 | | mechanisms | | 833 | | | | 834 | STARTTLS | Transport layer | [NNTP-TLS] | 835 | | security | | 836 | | | | 837 | STREAMING | Streaming feeds | [NNTP-STREAM] | 838 | | | | 839 | VERSION | Supported NNTP versions | Section 3.3.2 | 840 +--------------------+-------------------------+--------------------+ 842 3.4 Mandatory and Optional Commands 844 For a number of reasons, not all the commands in this specification 845 are mandatory. However, it is equally undesirable for every command 846 to be optional, since this means that a client will have no idea what 847 facilities are available. Therefore, as a compromise, some of the 848 commands in this specification are mandatory - they must be supported 849 by all servers - while the remainder are not. The latter are then 850 subdivided into groups, each indicated by a single capability label. 851 o If the label is included in the capability list returned by the 852 server, the server MUST support all commands in that group. 853 o If the label is not included, the server MAY support none or some 854 of the commands, but SHOULD NOT support all of them. In general, 855 there will be no way for a client to determine which commands are 856 supported without trying them. 857 The groups have been chosen to provide useful functionality, and 858 therefore server authors are discouraged from implementing only part 859 of a group. 861 The description of each command will either indicate that it is 862 mandatory, or will give, using the term "indicating capability", the 863 capability label indicating whether or not the group including this 864 command is available. 866 Where a server does not implement a command, it MUST always generate 867 a 500 generic response code (or a 501 generic response code in the 868 case of a variant of a command depending on a second keyword where 869 the base command is recognised). Otherwise the command MUST be fully 870 implemented as specified; a server MUST NOT only partially implement 871 any of the commands in this specification. (Client authors should 872 note that some servers, not conforming to this specification, will 873 return a 502 generic response code to some commands that are not 874 implemented.) 876 Note: some commands have cases that require other commands to be used 877 first. If the former command is implemented but the latter is not, 878 the former MUST still generate the relevant specific response code. 879 For example, if ARTICLE (Section 6.2.1) is implemented but GROUP 880 (Section 6.1.1) is not, the correct response to "ARTICLE 1234" 881 remains 412. 883 3.4.1 Reading and Transit Servers 885 NNTP is traditionally used in two different ways. The first use is 886 "reading", where the client fetches articles from a large store 887 maintained by the server for immediate or later presentation to a 888 user, and sends articles created by that user back to the server (an 889 action called "posting") to be stored and distributed to other stores 890 and users. The second use is for the bulk transfer of articles from 891 one store to another. Since the hosts doing this transfer tend to be 892 peers in a network that transmit articles among one another, rather 893 than end-user systems, this process is called "peering" or "transit" 894 (even so, one host is still the client and the other is the server). 896 In practice these two uses are so different that some server 897 implementations are optimised for reading or for transit and, as a 898 result, do not offer the other facility or only offer limited 899 features. Other implementations are more general and offer both. 900 This specification allows for this by grouping the relevant commands 901 accordingly: the IHAVE command is designed for transit, while the 902 commands indicated by the READER capability are designed for reading 903 clients. 905 Except as an effect of the MODE READER (Section 5.3) command on a 906 mode-switching server, once a server advertises either or both of the 907 IHAVE or READER capabilities, it MUST NOT cease to advertise them 908 later in the session. 910 A server MAY provide different modes of behaviour (transit, reader, 911 or a combination) to different client connections and MAY use 912 external information, such as the IP address of the client, to 913 determine which mode to provide to any given connection. 915 The official TCP port for the NNTP service is 119. However, if a 916 host wishes to offer separate servers for transit and reading 917 clients, port 433 SHOULD be used for the transit server and 119 for 918 the reading server. 920 3.4.2 Mode switching 922 An implementation MAY, but SHOULD NOT, provide both transit and 923 reader facilities on the same server but require the client to select 924 which it wishes to use. Such an arrangement is called a 925 "mode-switching" server. 927 A mode-switching server has two modes: 928 o Transit mode, which applies after the initial connection: 929 * it MUST advertise the MODE-READER capability; 930 * it MUST NOT advertise the READER capability. 931 However, the server MAY cease to advertise the MODE-READER 932 capability after the client uses any command except CAPABILITIES. 933 o Reading mode, after a successful MODE READER (Section 5.3) 934 command: 935 * it MUST not advertise the MODE-READER capability; 936 * it MUST advertise the READER capability; 937 * it MAY NOT advertise the IHAVE capability even if it was 938 advertising it in transit mode. 940 A client SHOULD only issue a MODE READER command to a server if it is 941 advertising the MODE-READER capability. If the server does not 942 support CAPABILITIES (and therefore does not conform to this 943 specification), the client MAY use the following heuristic: 944 o if the client wishes to use any "reader" commands, it SHOULD use 945 the MODE READER command immediately after the initial connection; 946 o otherwise it SHOULD NOT use the MODE READER command. 947 In each case it should be prepared for some commands to be 948 unavailable that would have been available if it had made the other 949 choice. 951 3.5 Pipelining 953 NNTP is designed to operate over a reliable bi-directional connection 954 such as TCP. Therefore, if a command does not depend on the response 955 to the previous one, it should not matter if it is sent before that 956 response is received. Doing this is called "pipelining". However, 957 certain server implementations throw away all text received from the 958 client following certain commands before sending their response. If 959 this happens, pipelining will be affected because one or more 960 commands will have been ignored or misinterpreted, and the client 961 will be matching the wrong responses to each command. Since there 962 are significant benefits to pipelining, but also circumstances where 963 it is reasonable or common for servers to behave in the above manner, 964 this document puts certain requirements on both clients and servers. 966 Except where stated otherwise, a client MAY use pipelining. That is, 967 it may send a command before receiving the response for the previous 968 command. The server MUST allow pipelining and MUST NOT throw away 969 any text received after a command. Irrespective of whether or not 970 pipelining is used, the server MUST process commands in the order 971 they are sent. 973 If the specific description of a command says it "MUST NOT be 974 pipelined", that command MUST end any pipeline of commands. That is, 975 the client MUST NOT send any following command until receiving the 976 CRLF at the end of the response from the command. The server MAY 977 ignore any data received after the command and before the CRLF at the 978 end of the response is sent to the client. 980 The initial connection must not be part of a pipeline; that is, the 981 client MUST NOT send any command until receiving the CRLF at the end 982 of the greeting. 984 If the client uses blocking system calls to send commands, it MUST 985 ensure that the amount of text sent in pipelining does not cause a 986 deadlock between transmission and reception. The amount of text 987 involved will depend on window sizes in the transmission layer, and 988 is typically 4k octets for TCP. (Since the server only sends data in 989 response to commands from the client, the converse problem does not 990 occur.) 992 3.5.1 Examples 994 Example of correct use of pipelining: 995 [C] GROUP misc.test 996 [C] STAT 997 [C] NEXT 998 [S] 211 1234 3000234 3002322 misc.test 999 [S] 223 3000234 <45223423@example.com> retrieved 1000 [S] 223 3000237 <668929@example.org> retrieved 1002 Example of incorrect use of pipelining (the MODE READER command may 1003 not be pipelined): 1004 [C] MODE READER 1005 [C] DATE 1006 [C] NEXT 1007 [S] 200 Server ready, posting allowed 1008 [S] 223 3000237 <668929@example.org> retrieved 1009 The DATE command has been thrown away by the server and so there is 1010 no 111 response to match it. 1012 3.6 Articles 1014 NNTP is intended to transfer articles between clients and servers. 1015 For the purposes of this specification, articles are required to 1016 conform to the rules in this section and clients and servers MUST 1017 correctly process any article received from the other that does so. 1018 Note that this requirement applies only to the contents of 1019 communications over NNTP; it does not prevent the client or server 1020 from subsequently rejecting an article for reasons of local policy. 1021 Also see Appendix A for further restrictions on the format of 1022 articles in some uses of NNTP. 1024 An article consists of two parts: the headers and the body. They are 1025 separated by a single empty line, or in other words by two 1026 consecutive CRLF pairs (if there is more than one empty line, the 1027 second and subsequent ones are part of the body). In order to meet 1028 the general requirements of NNTP, an article MUST NOT include the 1029 octet NUL, MUST NOT contain the octets LF and CR other than as part 1030 of a CRLF pair, and MUST end with a CRLF pair. This specification 1031 puts no further restrictions on the body; in particular, it MAY be 1032 empty. 1034 The headers of an article consist of one or more header lines. Each 1035 header line consists of a header name, a colon, a space, the header 1036 content, and a CRLF in that order. The name consists of one or more 1037 printable US-ASCII characters other than colon and, for the purposes 1038 of this specification, is not case-sensitive. There MAY be more than 1039 one header line with the same name. The content MUST NOT contain 1040 CRLF; it MAY be empty. A header may be "folded"; that is, a CRLF 1041 pair may be placed before any TAB or space in the line; there MUST 1042 still be some other octet between any two CRLF pairs in a header 1043 line. (Note that folding means that the header line occupies more 1044 than one line when displayed or transmitted; nevertheless it is still 1045 referred to as "a" header line.) The presence or absence of folding 1046 does not affect the meaning of the header line; that is, the CRLF 1047 pairs introduced by folding are not considered part of the header 1048 content. Header lines SHOULD NOT be folded before the space after 1049 the colon that follows the header name, and SHOULD include at least 1050 one octet other than %x09 or %x20 between CRLF pairs. However, if an 1051 article has been received from elsewhere with one of these, clients 1052 and servers MAY transfer it to the other without re-folding it. 1054 The content of a header SHOULD be in UTF-8. However, if a server 1055 receives an article from elsewhere that uses octets in the range 128 1056 to 255 in some other manner, it MAY pass it to a client without 1057 modification. Therefore clients MUST be prepared to receive such 1058 headers and also data derived from them (e.g. in the responses from 1059 the OVER (Section 8.3) command) and MUST NOT assume that they are 1060 always UTF-8. How the client will then process those headers, 1061 including identifying the encoding used, is outside the scope of this 1062 document. 1064 Each article MUST have a unique message-id; two articles offered by 1065 an NNTP server MUST NOT have the same message-id. For the purposes 1066 of this specification, message-ids are opaque strings that MUST meet 1067 the following requirements: 1068 o A message-id MUST begin with "<" and end with ">", and MUST NOT 1069 contain the latter except at the end. 1070 o A message-id MUST be between 3 and 250 octets in length. 1071 o A message-id MUST NOT contain octets other than printable US-ASCII 1072 characters. 1073 Two message-ids are the same if and only if they consist of the same 1074 sequence of octets. 1076 This specification does not describe how the message-id of an article 1077 is determined. If the server does not have any way to determine a 1078 message-id from the article itself, it MUST synthesize one (this 1079 specification does not require the article to be changed as a 1080 result). See also Appendix A.2. 1082 4. The WILDMAT format 1084 The WILDMAT format described here is based on the version first 1085 developed by Rich Salz [SALZ1992], which in turn was derived from the 1086 format used in the UNIX "find" command to articulate file names. It 1087 was developed to provide a uniform mechanism for matching patterns in 1088 the same manner that the UNIX shell matches filenames. 1090 4.1 Wildmat syntax 1092 A wildmat is described by the following ABNF [RFC2234] syntax, which 1093 is an extract of that in Section 9.7. 1095 wildmat = wildmat-pattern *("," ["!"] wildmat-pattern) 1096 wildmat-pattern = 1*wildmat-item 1097 ; must not begin with "!" if not immediately preceded by "!" 1098 wildmat-item = wildmat-exact / wildmat-wild 1099 wildmat-exact = %x21-29 / %x2B / %x2D-3E / %x40-5A / %x5E-7E / 1100 UTF8-non-ascii ; exclude * , ? [ \ ] 1101 wildmat-wild = "*" / "?" 1103 Note: the characters \ , [ and ] are not allowed in wildmats, while * 1104 and ? are always wildcards. This should not be a problem since these 1105 characters cannot occur in newsgroup names, which is the only current 1106 use of wildmats. Backslash is commonly used to suppress the special 1107 meaning of characters while brackets are used to introduce sets. 1108 However, these usages are not universal and interpretation of these 1109 characters in the context of UTF-8 strings is both potentially 1110 complex and differs from existing practice, so they were omitted from 1111 this specification. A future extension to this specification may 1112 provide semantics for these characters. 1114 4.2 Wildmat semantics 1116 A wildmat is tested against a string, and either matches or does not 1117 match. To do this, each constituent is matched 1118 against the string and the rightmost pattern that matches is 1119 identified. If that is not preceded with "!", the 1120 whole wildmat matches. If it is preceded by "!", or if no 1121 matches, the whole wildmat does not match. 1123 For example, consider the wildmat "a*,!*b,*c*": 1124 the string "aaa" matches because the rightmost match is with "a*" 1125 the string "abb" does not match because the rightmost match is 1126 with "*b" 1127 the string "ccb" matches because the rightmost match is with "*c*" 1128 the string "xxx" does not match because no 1129 matches 1131 A matches a string if the string can be broken into 1132 components, each of which matches the corresponding in 1133 the pattern; the matches must be in the same order, and the whole 1134 string must be used in the match. The pattern is "anchored"; that 1135 is, the first and last characters in the string must match the first 1136 and last item respectively (unless that item is an asterisk matching 1137 zero characters). 1139 A matches the same character (which may be more than 1140 one octet in UTF-8). 1142 "?" matches exactly one character (which may be more than one octet). 1144 "*" matches zero or more characters. It can match an empty string, 1145 but it cannot match a subsequence of a UTF-8 sequence that is not 1146 aligned to the character boundaries. 1148 4.3 Extensions 1150 An NNTP server or extension MAY extend the syntax or semantics of 1151 wildmats provided that all wildmats that meet the requirements of 1152 Section 4.1 have the meaning ascribed to them by Section 4.2. Future 1153 editions of this document may also extend wildmats. 1155 4.4 Examples 1157 In these examples, $ and @ are used to represent the two octets %xC2 1158 and %xA3 respectively; $@ is thus the UTF-8 encoding for the pound 1159 sterling symbol, shown as # in the descriptions. 1161 Wildmat Description of strings that match 1162 abc the one string "abc" 1163 abc,def the two strings "abc" and "def" 1164 $@ the one character string "#" 1165 a* any string that begins with "a" 1166 a*b any string that begins with "a" and ends with "b" 1167 a*,*b any string that begins with "a" or ends with "b" 1168 a*,!*b any string that begins with "a" and does not end with 1169 "b" 1170 a*,!*b,c* any string that begins with "a" and does not end with 1171 "b", and any string that begins with "c" no matter 1172 what it ends with 1173 a*,c*,!*b any string that begins with "a" or "c" and does not 1174 end with "b" 1175 ?a* any string with "a" as its second character 1176 ??a* any string with "a" as its third character 1177 *a? any string with "a" as its penultimate character 1178 *a?? any string with "a" as its antepenultimate character 1180 5. Session administration commands 1182 5.1 Initial Connection 1184 5.1.1 Usage 1186 This command MUST NOT be pipelined. 1187 Responses 1188 200 Service available, posting allowed [1] 1189 201 Service available, posting prohibited [1] 1190 400 Service temporarily unavailable [1][2] 1191 502 Service permanently unavailable [1][2] 1192 [1] These are the only valid response codes for the initial greeting; 1193 the server MUST not return any other generic response code. 1194 [2] Following a 400 or 502 response the server MUST immediately close 1195 the connection. 1197 5.1.2 Description 1199 There is no command presented by the client upon initial connection 1200 to the server. The server MUST present an appropriate response code 1201 as a greeting to the client. This response informs the client 1202 whether service is available and whether the client is permitted to 1203 post. 1205 If the server will accept further commands from the client including 1206 POST, the server MUST present a 200 greeting code. If the server 1207 will accept further commands from the client, but it is not 1208 authorized to post articles using the POST command, the server MUST 1209 present a 201 greeting code. 1211 Otherwise the server MUST present a 400 or 502 greeting code and then 1212 immediately close the connection. 400 SHOULD be used if the issue is 1213 only temporary (for example, because of load) and the client can 1214 expect to be able to connect successfully at some point in the future 1215 without making any changes. 502 MUST be used if the client is not 1216 permitted under any circumstances to interact with the server, and 1217 MAY be used if the server has insufficient information to determine 1218 whether the issue is temporary or permanent. 1220 Note: the distinction between the 200 and 201 response codes has 1221 turned out in practice to be insufficient; for example, some servers 1222 do not allow posting until the client has authenticated, while other 1223 clients assume that a 201 response means that posting will never be 1224 possible even after authentication. Therefore clients SHOULD use the 1225 CAPABILITIES command (Section 5.2) rather than rely on this response. 1227 5.1.3 Examples 1229 Example of a normal connection from an authorized client which then 1230 terminates the session (see Section 5.4): 1231 [Initial TCP connection set-up completed.] 1232 [S] 200 NNTP Service Ready, posting permitted 1233 [C] QUIT 1234 [S] 205 NNTP Service exits normally 1235 [Server closes connection.] 1237 Example of a normal connection from an authorized client that is not 1238 permitted to post; it also immediately terminates the session: 1239 [Initial TCP connection set-up completed.] 1240 [S] 201 NNTP Service Ready, posting prohibited 1241 [C] QUIT 1242 [S] 205 NNTP Service exits normally 1243 [Server closes connection.] 1245 Example of a normal connection from an unauthorized client: 1246 [Initial TCP connection set-up completed.] 1247 [S] 502 NNTP Service permanently unavailable 1248 [Server closes connection.] 1250 Example of a connection from a client where the server is unable to 1251 provide service: 1252 [Initial TCP connection set-up completed.] 1253 [S] 400 NNTP Service temporarily unavailable 1254 [Server closes connection.] 1256 5.2 CAPABILITIES 1258 5.2.1 Usage 1260 This command is mandatory. 1261 Syntax 1262 CAPABILITIES [keyword] 1263 Responses 1264 101 Capability list follows (multiline) 1265 Parameters 1266 keyword = additional feature, see description 1268 5.2.2 Description 1270 The CAPABILITIES command allows a client to determine the 1271 capabilities of the server at any given time. 1273 This command MAY be issued at any time; the server MUST NOT require 1274 it to be issued in order to make use of any capability. The response 1275 generated by this command MAY change during a session because of 1276 other state information (which in turn may be changed by the effects 1277 of other commands or by external events). An NNTP client is only 1278 able to get the current and correct information concerning available 1279 capabilities at any point during a session by issuing a CAPABILITIES 1280 command at that point of that session and processing the response. 1282 The capability list is returned as a multi-line response following 1283 the 101 response code. Each capability is described by a separate 1284 capability line. The server MUST NOT list the same capability twice 1285 in the response, even with different arguments. Except that the 1286 VERSION capability MUST be the first line, the order in which the 1287 capability lines appears is not significant; the server need not even 1288 consistently return the same order. 1290 While some capabilities are likely to be always available or never 1291 available, others - notably extensions - will appear and disappear 1292 depending on server state changes within the session or external 1293 events between sessions. An NNTP client MAY cache the results of 1294 this command, but MUST NOT rely on the correctness of any cached 1295 results, whether from earlier in this session or from a previous 1296 session, MUST cope gracefully with the cached status being out of 1297 date, and SHOULD (if caching results) provide a way to force the 1298 cached information to be refreshed. Furthermore, a client MUST NOT 1299 use cached results in relation to security, privacy, and 1300 authentication extensions. See Section 11.6 for further discussion 1301 of this topic. 1303 The keyword argument is not used by this specification. It is 1304 provided so that extensions or revisions to this specification can 1305 include extra features for this command without requiring the 1306 CAPABILITIES command to be used twice (once to determine if the extra 1307 features are available and a second time to make use of them). If 1308 the server does not recognise the argument (and it is a keyword), it 1309 MUST respond with the 101 response code as if the argument had been 1310 omitted. If an argument is provided that the server does recognise, 1311 it MAY use the 101 response code or MAY use some other response code 1312 (which will be defined in the specification of that feature). If the 1313 argument is not a keyword, the 501 generic response code MUST be 1314 returned. The server MUST NOT generate any other response code to 1315 the CAPABILITIES command. 1317 5.2.3 Examples 1319 Example of a minimal response (a read-only server): 1320 [C] CAPABILITIES 1321 [S] 101 Capability list: 1322 [S] VERSION 2 1324 [S] READER 1325 [S] LIST ACTIVE NEWSGROUPS 1326 [S] . 1328 Example of a response from a server that has a range of facilities 1329 and also describes itself: 1330 [C] CAPABILITIES 1331 [S] 101 Capability list: 1332 [S] VERSION 2 1333 [S] READER 1334 [S] IHAVE 1335 [S] LIST ACTIVE NEWSGROUPS ACTIVE.TIMES OVERVIEW.FMT 1336 [S] IMPLEMENTATION INN 4.2 2004-12-25 1337 [S] OVER MSGID 1338 [S] STREAMING 1339 [S] XSECRET 1340 [S] . 1342 Example of a server that supports more than one version of NNTP: 1343 [C] CAPABILITIES 1344 [S] 101 Capability list: 1345 [S] VERSION 2 3 1346 [S] READER 1347 [S] LIST ACTIVE NEWSGROUPS 1348 [S] . 1350 Example of a client attempting to use a feature of the CAPABILITIES 1351 command that the server does not support: 1352 [C] CAPABILITIES AUTOUPDATE 1353 [S] 101 Capability list: 1354 [S] VERSION 2 1355 [S] READER LISTGROUP 1356 [S] IHAVE 1357 [S] LIST ACTIVE NEWSGROUPS OVERVIEW.FMT HEADERS 1358 [S] OVER MSGID 1359 [S] HDR 1360 [S] . 1362 5.3 MODE READER 1364 5.3.1 Usage 1366 Indicating capability: MODE-READER 1367 This command MUST NOT be pipelined. 1368 Syntax 1369 MODE READER 1371 Responses 1372 200 Posting allowed 1373 201 Posting prohibited 1374 502 Reading service permanently unavailable [1] 1375 [1] Following a 502 response the server MUST immediately close the 1376 connection. 1378 5.3.2 Description 1380 The MODE READER command instructs a mode-switching server to switch 1381 modes, as described in Section 3.4.2. 1383 If the server is mode-switching, it switches from its transit mode to 1384 its reader mode, indicating the fact by changing the capability list 1385 accordingly, and then MUST return a 200 or 201 response with the same 1386 meaning as for the initial greeting (as described in Section 5.1.1); 1387 note that the response need not be the same as the one presented 1388 during the initial greeting. The client MUST NOT issue MODE READER 1389 more than once in a session or after any security or privacy commands 1390 are issued. When the MODE READER command is issued, the server MAY 1391 reset its state to that immediately after the initial connection 1392 before switching mode. 1394 If the server is not mode-switching, then: 1395 o If it advertises the READER capability, it MUST return a 200 or 1396 201 response with the same meaning as for the initial greeting; in 1397 this case the command MUST NOT affect the server state in any way. 1398 o If it does not advertise the READER capability, it MUST return a 1399 502 response and then immediately close the connection. 1401 5.3.3 Examples 1403 Example of use of the MODE READER command on a transit-only server 1404 (which therefore does not providing reading facilities): 1405 [C] CAPABILITIES 1406 [S] 101 Capability list: 1407 [S] VERSION 2 1408 [S] IHAVE 1409 [S] . 1410 [C] MODE READER 1411 [S] 502 Transit service only 1412 [Server closes connection.] 1414 Example of use of the MODE READER command on a server that provides 1415 reading facilities: 1416 [C] CAPABILITIES 1417 [S] 101 Capability list: 1418 [S] VERSION 2 1420 [S] READER LISTGROUP 1421 [S] LIST ACTIVE NEWSGROUPS 1422 [S] . 1423 [C] MODE READER 1424 [S] 200 Reader mode, posting permitted 1425 [C] IHAVE 1426 [S] 500 Permission denied 1427 [C] GROUP misc.test 1428 [S] 211 1234 3000234 3002322 misc.test 1429 Note that in both these situations the client SHOULD NOT use MODE 1430 READER. 1432 Example of use of the MODE READER command on a mode-switching server: 1433 [C] CAPABILITIES 1434 [S] 101 Capability list: 1435 [S] VERSION 2 1436 [S] IHAVE 1437 [S] MODE-READER 1438 [S] . 1439 [C] MODE READER 1440 [S] 200 Reader mode, posting permitted 1441 [C] CAPABILITIES 1442 [S] 101 Capability list: 1443 [S] VERSION 2 1444 [S] READER 1445 [S] LIST ACTIVE NEWSGROUPS 1446 [S] STARTTLS 1447 [S] . 1448 In this case the server offers (but does not require) TLS privacy in 1449 its reading mode but not its transit mode. 1451 Example of use of the MODE READER command where the client is not 1452 permitted to post: 1453 [C] MODE READER 1454 [S] 201 NNTP Service Ready, posting prohibited 1456 5.4 QUIT 1458 5.4.1 Usage 1460 This command is mandatory. 1461 Syntax 1462 QUIT 1463 Responses 1464 205 Connection closing 1466 5.4.2 Description 1468 The client uses the QUIT command to terminate the session. The 1469 server MUST acknowledge the QUIT command and then close the 1470 connection to the client. This is the preferred method for a client 1471 to indicate that it has finished all its transactions with the NNTP 1472 server. 1474 If a client simply disconnects (or the connection times out or some 1475 other fault occurs), the server MUST gracefully cease its attempts to 1476 service the client, disconnecting from its end if necessary. 1478 The server MUST NOT generate any response code to the QUIT command 1479 other than 205 or, if any arguments are provided, 501. 1481 5.4.3 Examples 1483 [C] QUIT 1484 [S] 205 closing connection 1485 [Server closes connection.] 1487 6. Article posting and retrieval 1489 News reading clients have available a variety of mechanisms to 1490 retrieve articles via NNTP. The news articles are stored and indexed 1491 using three types of keys. One key is the message-id of an article. 1492 Another key is composed of the newsgroup name and the article number 1493 within that newsgroup. That key MUST be unique to a particular 1494 server (there will be only one article with that number within a 1495 particular newsgroup), but is not required to be globally unique. 1496 Additionally, because the same article can be cross-posted to 1497 multiple newsgroups, there may be multiple keys that point to the 1498 same article on the same server. The final key is the arrival 1499 timestamp, giving the time that the article arrived at the server. 1501 The server MUST ensure that article numbers are issued in order of 1502 arrival timestamp; that is, articles arriving later MUST have higher 1503 numbers than those that arrive earlier. The server SHOULD allocate 1504 the next sequential unused number to each new article. 1506 Article numbers MUST lie between 1 and 4,294,967,295 inclusive. The 1507 client and server MAY use leading zeroes in specifying article 1508 numbers, but MUST NOT use more than 16 digits. In some situations, 1509 the value zero replaces an article number to show some special 1510 situation. 1512 6.1 Group and article selection 1514 The following commands are used to set the "current selected 1515 newsgroup" and the "current article number", which are used by 1516 various commands. At the start of an NNTP session, both of these 1517 values are set to the special value "invalid". 1519 6.1.1 GROUP 1521 6.1.1.1 Usage 1523 Indicating capability: READER 1524 Syntax 1525 GROUP group 1526 Responses 1527 211 number low high group Group successfully selected 1528 411 No such newsgroup 1529 Parameters 1530 group = name of newsgroup 1531 number = estimated number of articles in the group 1532 low = reported low water mark 1533 high = reported high water mark 1535 6.1.1.2 Description 1537 The required argument is the name of the newsgroup to be selected 1538 (e.g. "news.software.b"). A list of valid newsgroups may be 1539 obtained by using the LIST ACTIVE command (see Section 7.6.3). 1541 The successful selection response will return the article numbers of 1542 the first and last articles in the group at the moment of selection 1543 (these numbers are referred to as the "reported low water mark" and 1544 the "reported high water mark"), and an estimate of the number of 1545 articles in the group currently available. 1547 If the group is not empty, the estimate MUST be at least the actual 1548 number of articles available, and MUST be no greater than one more 1549 than the difference between the reported low and high water marks. 1550 (Some implementations will actually count the number of articles 1551 currently stored. Others will just subtract the low water mark from 1552 the high water mark and add one to get an estimate.) 1554 If the group is empty, one of the following three situations will 1555 occur. Clients MUST accept all three cases; servers MUST NOT 1556 represent an empty group in any other way. 1557 o The high water mark will be one less than the low water mark, and 1558 the estimated article count will be zero. Servers SHOULD use this 1559 method to show an empty group. This is the only time that the 1560 high water mark can be less than the low water mark. 1561 o All three numbers will be zero. 1562 o The high water mark is greater than or equal to the low water 1563 mark. The estimated article count might be zero or non-zero; if 1564 non-zero, the same requirements apply as for a non-empty group. 1566 The set of articles in a group may change after the GROUP command is 1567 carried out. That is: 1568 o articles may be removed from the group 1569 o articles may be reinstated in the group with the same article 1570 number, but those articles MUST have numbers no less than the 1571 reported low water mark (note that this is a reinstatement of the 1572 previous article, not a new article reusing the number) 1573 o new articles may be added with article numbers greater than the 1574 reported high water mark (if an article that was the one with the 1575 highest number has been removed and the high water mark adjusted 1576 accordingly, the next new article will not have the number one 1577 greater than the reported high water mark) 1579 Except when the group is empty and all three numbers are zero, 1580 whenever a subsequent GROUP command for the same newsgroup is issued, 1581 either by the same client or a different client, the reported low 1582 water mark in the response MUST be no less than that in any previous 1583 response for that newsgroup in any session, and SHOULD be no less 1584 than that in any previous response for that newsgroup ever sent to 1585 any client. Any failure to meet the latter condition SHOULD be 1586 transient only. The client may make use of the low water mark to 1587 remove all remembered information about articles with lower numbers, 1588 as these will never recur. This includes the situation when the high 1589 water mark is one less than the low water mark. No similar 1590 assumption can be made about the high water mark, as this can 1591 decrease if an article is removed, and then increase again if it is 1592 reinstated or if new articles arrive. 1594 When a valid group is selected by means of this command, the current 1595 selected newsgroup MUST be set to that group and the current article 1596 number MUST be set to the first article in the group. If an empty 1597 newsgroup is selected, the current article pointer is made invalid. 1598 If an invalid group is specified, the current selected newsgroup and 1599 current article number MUST NOT be changed. 1601 The GROUP or LISTGROUP command (see Section 6.1.2) MUST be used by a 1602 client and a successful response received before any other command is 1603 used that depends on the value of the current selected newsgroup or 1604 current article number. 1606 If the group specified is not available on the server, a 411 response 1607 MUST be returned. 1609 6.1.1.3 Examples 1611 Example for a group known to the server: 1612 [C] GROUP misc.test 1613 [S] 211 1234 3000234 3002322 misc.test 1615 Example for a group unknown to the server: 1616 [C] GROUP example.is.sob.bradner.or.barber 1617 [S] 411 example.is.sob.bradner.or.barber is unknown 1619 Example of an empty group using the preferred response: 1620 [C] GROUP example.currently.empty.newsgroup 1621 [S] 211 0 4000 3999 example.currently.empty.newsgroup 1623 Example of an empty group using an alternative response: 1624 [C] GROUP example.currently.empty.newsgroup 1625 [S] 211 0 0 0 example.currently.empty.newsgroup 1627 Example of an empty group using a different alternative response: 1628 [C] GROUP example.currently.empty.newsgroup 1629 [S] 211 0 4000 4321 example.currently.empty.newsgroup 1631 6.1.2 LISTGROUP 1633 6.1.2.1 Usage 1635 Indicating capability: READER with argument LISTGROUP 1636 Syntax 1637 LISTGROUP [group] 1638 Responses 1639 211 number low high group Article numbers follow (multiline) 1640 411 No such newsgroup 1641 412 No newsgroup selected [1] 1642 Parameters 1643 group = name of newsgroup 1644 number = estimated number of articles in the group 1645 low = reported low water mark 1646 high = reported high water mark 1647 [1] The 412 response can only occur if no group has been specified. 1649 6.1.2.2 Description 1651 The LISTGROUP command is used to get a listing of all the article 1652 numbers in a particular newsgroup. As a side effect, it also selects 1653 the group in the same way as the GROUP command (see Section 6.1.1). 1655 The optional argument is the name of the newsgroup to be selected 1656 (e.g. "news.software.misc"). If no group is specified, the current 1657 selected newsgroup is used. 1659 On success, the list of article numbers is returned as a multi-line 1660 response following the 211 response code (the arguments on the 1661 initial response line are the same as for the GROUP command). The 1662 list contains one number per line, is in numerical order, and lists 1663 precisely those articles that exist in the group at the moment of 1664 selection. 1666 If the group specified is not available on the server, a 411 response 1667 MUST be returned. If no group is specified and the current selected 1668 newsgroup is invalid, a 412 response MUST be returned. 1670 In all other aspects the LISTGROUP command behaves identically to the 1671 GROUP command. 1673 6.1.2.3 Examples 1675 Example of LISTGROUP on an empty group: 1676 [C] LISTGROUP example.empty.newsgroup 1677 [S] 211 0 0 0 example.empty.newsgroup list follows 1678 [S] . 1680 Example of LISTGROUP on a valid current selected newsgroup: 1681 [C] GROUP misc.test 1682 [S] 211 2000 3000234 3002322 misc.test 1683 [C] LISTGROUP 1684 [S] 211 2000 3000234 3002322 misc.test list follows 1685 [S] 3000234 1686 [S] 3000237 1687 [S] 3000238 1688 [S] 3000239 1689 [S] 3002322 1690 [S] . 1692 Example of LISTGROUP failing because no group has been selected: 1693 [Assumes current selected newsgroup is invalid.] 1694 [C] LISTGROUP 1695 [S] 412 no current group 1696 [C] GROUP example.is.sob.bradner.or.barber 1697 [S] 411 no such group 1698 [C] LISTGROUP 1699 [S] 412 no current group 1701 6.1.3 LAST 1703 6.1.3.1 Usage 1705 Indicating capability: READER 1706 Syntax 1707 LAST 1708 Responses 1709 223 n message-id Article found 1710 412 No newsgroup selected 1711 420 Current article number is invalid 1712 422 No previous article in this group 1713 Parameters 1714 n = article number 1715 message-id = article message-id 1717 6.1.3.2 Description 1719 If the current selected newsgroup is valid, the current article 1720 number MUST be set to the previous article in that newsgroup (that 1721 is, the highest existing article number less than the current article 1722 number). If successful, a response indicating the new current 1723 article number and the message-id of that article MUST be returned. 1724 No article text is sent in response to this command. 1726 There MAY be no previous article in the group, although the current 1727 article number is not the reported low water mark. There MUST NOT be 1728 a previous article when the current article number is the reported 1729 low water mark. 1731 Because articles can be removed and added, the results of multiple 1732 LAST and NEXT commands MAY not be consistent over the life of a 1733 particular NNTP session. 1735 If the current article number is already the first article of the 1736 newsgroup, a 422 response MUST be returned. If the current article 1737 number is invalid, a 420 response MUST be returned. If the current 1738 selected newsgroup is invalid, a 412 response MUST be returned. In 1739 all three cases the current selected newsgroup and current article 1740 number MUST NOT be altered. 1742 6.1.3.3 Examples 1744 Example of a successful article retrieval using LAST: 1745 [C] GROUP misc.test 1746 [S] 211 1234 3000234 3002322 misc.test 1747 [C] NEXT 1748 [S] 223 3000237 <668929@example.org> retrieved 1749 [C] LAST 1750 [S] 223 3000234 <45223423@example.com> retrieved 1752 Example of an attempt to retrieve an article without having selected 1753 a group (via the GROUP command) first: 1754 [Assumes current selected newsgroup is invalid.] 1755 [C] LAST 1756 [S] 412 no newsgroup selected 1758 Example of an attempt to retrieve an article using the LAST command 1759 when the current article number is that of the first article in the 1760 group: 1761 [C] GROUP misc.test 1762 [S] 211 1234 3000234 3002322 misc.test 1763 [C] LAST 1764 [S] 422 No previous article to retrieve 1766 Example of an attempt to retrieve an article using the LAST command 1767 when the current selected newsgroup is empty: 1768 [C] GROUP example.empty.newsgroup 1769 [S] 211 0 0 0 example.empty.newsgroup 1770 [C] LAST 1771 [S] 420 No current article selected 1773 6.1.4 NEXT 1774 6.1.4.1 Usage 1776 Indicating capability: READER 1777 Syntax 1778 NEXT 1779 Responses 1780 223 n message-id Article found 1781 412 No newsgroup selected 1782 420 Current article number is invalid 1783 421 No next article in this group 1784 Parameters 1785 n = article number 1786 message-id = article message-id 1788 6.1.4.2 Description 1790 If the current selected newsgroup is valid, the current article 1791 number MUST be set to the next article in that newsgroup (that is, 1792 the lowest existing article number greater than the current article 1793 number). If successful, a response indicating the new current 1794 article number and the message-id of that article MUST be returned. 1795 No article text is sent in response to this command. 1797 If the current article number is already the last article of the 1798 newsgroup, a 421 response MUST be returned. In all other aspects 1799 (apart, of course, from the lack of 422 response) this command is 1800 identical to the LAST command (Section 6.1.3). 1802 6.1.4.3 Examples 1804 Example of a successful article retrieval using NEXT: 1805 [C] GROUP misc.test 1806 [S] 211 1234 3000234 3002322 misc.test 1807 [C] NEXT 1808 [S] 223 3000237 <668929@example.org> retrieved 1810 Example of an attempt to retrieve an article without having selected 1811 a group (via the GROUP command) first: 1812 [Assumes current selected newsgroup is invalid.] 1813 [C] NEXT 1814 [S] 412 no newsgroup selected 1816 Example of an attempt to retrieve an article using the NEXT command 1817 when the current article number is that of the last article in the 1818 group: 1819 [C] GROUP misc.test 1820 [S] 211 1234 3000234 3002322 misc.test 1821 [C] STAT 3002322 1823 [S] 223 3002322 <411@example.net> retrieved 1824 [C] NEXT 1825 [S] 421 No next article to retrieve 1827 Example of an attempt to retrieve an article using the NEXT command 1828 when the current selected newsgroup is empty: 1829 [C] GROUP example.empty.newsgroup 1830 [S] 211 0 0 0 example.empty.newsgroup 1831 [C] NEXT 1832 [S] 420 No current article selected 1834 6.2 Retrieval of articles and article sections 1836 The ARTICLE, BODY, HEAD, and STAT commands are very similar. They 1837 differ only in the parts of the article that are presented to the 1838 client and in the successful response code. The ARTICLE command is 1839 described here in full, while the other commands are described in 1840 terms of the differences. As specified in Section 3.6, an article 1841 consists of two parts: the article headers and the article body. 1842 When responding to one of these commands, the server MUST present the 1843 entire article or appropriate part and MUST NOT attempt to alter or 1844 translate it in any way. 1846 6.2.1 ARTICLE 1848 6.2.1.1 Usage 1850 Indicating capability: READER 1851 Syntax 1852 ARTICLE message-id 1853 ARTICLE number 1854 ARTICLE 1855 Responses 1856 First form (message-id specified) 1857 220 0|n message-id Article follows (multiline) 1858 430 No article with that message-id 1859 Second form (article number specified) 1860 220 n message-id Article follows (multiline) 1861 412 No newsgroup selected 1862 423 No article with that number 1863 Third form (current article number used) 1864 220 n message-id Article follows (multiline) 1865 412 No newsgroup selected 1866 420 Current article number is invalid 1867 Parameters 1868 number = Requested article number 1869 n = Returned article number 1870 message-id = Article message-id 1872 6.2.1.2 Description 1874 The ARTICLE command selects an article based on the arguments and 1875 presents the entire article (that is, the headers, an empty line, and 1876 the body in that order). The command has three forms. 1878 In the first form, a message-id is specified and the server presents 1879 the article with that message-id. In this case, the server MUST NOT 1880 alter the current selected newsgroup or current article number. This 1881 is both to facilitate the presentation of articles that may be 1882 referenced within another article being read, and because of the 1883 semantic difficulties of determining the proper sequence and 1884 membership of an article that may have been cross-posted to more than 1885 one newsgroup. 1887 In the response, the article number MUST be replaced with zero, 1888 except that if there is a current selected group and the article is 1889 present in that group, the server MAY use that article number. (The 1890 server is not required to determine whether the article is in the 1891 current selected newsgroup or, if so, what article number it has; the 1892 client MUST always be prepared for zero to be specified.) The server 1893 MUST NOT provide an article number unless use of that number in a 1894 second ARTICLE command immediately following this one would return 1895 the same article. Even if the server chooses to return article 1896 numbers in these circumstances, it need not do so consistently; it 1897 MAY return zero to any such command (also see the STAT examples 1898 (Section 6.2.4.3)). 1900 In the second form, an article number is specified. If there is an 1901 article with that number in the current selected newsgroup, the 1902 server MUST set the current article number to that number. 1904 In the third form, the article indicated by the current article 1905 number in the current selected newsgroup is used. 1907 Note that a previously valid article number MAY become invalid if the 1908 article has been removed. A previously invalid article number MAY 1909 become valid if the article has been reinstated, but such an article 1910 number MUST be no less than the reported low water mark for that 1911 group. 1913 The server MUST NOT change the current selected newsgroup as a result 1914 of this command. The server MUST NOT change the current article 1915 number except when an article number argument was provided and the 1916 article exists; in particular, it MUST NOT change it following an 1917 unsuccessful response. 1919 Since the message-id is unique for each article, it may be used by a 1920 client to skip duplicate displays of articles that have been posted 1921 more than once, or to more than one newsgroup. 1923 The article is returned as a multi-line response following the 220 1924 response code. 1926 If the argument is a message-id and no such article exists, a 430 1927 response MUST be returned. If the argument is a number or is omitted 1928 and the current selected newsgroup is invalid, a 412 response MUST be 1929 returned. If the argument is a number and that article does not 1930 exist in the current selected newsgroup, a 423 response MUST be 1931 returned. If the argument is omitted and the current article number 1932 is invalid, a 420 response MUST be returned. 1934 6.2.1.3 Examples 1936 Example of a successful retrieval of an article (using no article 1937 number): 1938 [C] GROUP misc.test 1939 [S] 211 1234 3000234 3002322 misc.test 1940 [C] ARTICLE 1941 [S] 220 3000234 <45223423@example.com> 1942 [S] Path: pathost!demo!whitehouse!not-for-mail 1943 [S] From: "Demo User" 1944 [S] Newsgroups: misc.test 1945 [S] Subject: I am just a test article 1946 [S] Date: 6 Oct 1998 04:38:40 -0500 1947 [S] Organization: An Example Net, Uncertain, Texas 1948 [S] Message-ID: <411@example.net> 1949 [S] 1950 [S] This is just a test article. 1951 [S] . 1953 Example of a successful retrieval of an article by message-id: 1954 [C] ARTICLE <45223423@example.com> 1955 [S] 220 0 <45223423@example.com> 1956 [S] Path: pathost!demo!whitehouse!not-for-mail 1957 [S] From: "Demo User" 1958 [S] Newsgroups: misc.test 1959 [S] Subject: I am just a test article 1960 [S] Date: 6 Oct 1998 04:38:40 -0500 1961 [S] Organization: An Example Net, Uncertain, Texas 1962 [S] Message-ID: <411@example.net> 1963 [S] 1964 [S] This is just a test article. 1965 [S] . 1967 Example of an unsuccessful retrieval of an article by message-id: 1969 [C] ARTICLE 1970 [S] 430 No Such Article Found 1972 Example of an unsuccessful retrieval of an article by number: 1973 [C] GROUP misc.test 1974 [S] 211 1234 3000234 3002322 news.groups 1975 [C] ARTICLE 300256 1976 [S] 423 No article with that number 1978 Example of an unsuccessful retrieval of an article by number because 1979 no newsgroup was selected first: 1980 [Assumes current selected newsgroup is invalid.] 1981 [C] ARTICLE 300256 1982 [S] 412 No newsgroup selected 1984 Example of an attempt to retrieve an article when the current 1985 selected newsgroup is empty: 1986 [C] GROUP example.empty.newsgroup 1987 [S] 211 0 0 0 example.empty.newsgroup 1988 [C] ARTICLE 1989 [S] 420 No current article selected 1991 6.2.2 HEAD 1993 6.2.2.1 Usage 1995 This command is mandatory. 1996 Syntax 1997 HEAD message-id 1998 HEAD number 1999 HEAD 2000 Responses 2001 First form (message-id specified) 2002 221 0|n message-id Headers follow (multiline) 2003 430 No article with that message-id 2004 Second form (article number specified) 2005 221 n message-id Headers follow (multiline) 2006 412 No newsgroup selected 2007 423 No article with that number 2008 Third form (current article number used) 2009 221 n message-id Headers follow (multiline) 2010 412 No newsgroup selected 2011 420 Current article number is invalid 2012 Parameters 2013 number = Requested article number 2014 n = Returned article number 2015 message-id = Article message-id 2017 6.2.2.2 Description 2019 The HEAD command behaves identically to the ARTICLE command except 2020 that, if the article exists, the response code is 221 instead of 220 2021 and only the headers are presented (the empty line separating the 2022 headers and body MUST NOT be included). 2024 6.2.2.3 Examples 2026 Example of a successful retrieval of the headers of an article (using 2027 no article number): 2028 [C] GROUP misc.test 2029 [S] 211 1234 3000234 3002322 misc.test 2030 [C] HEAD 2031 [S] 221 3000234 <45223423@example.com> 2032 [S] Path: pathost!demo!whitehouse!not-for-mail 2033 [S] From: "Demo User" 2034 [S] Newsgroups: misc.test 2035 [S] Subject: I am just a test article 2036 [S] Date: 6 Oct 1998 04:38:40 -0500 2037 [S] Organization: An Example Net, Uncertain, Texas 2038 [S] Message-ID: <411@example.net> 2039 [S] . 2041 Example of a successful retrieval of the headers of an article by 2042 message-id: 2043 [C] HEAD <45223423@example.com> 2044 [S] 221 0 <45223423@example.com> 2045 [S] Path: pathost!demo!whitehouse!not-for-mail 2046 [S] From: "Demo User" 2047 [S] Newsgroups: misc.test 2048 [S] Subject: I am just a test article 2049 [S] Date: 6 Oct 1998 04:38:40 -0500 2050 [S] Organization: An Example Net, Uncertain, Texas 2051 [S] Message-ID: <411@example.net> 2052 [S] . 2054 Example of an unsuccessful retrieval of the headers of an article by 2055 message-id: 2056 [C] HEAD 2057 [S] 430 No Such Article Found 2059 Example of an unsuccessful retrieval of the headers of an article by 2060 number: 2061 [C] GROUP misc.test 2062 [S] 211 1234 3000234 3002322 misc.test 2063 [C] HEAD 300256 2064 [S] 423 No article with that number 2066 Example of an unsuccessful retrieval of the headers of an article by 2067 number because no newsgroup was selected first: 2068 [Assumes current selected newsgroup is invalid.] 2069 [C] HEAD 300256 2070 [S] 412 No newsgroup selected 2072 Example of an attempt to retrieve the headers of an article when the 2073 current selected newsgroup is empty: 2074 [C] GROUP example.empty.newsgroup 2075 [S] 211 0 0 0 example.empty.newsgroup 2076 [C] HEAD 2077 [S] 420 No current article selected 2079 6.2.3 BODY 2081 6.2.3.1 Usage 2083 Indicating capability: READER 2084 Syntax 2085 BODY message-id 2086 BODY number 2087 BODY 2088 Responses 2089 First form (message-id specified) 2090 222 0|n message-id Body follows (multiline) 2091 430 No article with that message-id 2092 Second form (article number specified) 2093 222 n message-id Body follows (multiline) 2094 412 No newsgroup selected 2095 423 No article with that number 2096 Third form (current article number used) 2097 222 n message-id Body follows (multiline) 2098 412 No newsgroup selected 2099 420 Current article number is invalid 2100 Parameters 2101 number = Requested article number 2102 n = Returned article number 2103 message-id = Article message-id 2105 6.2.3.2 Description 2107 The BODY command behaves identically to the ARTICLE command except 2108 that, if the article exists, the response code is 222 instead of 220 2109 and only the body is presented (the empty line separating the headers 2110 and body MUST NOT be included). 2112 6.2.3.3 Examples 2114 Example of a successful retrieval of the body of an article (using no 2115 article number): 2116 [C] GROUP misc.test 2117 [S] 211 1234 3000234 3002322 misc.test 2118 [C] BODY 2119 [S] 222 3000234 <45223423@example.com> 2120 [S] This is just a test article. 2121 [S] . 2123 Example of a successful retrieval of the body of an article by 2124 message-id: 2125 [C] BODY <45223423@example.com> 2126 [S] 222 0 <45223423@example.com> 2127 [S] This is just a test article. 2128 [S] . 2130 Example of an unsuccessful retrieval of the body of an article by 2131 message-id: 2132 [C] BODY 2133 [S] 430 No Such Article Found 2135 Example of an unsuccessful retrieval of the body of an article by 2136 number: 2137 [C] GROUP misc.test 2138 [S] 211 1234 3000234 3002322 misc.test 2139 [C] BODY 300256 2140 [S] 423 No article with that number 2142 Example of an unsuccessful retrieval of the body of an article by 2143 number because no newsgroup was selected first: 2144 [Assumes current selected newsgroup is invalid.] 2145 [C] BODY 300256 2146 [S] 412 No newsgroup selected 2148 Example of an attempt to retrieve the body of an article when the 2149 current selected newsgroup is empty: 2150 [C] GROUP example.empty.newsgroup 2151 [S] 211 0 0 0 example.empty.newsgroup 2152 [C] BODY 2153 [S] 420 No current article selected 2155 6.2.4 STAT 2157 6.2.4.1 Usage 2158 This command is mandatory. 2159 Syntax 2160 STAT message-id 2161 STAT number 2162 STAT 2163 Responses 2164 First form (message-id specified) 2165 223 0|n message-id Article exists 2166 430 No article with that message-id 2167 Second form (article number specified) 2168 223 n message-id Article exists 2169 412 No newsgroup selected 2170 423 No article with that number 2171 Third form (current article number used) 2172 223 n message-id Article exists 2173 412 No newsgroup selected 2174 420 Current article number is invalid 2175 Parameters 2176 number = Requested article number 2177 n = Returned article number 2178 message-id = Article message-id 2180 6.2.4.2 Description 2182 The STAT command behaves identically to the ARTICLE command except 2183 that, if the article exists, it is NOT presented to the client and 2184 the response code is 223 instead of 220. Note that the response is 2185 NOT multi-line. 2187 This command allows the client to determine whether an article 2188 exists, and in the second and third forms what its message-id is, 2189 without having to process an arbitrary amount of text. 2191 6.2.4.3 Examples 2193 Example of STAT on an existing article (using no article number): 2194 [C] GROUP misc.test 2195 [S] 211 1234 3000234 3002322 misc.test 2196 [C] STAT 2197 [S] 223 3000234 <45223423@example.com> 2199 Example of STAT on an existing article by message-id: 2200 [C] STAT <45223423@example.com> 2201 [S] 223 0 <45223423@example.com> 2203 Example of STAT on an article not on the server by message-id: 2204 [C] STAT 2205 [S] 430 No Such Article Found 2207 Example of STAT on an article not in the server by number: 2208 [C] GROUP misc.test 2209 [S] 211 1234 3000234 3002322 misc.test 2210 [C] STAT 300256 2211 [S] 423 No article with that number 2213 Example of STAT on an article by number when no newsgroup was 2214 selected first: 2215 [Assumes current selected newsgroup is invalid.] 2216 [C] STAT 300256 2217 [S] 412 No newsgroup selected 2219 Example of STAT on an article when the current selected newsgroup is 2220 empty: 2221 [C] GROUP example.empty.newsgroup 2222 [S] 211 0 0 0 example.empty.newsgroup 2223 [C] STAT 2224 [S] 420 No current article selected 2226 Example of STAT by message-id on a server which sometimes reports the 2227 actual article number: 2228 [C] GROUP misc.test 2229 [S] 211 1234 3000234 3002322 misc.test 2230 [C] STAT 2231 [S] 223 3000234 <45223423@example.com> 2232 [C] STAT <45223423@example.com> 2233 [S] 223 0 <45223423@example.com> 2234 [C] STAT <45223423@example.com> 2235 [S] 223 3000234 <45223423@example.com> 2236 [C] GROUP example.empty.newsgroup 2237 [S] 211 0 0 0 example.empty.newsgroup 2238 [C] STAT <45223423@example.com> 2239 [S] 223 0 <45223423@example.com> 2240 [C] GROUP alt.crossposts 2241 [S] 211 9999 111111 222222 alt.crossposts 2242 [C] STAT <45223423@example.com> 2243 [S] 223 123456 <45223423@example.com> 2244 [C] STAT 2245 [S] 223 111111 <23894720@example.com> 2246 The first STAT command establishes the identity of an article in the 2247 group. The second and third show that the server may, but need not, 2248 give the article number when the message-id is specified. The fourth 2249 STAT command shows that zero must be specified if the article isn't 2250 in the current selected group, the fifth shows that the number, if 2251 provided, must be that relating to the current selected group, and 2252 the last one shows that the current selected article is still not 2253 changed by the use of STAT with a message-id even if it returns an 2254 article number. 2256 6.3 Article posting 2258 Article posting is done in one of two ways: individual article 2259 posting from news reading clients using POST, and article transfer 2260 from other news servers using IHAVE. 2262 6.3.1 POST 2264 6.3.1.1 Usage 2266 Indicating capability: READER with argument POST 2267 This command MUST NOT be pipelined. 2268 Syntax 2269 POST 2270 Responses 2271 Initial responses 2272 340 Send article to be posted 2273 440 Posting not permitted 2274 Subsequent responses 2275 240 Article received OK 2276 441 Posting failed 2278 6.3.1.2 Description 2280 If posting is allowed, a 340 response MUST be returned to indicate 2281 that the article to be posted should be sent. If posting is 2282 prohibited for some installation-dependent reason, a 440 response 2283 MUST be returned. 2285 If posting is permitted, the article MUST be in the format specified 2286 in Section 3.6 and MUST be sent by the client to the server in the 2287 manner specified (in Section 3.1) for multi-line responses (except 2288 that there is no initial line containing a response code). Thus a 2289 single dot (".") on a line indicates the end of the text, and lines 2290 starting with a dot in the original text have that dot doubled during 2291 transmission. 2293 Following the presentation of the termination sequence by the client, 2294 the server MUST return a response indicating success or failure of 2295 the article transfer. Note that response codes 340 and 440 are used 2296 in direct response to the POST command. Others are returned 2297 following the sending of the article. 2299 A response of 240 SHOULD indicate that, barring unforeseen server 2300 errors, the posted article will be made available on the server 2301 and/or transferred to other servers as appropriate, possibly 2302 following further processing. In other words, articles not wanted by 2303 the server SHOULD be rejected with a 441 response and not accepted 2304 and silently discarded. However, the client SHOULD NOT assume that 2305 the article has been successfully transferred unless it receives an 2306 affirmative response from the server, and SHOULD NOT assume that it 2307 is being made available to other clients without explicitly checking 2308 (for example using the STAT command). 2310 If the session is interrupted before the response is received, it is 2311 possible that an affirmative response was sent but has been lost. 2312 Therefore, in any subsequent session, the client SHOULD either check 2313 whether the article was successfully posted before resending or 2314 ensure that the server will allocate the same message-id to the new 2315 attempt (see Appendix A.2) - the latter approach is preferred since 2316 the article might not have been made available for reading yet (for 2317 example, it may have to go through a moderation process). 2319 6.3.1.3 Examples 2321 Example of a successful posting: 2322 [C] POST 2323 [S] 340 Input article; end with . 2324 [C] From: "Demo User" 2325 [C] Newsgroups: misc.test 2326 [C] Subject: I am just a test article 2327 [C] Organization: An Example Net 2328 [C] 2329 [C] This is just a test article. 2330 [C] . 2331 [S] 240 Article received OK 2333 Example of an unsuccessful posting: 2334 [C] POST 2335 [S] 340 Input article; end with . 2336 [C] From: "Demo User" 2337 [C] Newsgroups: misc.test 2338 [C] Subject: I am just a test article 2339 [C] Organization: An Example Net 2340 [C] 2341 [C] This is just a test article. 2342 [C] . 2343 [S] 441 Posting failed 2345 Example of an attempt to post when posting is not allowed: 2346 [Initial TCP connection set-up completed.] 2347 [S] 201 NNTP Service Ready, posting prohibited 2348 [C] POST 2349 [S] 440 Posting not permitted 2351 6.3.2 IHAVE 2353 6.3.2.1 Usage 2355 Indicating capability: IHAVE 2356 This command MUST NOT be pipelined. 2357 Syntax 2358 IHAVE message-id 2359 Responses 2360 Initial responses 2361 335 Send article to be transferred 2362 435 Article not wanted 2363 436 Transfer not possible; try again later 2364 Subsequent responses 2365 235 Article transferred OK 2366 436 Transfer failed; try again later 2367 437 Transfer rejected; do not retry 2368 Parameters 2369 message-id = Article message-id 2371 6.3.2.2 Description 2373 The IHAVE command informs the server that the client has an article 2374 with the specified message-id. If the server desires a copy of that 2375 article a 335 response MUST be returned, instructing the client to 2376 send the entire article. If the server does not want the article 2377 (if, for example, the server already has a copy of it), a 435 2378 response MUST be returned, indicating that the article is not wanted. 2379 Finally, if the article isn't wanted immediately but the client 2380 should retry later if possible (if, for example, another client is in 2381 the process of sending the same article to the server), a 436 2382 response MUST be returned. 2384 If transmission of the article is requested, the client MUST send the 2385 entire article, including headers and body, in the format defined 2386 above (Section 3.1) for multi-line responses (except that there is no 2387 initial line containing a response code). Thus a single dot (".") on 2388 a line indicates the end of the text, and lines starting with a dot 2389 in the original text have that dot doubled during transmission. The 2390 server MUST return either a 235 response, indicating that the article 2391 was successfully transferred, a 436 response, indicating that the 2392 transfer failed but should be tried again later, or a 437 response, 2393 indicating that the article was rejected. 2395 This function differs from the POST command in that it is intended 2396 for use in transferring already-posted articles between hosts. It 2397 SHOULD NOT be used when the client is a personal news reading 2398 program, since use of this command indicates that the article has 2399 already been posted at another site and is simply being forwarded 2400 from another host. However, despite this, the server MAY elect not 2401 to post or forward the article if, after further examination of the 2402 article, it deems it inappropriate to do so. Reasons for such 2403 subsequent rejection of an article may include such problems as 2404 inappropriate newsgroups or distributions, disc space limitations, 2405 article lengths, garbled headers, and the like. These are typically 2406 restrictions enforced by the server host's news software and not 2407 necessarily the NNTP server itself. 2409 The client SHOULD NOT assume that the article has been successfully 2410 transferred unless it receives an affirmative response from the 2411 server. A lack of response (such as a dropped network connection or 2412 a network timeout) SHOULD be treated the same as a 436 response. 2414 Because some news server software may not be able immediately to 2415 determine whether or not an article is suitable for posting or 2416 forwarding, an NNTP server MAY acknowledge the successful transfer of 2417 the article (with a 235 response) but later silently discard it. 2419 6.3.2.3 Examples 2421 Example of successfully sending an article to another site: 2422 [C] IHAVE 2423 [S] 335 Send it; end with . 2424 [C] Path: pathost!demo!somewhere!not-for-mail 2425 [C] From: "Demo User" 2426 [C] Newsgroups: misc.test 2427 [C] Subject: I am just a test article 2428 [C] Date: 6 Oct 1998 04:38:40 -0500 2429 [C] Organization: An Example Com, San Jose, CA 2430 [C] Message-ID: 2431 [C] 2432 [C] This is just a test article. 2433 [C] . 2434 [S] 235 Article transferred OK 2436 Example of sending an article to another site that rejects it. Note 2437 that the message-id in the IHAVE command is not the same as the one 2438 in the article headers; while this is bad practice and SHOULD NOT be 2439 done, it is not forbidden. 2440 [C] IHAVE 2441 [S] 335 Send it; end with . 2442 [C] Path: pathost!demo!somewhere!not-for-mail 2443 [C] From: "Demo User" 2444 [C] Newsgroups: misc.test 2445 [C] Subject: I am just a test article 2446 [C] Date: 6 Oct 1998 04:38:40 -0500 2448 [C] Organization: An Example Com, San Jose, CA 2449 [C] Message-ID: 2450 [C] 2451 [C] This is just a test article. 2452 [C] . 2453 [S] 437 Article rejected; don't send again 2455 Example of sending an article to another site where the transfer 2456 fails: 2457 [C] IHAVE 2458 [S] 335 Send it; end with . 2459 [C] Path: pathost!demo!somewhere!not-for-mail 2460 [C] From: "Demo User" 2461 [C] Newsgroups: misc.test 2462 [C] Subject: I am just a test article 2463 [C] Date: 6 Oct 1998 04:38:40 -0500 2464 [C] Organization: An Example Com, San Jose, CA 2465 [C] Message-ID: 2466 [C] 2467 [C] This is just a test article. 2468 [C] . 2469 [S] 436 Transfer failed 2471 Example of sending an article to a site that already has it: 2472 [C] IHAVE 2473 [S] 435 Duplicate 2475 Example of sending an article to a site that requests the article be 2476 tried again later: 2477 [C] IHAVE 2478 [S] 436 Retry later 2480 7. Information commands 2482 This section lists other commands that may be used at any time 2483 between the beginning of a session and its termination. Using these 2484 commands does not alter any state information, but the response 2485 generated from their use may provide useful information to clients. 2487 7.1 DATE 2489 7.1.1 Usage 2491 Indicating capability: READER 2492 Syntax 2493 DATE 2494 Responses 2495 111 yyyymmddhhmmss server date and time 2496 Parameters 2497 yyyymmddHHmmss = Current UTC date and time on server 2499 7.1.2 Description 2501 This command exists to help clients find out the current Coordinated 2502 Universal Time [TF.686-1] from the server's perspective. This 2503 command SHOULD NOT be used as a substitute for NTP [RFC1305] but to 2504 provide information that might be useful when using the NEWNEWS 2505 command (see Section 7.4). 2507 The DATE command MUST return a timestamp from the same clock as is 2508 used for determining article arrival and group creation times (see 2509 Section 6). This clock SHOULD be monotonic, and adjustments SHOULD 2510 be made by running it fast or slow compared to "real" time rather 2511 than by making sudden jumps. A system providing NNTP service SHOULD 2512 keep the system clock as accurate as possible, either with NTP or by 2513 some other method. 2515 The server MUST return a 111 response specifying the date and time on 2516 the server in the form yyyymmddhhmmss. This date and time is in 2517 Coordinated Universal Time. 2519 7.1.3 Examples 2521 [C] DATE 2522 [S] 111 19990623135624 2524 7.2 HELP 2525 7.2.1 Usage 2527 This command is mandatory. 2528 Syntax 2529 HELP 2530 Responses 2531 100 Help text follows (multiline) 2533 7.2.2 Description 2535 This command provides a short summary of the commands that are 2536 understood by this implementation of the server. The help text will 2537 be presented as a multiline response following the 100 response code. 2539 This text is not guaranteed to be in any particular format and MUST 2540 NOT be used by clients as a replacement for the CAPABILITIES command 2541 described in Section 5.2 2543 7.2.3 Examples 2545 [C] HELP 2546 [S] 100 Help text follows 2547 [S] This is some help text. There is no specific 2548 [S] formatting requirement for this test, though 2549 [S] it is customary for it to list the valid commands 2550 [S] and give a brief definition of what they do 2551 [S] . 2553 7.3 NEWGROUPS 2555 7.3.1 Usage 2557 Indicating capability: READER 2558 Syntax 2559 NEWGROUPS date time [GMT] 2560 Responses 2561 231 List of new newsgroups follows (multiline) 2562 Parameters 2563 date = Date in yymmdd or yyyymmdd format 2564 time = Time in hhmmss format 2566 7.3.2 Description 2568 This command returns a list of newsgroups created on the server since 2569 the specified date and time. The results are in the same format as 2570 the LIST ACTIVE command (see Section 7.6.3). However, they MAY 2571 include groups not available on the server (and so not returned by 2572 LIST ACTIVE) and MAY omit groups for which the creation date is not 2573 available. 2575 The date is specified as 6 or 8 digits in the format [xx]yymmdd, 2576 where xx is the first two digits of the year (19-99), yy is the last 2577 two digits of the year (00-99), mm is the month (01-12), and dd is 2578 the day of the month (01-31). Clients SHOULD specify all four digits 2579 of the year. If the first two digits of the year are not specified 2580 (this is supported only for backwards compatibility), the year is to 2581 be taken from the current century if yy is smaller than or equal to 2582 the current year, otherwise the year is from the previous century. 2584 The time is specified as 6 digits in the format hhmmss, where hh is 2585 the hours in the 24-hour clock (00-23), mm is the minutes (00-59), 2586 and ss is the seconds (00-60, to allow for leap seconds). The token 2587 "GMT" specifies that the date and time are given in Coordinated 2588 Universal Time [TF.686-1]; if it is omitted then the date and time 2589 are specified in the server's local timezone. Note that there is no 2590 way using the protocol specified in this document to establish the 2591 server's local timezone. 2593 Note that an empty list is a possible valid response and indicates 2594 that there are no new newsgroups since that date-time. 2596 Clients SHOULD make all queries using Coordinated Universal Time 2597 (i.e. by including the "GMT" argument) when possible. 2599 7.3.3 Examples 2601 Example where there are new groups: 2602 [C] NEWGROUPS 19990624 000000 GMT 2603 [S] 231 list of new newsgroups follows 2604 [S] alt.rfc-writers.recovery 4 1 y 2605 [S] tx.natives.recovery 89 56 y 2606 [S] . 2608 Example where there are no new groups: 2609 [C] NEWGROUPS 19990624 000000 GMT 2610 [S] 231 list of new newsgroups follows 2611 [S] . 2613 7.4 NEWNEWS 2615 7.4.1 Usage 2617 Indicating capability: READER 2618 Syntax 2619 NEWNEWS wildmat date time [GMT] 2620 Responses 2621 230 List of new articles follows (multiline) 2622 Parameters 2623 wildmat = Newsgroups of interest 2624 date = Date in yymmdd or yyyymmdd format 2625 time = Time in hhmmss format 2627 7.4.2 Description 2629 This command returns a list of message-ids of articles posted or 2630 received on the server, in the newsgroups whose names match the 2631 wildmat, since the specified date and time. One message-id is sent 2632 on each line; the order of the response has no specific significance 2633 and may vary from response to response in the same session. A 2634 message-id MAY appear more than once; if it does so, it has the same 2635 meaning as if it appeared only once. 2637 Date and time are in the same format as the NEWGROUPS command (see 2638 Section 7.3). 2640 Note that an empty list is a possible valid response and indicates 2641 that there is currently no new news in the relevant groups. 2643 Clients SHOULD make all queries in Coordinated Universal Time (i.e. 2644 by using the "GMT" argument) when possible. 2646 7.4.3 Examples 2648 Example where there are new articles: 2649 [C] NEWNEWS news.*,sci.* 19990624 000000 GMT 2650 [S] 230 list of new articles by message-id follows 2651 [S] 2652 [S] 2653 [S] . 2655 Example where there are no new articles: 2656 [C] NEWNEWS alt.* 19990624 000000 GMT 2657 [S] 230 list of new articles by message-id follows 2658 [S] . 2660 7.5 Time 2662 As described in Section 6, each article has an arrival timestamp. 2663 Each newsgroup also has a creation timestamp. These timestamps are 2664 used by the NEWNEWS and NEWGROUP commands to construct their 2665 responses. 2667 Clients can ensure that they do not have gaps in lists of articles or 2668 groups by using the DATE command in the following manner: 2669 First session: 2670 Issue DATE command and record result 2671 Issue NEWNEWS command using a previously chosen timestamp 2672 Subsequent sessions: 2673 Issue DATE command and hold result in temporary storage 2674 Issue NEWNEWS command using timestamp saved from previous session 2675 Overwrite saved timestamp with that currently in temporary storage 2676 In order to allow for minor errors, clients MAY want to adjust the 2677 timestamp back by two or three minutes before using it in NEWNEWS. 2679 7.5.1 Examples 2681 First session: 2682 [C] DATE 2683 [S] 111 20010203112233 2684 [C] NEWNEWS local.chat 20001231 235959 GMT 2685 [S] 230 list follows 2686 [S] 2687 [S] 2688 [S] 2689 [S] . 2690 Second session (the client has subtracted 3 minutes from the 2691 timestamp returned previously): 2692 [C] DATE 2693 [S] 111 20010204003344 2694 [C] NEWNEWS local.chat 20010203 111933 GMT 2695 [S] 230 list follows 2696 [S] 2697 [S] 2698 [S] 2699 [S] . 2700 Note how arrived in the 3 minute gap and so 2701 is listed in both responses. 2703 7.6 The LIST commands 2705 The LIST family of commands all return information that is multi-line 2706 and, in general, can be expected not to change during the session. 2707 Often the information is related to newsgroups, in which case the 2708 response has one line per newsgroup and a wildmat MAY be provided to 2709 restrict the groups for which information is returned. 2711 The set of available keywords (including those provided by 2712 extensions) is given in the capability list with capability label 2713 LIST. 2715 7.6.1 LIST 2717 7.6.1.1 Usage 2719 Indicating capability: LIST 2720 Syntax 2721 LIST [keyword [wildmat|argument]] 2722 Responses 2723 215 Information follows (multiline) 2724 Parameters 2725 keyword = information requested [1] 2726 argument = specific to keyword 2727 wildmat = groups of interest 2728 [1] If no keyword is provided, it defaults to ACTIVE. 2730 7.6.1.2 Description 2732 The LIST command allows the server to provide blocks of information 2733 to the client. This information may be global or may be related to 2734 newsgroups; in the latter case, the information may be returned 2735 either for all groups or only for those matching a wildmat. Each 2736 block of information is represented by a different keyword. The 2737 command returns the specific information identified by the keyword. 2739 If the information is available, it is returned as a multi-line 2740 response following the 215 response code. The format of the 2741 information depends on the keyword. The information MAY be affected 2742 by the additional argument, but the format MUST NOT be. 2744 If the information is based on newsgroups and the optional wildmat 2745 argument is specified, the response is limited to only the groups (if 2746 any) whose names match the wildmat and for which the information is 2747 available. 2749 Note that an empty list is a possible valid response; for a 2750 newsgroup-based keyword, it indicates that there are no groups 2751 meeting the above criteria. 2753 If the keyword is not recognised, or if an argument is specified and 2754 the keyword does not expect one, a 501 response code MUST BE 2755 returned. If the keyword is recognised but the server does not 2756 maintain the information, a 503 response code MUST BE returned. 2758 The LIST command MUST NOT change the visible state of the server in 2759 any way; that is, the behaviour of subsequent commands MUST NOT be 2760 affected by whether the LIST command was issued or not. For example, 2761 it MUST NOT make groups available that otherwise would not have been. 2763 7.6.1.3 Examples 2765 Example of LIST with the ACTIVE keyword: 2766 [C] LIST ACTIVE 2767 [S] 215 list of newsgroups follows 2768 [S] misc.test 3002322 3000234 y 2769 [S] comp.risks 442001 441099 m 2770 [S] alt.rfc-writers.recovery 4 1 y 2771 [S] tx.natives.recovery 89 56 y 2772 [S] tx.natives.recovery.d 11 9 n 2773 [S] . 2775 Example of LIST with no keyword: 2776 [C] LIST 2777 [S] 215 list of newsgroups follows 2778 [S] misc.test 3002322 3000234 y 2779 [S] comp.risks 442001 441099 m 2780 [S] alt.rfc-writers.recovery 4 1 y 2781 [S] tx.natives.recovery 89 56 y 2782 [S] tx.natives.recovery.d 11 9 n 2783 [S] . 2784 The output is identical to that of the previous example. 2786 Example of LIST on a newsgroup-based keyword with and without 2787 wildmat: 2788 [C] LIST ACTIVE.TIMES 2789 [S] 215 information follows 2790 [S] misc.test 930445408 2791 [S] alt.rfc-writers.recovery 930562309 2792 [S] tx.natives.recovery 930678923 2793 [S] . 2794 [C] LIST ACTIVE.TIMES tx.* 2795 [S] 215 information follows 2796 [S] tx.natives.recovery 930678923 2797 [S] . 2799 Example of LIST returning an error where the keyword is recognized 2800 but the software does not maintain this information: 2801 [C] CAPABILITIES 2802 [S] 101 Capability list: 2803 [S] VERSION 2 2804 [S] READER 2805 [S] LIST ACTIVE NEWSGROUPS ACTIVE.TIMES XTRA.DATA 2806 [S] . 2807 [C] LIST XTRA.DATA 2808 [S] 503 Data item not stored 2810 Example of LIST where the keyword is not recognised: 2812 [C] CAPABILITIES 2813 [S] 101 Capability list: 2814 [S] VERSION 2 2815 [S] READER 2816 [S] LIST ACTIVE NEWSGROUPS ACTIVE.TIMES XTRA.DATA 2817 [S] . 2818 [C] LIST DISTRIB.PATS 2819 [S] 501 Syntax Error 2821 7.6.2 Standard LIST keywords 2823 This specification defines the following LIST keywords: 2825 +----------------------+----------------------+---------------------+ 2826 | Keyword | Definition | Status | 2827 +----------------------+----------------------+---------------------+ 2828 | ACTIVE | Section 7.6.3 | Mandatory if the | 2829 | | | READER capability | 2830 | | | is advertised | 2831 | | | | 2832 | ACTIVE.TIMES | Section 7.6.4 | Optional | 2833 | | | | 2834 | DISTRIB.PATS | Section 7.6.5 | Optional | 2835 | | | | 2836 | HEADERS | Section 8.6 | Mandatory if the | 2837 | | | HDR capability is | 2838 | | | advertised | 2839 | | | | 2840 | NEWSGROUPS | Section 7.6.6 | Mandatory if the | 2841 | | | READER capability | 2842 | | | is advertised | 2843 | | | | 2844 | OVERVIEW.FMT | Section 8.4 | Mandatory if the | 2845 | | | OVER capability is | 2846 | | | advertised | 2847 +----------------------+----------------------+---------------------+ 2849 Where one of these LIST keywords is supported by a server, it MUST 2850 have the meaning given in the following sub-sections. 2852 7.6.3 LIST ACTIVE 2854 This keyword MUST be supported by servers advertising the READER 2855 capability. 2857 LIST ACTIVE returns a list of valid newsgroups and associated 2858 information. If no wildmat is specified, the server MUST include 2859 every group that the client is permitted to select with the GROUP 2860 (Section 6.1.1) command. Each line of this list consists of four 2861 fields separated from each other by one or more spaces: 2862 o the name of the newsgroup; 2863 o the reported high water mark for the group; 2864 o the reported low water mark for the group; 2865 o the current status of the group on this server. 2867 The reported high and low water marks are as described in the GROUP 2868 command (see Section 6.1.1). 2870 The status field is typically one of: 2871 "y" posting is permitted 2872 "n" posting is not permitted 2873 "m" postings will be forwarded to the newsgroup moderator 2874 The server SHOULD use these values when these meanings are required 2875 and MUST NOT use them with any other meaning. Other values for the 2876 status may exist; the definition of these other values and the 2877 circumstances under which they are returned may be specified in an 2878 extension or may be private to the server. A client SHOULD treat an 2879 unrecognized status as giving no information. 2881 The status of a newsgroup only indicates how posts to that newsgroup 2882 are normally processed and is not necessarily customised to the 2883 specific client. For example, if the current client is forbidden 2884 from posting, then this will apply equally to groups with status "y". 2885 Conversely, a client with special privileges (not defined by this 2886 specification) might be able to post to a group with status "n". 2888 For example: 2890 [C] LIST ACTIVE 2891 [S] 215 list of newsgroups follows 2892 [S] misc.test 3002322 3000234 y 2893 [S] comp.risks 442001 441099 m 2894 [S] alt.rfc-writers.recovery 4 1 y 2895 [S] tx.natives.recovery 89 56 y 2896 [S] tx.natives.recovery.d 11 9 n 2897 [S] . 2899 or, on an implementation that includes leading zeroes: 2901 [C] LIST ACTIVE 2902 [S] 215 list of newsgroups follows 2903 [S] misc.test 0003002322 0003000234 y 2904 [S] comp.risks 0000442001 0000441099 m 2905 [S] alt.rfc-writers.recovery 0000000004 0000000001 y 2906 [S] tx.natives.recovery 0000000089 0000000056 y 2907 [S] tx.natives.recovery.d 0000000011 0000000009 n 2909 [S] . 2911 The information is newsgroup-based and a wildmat MAY be specified, in 2912 which case the response is limited to only the groups (if any) whose 2913 names match the wildmat. For example: 2915 [C] LIST ACTIVE *.recovery 2916 [S] 215 list of newsgroups follows 2917 [S] alt.rfc-writers.recovery 4 1 y 2918 [S] tx.natives.recovery 89 56 y 2919 [S] . 2921 7.6.4 LIST ACTIVE.TIMES 2923 This keyword is optional. 2925 The active.times list is maintained by some NNTP servers to contain 2926 information about who created a particular newsgroup and when. Each 2927 line of this list consists of three fields separated from each other 2928 by one or more spaces. The first field is the name of the newsgroup. 2929 The second is the time when this group was created on this news 2930 server, measured in seconds since the start of January 1, 1970. The 2931 third is plain text intended to describe the entity that created the 2932 newsgroup; it is often a mailbox as defined in RFC 2822 [RFC2822]. 2933 For example: 2935 [C] LIST ACTIVE.TIMES 2936 [S] 215 information follows 2937 [S] misc.test 930445408 2938 [S] alt.rfc-writers.recovery 930562309 2939 [S] tx.natives.recovery 930678923 2940 [S] . 2942 The list MAY omit newsgroups for which the information is unavailable 2943 and MAY include groups not available on the server; in particular, it 2944 MAY omit all groups created before the date and time of the oldest 2945 entry. The client MUST NOT assume that the list is complete or that 2946 it matches the list returned by the LIST ACTIVE (Section 7.6.3) 2947 command. The NEWGROUPS command (Section 7.3) may provide a better 2948 way to access this information, and the results of the two commands 2949 SHOULD be consistent except that, if the latter is invoked with a 2950 date and time earlier than the oldest entry in active.times list, its 2951 result may include extra groups. 2953 The information is newsgroup-based and a wildmat MAY be specified, in 2954 which case the response is limited to only the groups (if any) whose 2955 names match the wildmat. 2957 7.6.5 LIST DISTRIB.PATS 2959 This keyword is optional. 2961 The distrib.pats list is maintained by some NNTP servers to assist 2962 clients to choose a value for the content of the Distribution header 2963 of a news article being posted. Each line of this list consists of 2964 three fields separated from each other by a colon (":"). The first 2965 field is a weight, the second field is a wildmat (which may be a 2966 simple group name), and the third field is a value for the 2967 Distribution header content. For example: 2969 [C] LIST DISTRIB.PATS 2970 [S] 215 information follows 2971 [S] 10:local.*:local 2972 [S] 5:*:world 2973 [S] 20:local.here.*:thissite 2974 [S] . 2976 The client MAY use this information to construct an appropriate 2977 Distribution header given the name of a newsgroup. To do so, it 2978 should determine the lines whose second field matches the newsgroup 2979 name, select from among them the line with the highest weight (with 0 2980 being the lowest), and use the value of the third field to construct 2981 the Distribution header. 2983 The information is not newsgroup-based and an argument MUST NOT be 2984 specified. 2986 7.6.6 LIST NEWSGROUPS 2988 This keyword MUST be supported by servers advertising the READER 2989 capability. 2991 The newsgroups list is maintained by NNTP servers to contain the name 2992 of each newsgroup that is available on the server and a short 2993 description about the purpose of the group. Each line of this list 2994 consists of two fields separated from each other by one or more space 2995 or TAB characters (the usual practice is a single TAB). The first 2996 field is the name of the newsgroup and the second is a short 2997 description of the group. For example: 2999 [C] LIST NEWSGROUPS 3000 [S] 215 information follows 3001 [S] misc.test General Usenet testing 3002 [S] alt.rfc-writers.recovery RFC Writers Recovery 3003 [S] tx.natives.recovery Texas Natives Recovery 3004 [S] . 3006 The list MAY omit newsgroups for which the information is unavailable 3007 and MAY include groups not available on the server. The client MUST 3008 NOT assume that the list is complete or that it matches the list 3009 returned by LIST ACTIVE. 3011 The information is newsgroup-based and a wildmat MAY be specified, in 3012 which case the response is limited to only the groups (if any) whose 3013 names match the wildmat. 3015 8. Article field access commands 3017 This section lists commands that may be used to access specific 3018 article fields; that is, headers of articles and metadata about 3019 articles. These commands typically fetch data from an "overview 3020 database", which is a database of headers extracted from incoming 3021 articles plus metadata determined as the article arrives. Only 3022 certain fields are included in the database. 3024 This section is based on the Overview/NOV database [ROBE1995] 3025 developed by Geoff Collyer. 3027 8.1 Article metadata 3029 Article "metadata" is data about articles that does not occur within 3030 the article itself. Each metadata item has a name which MUST begin 3031 with a colon (and which MUST NOT contain a colon elsewhere within 3032 it). As with header names, metadata item names are not 3033 case-sensitive. 3035 When generating a metadata item, the server MUST compute it for 3036 itself and MUST NOT trust any related value provided in the article. 3037 (In particular, a Lines or Bytes header in the article MUST NOT be 3038 assumed to specify the correct number of lines or bytes in the 3039 article.) If the server has access to several non-identical copies of 3040 an article, the value returned MUST be correct for any copy of that 3041 article retrieved during the same session. 3043 This specification defines two metadata items: ":bytes" and ":lines". 3044 Other metadata items may be defined by extensions. The names of 3045 metadata items defined by registered extensions MUST NOT begin with 3046 ":x-". To avoid the risk of a clash with a future registered 3047 extension, the names of metadata items defined by private extensions 3048 SHOULD begin with ":x-". 3050 8.1.1 The :bytes metadata item 3052 The :bytes metadata item for an article is a decimal integer. It 3053 SHOULD equal the number of octets in the entire article - headers, 3054 body, and separating empty line (counting a CRLF pair as two octets, 3055 and excluding both the "." CRLF terminating the response and any "." 3056 added for "byte-stuffing" purposes). 3058 Note to client implementers: some existing servers return a value 3059 different to that above. The commonest reasons for this are: 3060 o counting a CRLF pair as one octet; 3061 o including the "." character used for byte-stuffing in the number; 3062 o including the terminating "." CRLF in the number; 3063 o using one copy of an article for counting the octets but then 3064 returning another one that differs in some (permitted) manner. 3065 Implementations should be prepared for such variation and MUST NOT 3066 rely on the value being accurate. 3068 8.1.2 The :lines metadata item 3070 The :lines metadata item for an article is a decimal integer. It 3071 MUST equal the number of lines in the article body (excluding the 3072 empty line separating headers and body); equivalently, it is two less 3073 than the number of CRLF pairs that the BODY command would return for 3074 that article (the extra two are those following the response code and 3075 the termination octet). 3077 8.2 Database consistency 3079 The information stored in the overview database may change over time. 3080 If the database records the content or absence of a given field (that 3081 is, a header or metadata item) for all articles, it is said to be 3082 "consistent" for that field. If it records the content of a header 3083 for some articles but not for others that nevertheless included that 3084 header, or records a metadata item for some articles but not others 3085 to which that item applies, it is said to be "inconsistent" for that 3086 field. 3088 The LIST OVERVIEW.FMT command SHOULD list all the fields for which 3089 the database is consistent at that moment. It MAY omit such fields 3090 (for example if it is not known whether the database is consistent or 3091 inconsistent). It MUST NOT include fields for which the database is 3092 inconsistent or which are not stored in the database. Therefore if a 3093 header appears in the LIST OVERVIEW.FMT output but not the OVER 3094 output for a given article, that header does not appear in the 3095 article, and similarly for metadata items. 3097 These rules assume the fields being stored in the database remain 3098 constant for long periods of time, with the database therefore being 3099 consistent. When the set of fields to be stored is changed, it will 3100 be inconsistent until either the database is rebuilt or the only 3101 articles remaining are those received since the change. Therefore 3102 the output from LIST OVERVIEW.FMT needs to be altered twice: before 3103 any fields stop being stored, they MUST be removed from the output, 3104 then when the database is once more known to be consistent, the new 3105 fields SHOULD be added to the output. 3107 If the HDR command uses the overview database rather than taking 3108 information directly from the articles, the same issues of 3109 consistency and inconsistency apply and the and the LIST HEADERS 3110 command SHOULD take the same approach as the LIST OVERVIEW.FMT 3111 command in resolving them. 3113 8.3 OVER 3115 8.3.1 Usage 3117 Indicating capability: OVER 3118 Syntax 3119 OVER message-id 3120 OVER range 3121 OVER 3122 Responses 3123 First form (message-id specified) 3124 224 Overview information follows (multiline) 3125 430 No article with that message-id 3126 Second form (range specified) 3127 224 Overview information follows (multiline) 3128 412 No newsgroup selected 3129 423 No articles in that range 3130 Third form (current article number used) 3131 224 Overview information follows (multiline) 3132 412 No newsgroup selected 3133 420 Current article number is invalid 3134 Parameters 3135 range = number(s) of articles 3136 message-id = message-id of article 3138 8.3.2 Description 3140 The OVER command returns the contents of all the fields in the 3141 database for an article specified by message-id, or from a specified 3142 article or range of articles in the current selected newsgroup. 3144 The message-id argument indicates a specific article. The range 3145 argument may be any of the following: 3146 o an article number 3147 o an article number followed by a dash to indicate all following 3148 o an article number followed by a dash followed by another article 3149 number 3150 If neither is specified, the current article number is used. 3152 Support for the first (message-id) form is optional. If is is 3153 supported, the OVER capability line MUST include the argument 3154 "MSGID". Otherwise, the capability line MUST NOT include this 3155 argument, and the OVER command MUST return the the generic response 3156 code 503 when this form is used. 3158 If the information is available, it is returned as a multi-line 3159 response following the 224 response code and contains one line per 3160 article, sorted in numerical order of article number (note that 3161 unless the argument is a range including a dash, there will only be 3162 one line but it will still be in multi-line format). Each line 3163 consists of a number of fields separated by a TAB. A field may be 3164 empty (in which case there will be two adjacent TABs), and a sequence 3165 of trailing TABs may be omitted. 3167 The first 8 fields MUST be the following, in order: 3168 "0" or article number (see below) 3169 Subject header content 3170 From header content 3171 Date header content 3172 Message-ID header content 3173 References header content 3174 :bytes metadata item 3175 :lines metadata item 3176 If the article is specified by message-id (the first form of the 3177 command), the article number MUST be replaced with zero, except that 3178 if there is a current selected group and the article is present in 3179 that group, the server MAY use that article number (see the ARTICLE 3180 command (Section 6.2.1) and STAT examples (Section 6.2.4.3) for more 3181 details). In the other two forms of the command, the article number 3182 MUST be returned. 3184 Any subsequent fields are the contents of the other headers and 3185 metadata held in the database. 3187 For the five mandatory headers, the content of each field MUST be 3188 based on the content of the header (that is, with the header name and 3189 following colon and space removed). If the article does not contain 3190 that header, or if the content is empty, the field MUST be empty. 3191 For the two mandatory metadata items, the content of the field MUST 3192 be just the value, with no other text. 3194 For all subsequent fields that contain headers, the content MUST be 3195 the entire header line other than the trailing CRLF. For all 3196 subsequent fields that contain metadata, the field consists of the 3197 metadata name, a single space, and then the value. 3199 For all fields, the value is processed by first removing all CRLF 3200 pairs (that is, undoing any folding and removing the terminating 3201 CRLF) and then replacing each TAB with a single space. If there is 3202 no such header in the article, or no such metadata item, or no header 3203 or item stored in the database for that article, the corresponding 3204 field MUST be empty. 3206 Note that, after unfolding, the characters NUL, LF, and CR cannot 3207 occur in the header of an article offered by a conformant server. 3208 Nevertheless, servers SHOULD check for these characters and replace 3209 each one by a single space (so that, for example, CR LF LF TAB will 3210 become two spaces, since the CR and first LF will be removed by the 3211 unfolding process). This will encourage robustness in the face of 3212 non-conforming data; it is also possible that future versions of this 3213 specification could permit these characters to appear in articles. 3215 The server SHOULD NOT produce output for articles that no longer 3216 exist. 3218 If the argument is a message-id and no such article exists, a 430 3219 response MUST be returned. If the argument is a range or is omitted 3220 and the current selected newsgroup is invalid, a 412 response MUST be 3221 returned. If the argument is a range and no articles in that number 3222 range exist in the current selected newsgroup, a 423 response MUST be 3223 returned. If the argument is omitted and the current article number 3224 is invalid, a 420 response MUST be returned. 3226 8.3.3 Examples 3228 In the first three examples, TAB has been replaced by vertical bar 3229 and some lines have been folded for readability. 3231 Example of a successful retrieval of overview information for an 3232 article (using no article number): 3233 [C] GROUP misc.test 3234 [S] 211 1234 3000234 3002322 misc.test 3235 [C] OVER 3236 [S] 224 Overview information follows 3237 [S] 300234|I am just a test article|"Demo User" 3238 |6 Oct 1998 04:38:40 -0500| 3239 <45223423@example.com>|<45454@example.net>|1234| 3240 17|Xref: news.example.com misc.test:3000363 3241 [S] . 3243 Example of a successful retrieval of overview information for an 3244 article by message-id: 3245 [C] CAPABILITIES 3246 [S] 101 Capability list: 3247 [S] VERSION 2 3248 [S] READER 3249 [S] OVER MSGID 3250 [S] LIST ACTIVE NEWSGROUPS OVERVIEW.FMT 3251 [S] . 3252 [C] OVER <45223423@example.com> 3253 [S] 224 Overview information follows 3255 [S] 0|I am just a test article|"Demo User" 3256 |6 Oct 1998 04:38:40 -0500| 3257 <45223423@example.com>|<45454@example.net>|1234| 3258 17|Xref: news.example.com misc.test:3000363 3259 [S] . 3260 Note that the article number has been replaced by "0". 3262 Example of the same commands on a system that does not implement 3263 retrieval by message-id: 3264 [C] CAPABILITIES 3265 [S] 101 Capability list: 3266 [S] VERSION 2 3267 [S] READER 3268 [S] OVER 3269 [S] LIST ACTIVE NEWSGROUPS OVERVIEW.FMT 3270 [S] . 3271 [C] OVER <45223423@example.com> 3272 [S] 503 Overview by message-id unsupported 3274 Example of a successful retrieval of overview information for a range 3275 of articles: 3276 [C] GROUP misc.test 3277 [S] 211 1234 3000234 3002322 misc.test 3278 [C] OVER 3000234-3000240 3279 [S] 224 Overview information follows 3280 [S] 300234|I am just a test article|"Demo User" 3281 |6 Oct 1998 04:38:40 -0500| 3282 <45223423@example.com>|<45454@example.net>|1234| 3283 17|Xref: news.example.com misc.test:3000363 3284 [S] 3000235|Another test article|nobody@nowhere.to 3285 (Demo User)|6 Oct 1998 04:38:45 -0500|<45223425@to.to>|| 3286 4818|37||Distribution: fi 3287 [S] 3000238|Re: I am just a test article|somebody@elsewhere.to| 3288 7 Oct 1998 11:38:40 +1200|| 3289 <45223423@to.to>|9234|51 3290 [S] . 3291 Note the missing "References" and Xref headers in the second line, 3292 the missing trailing field(s) in the first and last lines, and that 3293 there are only results for those articles that still exist. 3295 Example of an unsuccessful retrieval of overview information on an 3296 article by number: 3297 [C] GROUP misc.test 3298 [S] 211 1234 3000234 3002322 misc.test 3299 [C] OVER 300256 3300 [S] 423 No such article in this group 3302 Example of an unsuccessful retrieval of overview information by 3303 number because no newsgroup was selected first: 3304 [Assumes current selected newsgroup is invalid.] 3305 [C] OVER 3306 [S] 412 No newsgroup selected 3308 Example of an attempt to retrieve information when the current 3309 selected newsgroup is empty: 3310 [C] GROUP example.empty.newsgroup 3311 [S] 211 0 0 0 example.empty.newsgroup 3312 [C] OVER 3313 [S] 420 No current article selected 3315 8.4 LIST OVERVIEW.FMT 3317 8.4.1 Usage 3319 Indicating capability: OVER 3320 Syntax 3321 LIST OVERVIEW.FMT 3322 Responses 3323 215 Information follows (multiline) 3325 8.4.2 Description 3327 See Section 7.6.1 for general requirements of the LIST command. 3329 The LIST OVERVIEW.FMT command returns a description of the fields in 3330 the database for which it is consistent (as described above). The 3331 information is returned as a multi-line response following the 215 3332 response code. The information contains one line per field in the 3333 order they are returned by the OVER command; the first 7 lines MUST 3334 (except for the case of letters) be exactly: 3336 Subject: 3337 From: 3338 Date: 3339 Message-ID: 3340 References: 3341 :bytes 3342 :lines 3344 except that, for compatibility with existing implementations, the 3345 last two lines MAY instead be: 3347 Bytes: 3348 Lines: 3350 even though they refer to metadata, not headers. 3352 All subsequent lines MUST consist of either a header name followed by 3353 ":full", or the name of a piece of metadata. 3355 There are no leading or trailing spaces in the output. 3357 Note that the 7 fixed lines describe the 2nd to 8th fields of the 3358 OVER output. The "full" suffix (which may use either uppercase, 3359 lowercase, or a mix) is a reminder that the corresponding fields 3360 include the header name. 3362 This command MAY generate different results if used more than once in 3363 a session. 3365 8.4.3 Examples 3367 Example of LIST OVERVIEW.FMT output corresponding to the example OVER 3368 output above, using the preferred format: 3369 [C] LIST OVERVIEW.FMT 3370 [S] 215 Order of fields in overview database. 3371 [S] Subject: 3372 [S] From: 3373 [S] Date: 3374 [S] Message-ID: 3375 [S] References: 3376 [S] :bytes 3377 [S] :lines 3378 [S] Xref:full 3379 [S] Distribution:full 3380 [S] . 3382 Example of LIST OVERVIEW.FMT output corresponding to the example OVER 3383 output above, using the alternative format: 3384 [C] LIST OVERVIEW.FMT 3385 [S] 215 Order of fields in overview database. 3386 [S] Subject: 3387 [S] From: 3388 [S] Date: 3389 [S] Message-ID: 3390 [S] References: 3391 [S] Bytes: 3392 [S] Lines: 3393 [S] Xref:FULL 3394 [S] Distribution:FULL 3395 [S] . 3397 8.5 HDR 3398 8.5.1 Usage 3400 Indicating capability: HDR 3401 Syntax 3402 HDR field message-id 3403 HDR field range 3404 HDR field 3405 Responses 3406 First form (message-id specified) 3407 225 Headers follow (multiline) 3408 430 No article with that message-id 3409 Second form (range specified) 3410 225 Headers follow (multiline) 3411 412 No newsgroup selected 3412 423 No articles in that range 3413 Third form (current article number used) 3414 225 Headers follow (multiline) 3415 412 No newsgroup selected 3416 420 Current article number is invalid 3417 Parameters 3418 field = name of field 3419 range = number(s) of articles 3420 message-id = message-id of article 3422 8.5.2 Description 3424 The HDR command provides access to specific fields from an article 3425 specified by message-id, or from a specified article or range of 3426 articles in the current selected newsgroup. It MAY take the 3427 information directly from the articles or from the overview database. 3428 In the case of headers, an implementation MAY restrict the use of 3429 this command to a specific list of headers or MAY allow it to be used 3430 with any header; it may behave differently when it is used with a 3431 message-id argument and when it is used with a range or no argument. 3433 The required field argument is the name of a header with the colon 3434 omitted (e.g. "subject"), or the name of a metadata item including 3435 the leading colon (e.g. ":bytes"), and is case-insensitive. 3437 The message-id argument indicates a specific article. The range 3438 argument may be any of the following: 3439 o an article number 3440 o an article number followed by a dash to indicate all following 3441 o an article number followed by a dash followed by another article 3442 number 3443 If neither is specified, the current article number is used. 3445 If the information is available, it is returned as a multi-line 3446 response following the 225 response code and contains one line for 3447 each article in the range that exists (note that unless the argument 3448 is a range including a dash, there will be at most one line but it 3449 will still be in multi-line format). The line consists of the 3450 article number, a space, and then the contents of the field. In the 3451 case of a header, the header name, colon, and the first space after 3452 the colon are all omitted. 3454 If the article is specified by message-id (the first form of the 3455 command), the article number MUST be replaced with zero, except that 3456 if there is a current selected group and the article is present in 3457 that group, the server MAY use that article number (see the ARTICLE 3458 command (Section 6.2.1) and STAT examples (Section 6.2.4.3) for more 3459 details). In the other two forms of the command, the article number 3460 MUST be returned. 3462 Header contents are modified as follows: all CRLF pairs are removed, 3463 and then each TAB is replaced with a single space (note that this is 3464 the same transformation as is performed by the OVER command 3465 (Section 8.3.2), and the same comment concerning NUL, CR, and LF 3466 applies). 3468 Note the distinction between headers and metadata appearing to have 3469 the same meaning. Headers are always taken unchanged from the 3470 article; metadata are always calculated. For example, a request for 3471 "Lines" returns the contents of the "Lines" header of the specified 3472 articles, if any, no matter whether or not they accurately state the 3473 number of lines, while a request for ":lines" returns the line count 3474 metadata, which is always the actual number of lines irrespective of 3475 what any header may state. 3477 If the requested header is not present in the article or if it is 3478 present but empty, a line for that article is included in the output 3479 but the header content portion of the line is empty (the space after 3480 the article number MAY be retained or omitted). If the header occurs 3481 in a given article more than once, only the content of the first 3482 occurrence is returned by HDR. If any article number in the provided 3483 range does not exist in the group, no line for that article number is 3484 included in the output. 3486 If the second argument is a message-id and no such article exists, a 3487 430 response MUST be returned. If the second argument is a range or 3488 is omitted and the current selected newsgroup is invalid, a 412 3489 response MUST be returned. If the second argument is a range and no 3490 articles in that number range exist in the current selected 3491 newsgroup, a 423 response MUST be returned. If the second argument 3492 is omitted and the current article number is invalid, a 420 response 3493 MUST be returned. 3495 A server MAY only allow HDR commands for a limited set of fields; it 3496 may behave differently in this respect for the first (message-id) 3497 form than for the other forms. If so, it MUST respond with the 3498 generic 503 response to attempts to request other fields, rather than 3499 returning erroneous results such as a successful empty response. 3501 If HDR uses the overview database and it is inconsistent for the 3502 requested field, the server MAY return what results it can or it MAY 3503 respond with the generic 503 response; in the latter case, the field 3504 MUST NOT appear in the output from LIST HEADERS. 3506 8.5.3 Examples 3508 Example of a successful retrieval of subject lines from a range of 3509 articles (3000235 has no Subject header, and 3000236 is missing): 3510 [C] GROUP misc.test 3511 [S] 211 1234 3000234 3002322 misc.test 3512 [C] HDR Subject 3000234-300238 3513 [S] 225 Headers follow 3514 [S] 3000234 I am just a test article 3515 [S] 3000235 3516 [S] 3000237 Re: I am just a test article 3517 [S] 3000238 Ditto 3518 [S] . 3520 Example of a successful retrieval of line counts from a range of 3521 articles: 3522 [C] GROUP misc.test 3523 [S] 211 1234 3000234 3002322 misc.test 3524 [C] HDR :lines 3000234-300238 3525 [S] 225 Headers follow 3526 [S] 3000234 42 3527 [S] 3000235 5 3528 [S] 3000237 11 3529 [S] 3000238 2378 3530 [S] . 3532 Example of a successful retrieval of the subject line from an article 3533 by message-id: 3534 [C] GROUP misc.test 3535 [S] 211 1234 3000234 3002322 misc.test 3536 [C] HDR subject 3537 [S] 225 Header information follows 3538 [S] 0 I am just a test article 3539 [S] . 3541 Example of a successful retrieval of the subject line from the 3542 current article: 3544 [C] GROUP misc.test 3545 [S] 211 1234 3000234 3002322 misc.test 3546 [C] HDR subject 3547 [S] 225 Header information follows 3548 [S] 3000234 I am just a test article 3549 [S] . 3551 Example of an unsuccessful retrieval of a header from an article by 3552 message-id: 3553 [C] HDR subject 3554 [S] 430 No Such Article Found 3556 Example of an unsuccessful retrieval of headers from articles by 3557 number because no newsgroup was selected first: 3558 [Assumes current selected newsgroup is invalid.] 3559 [C] HDR subject 300256- 3560 [S] 412 No newsgroup selected 3562 Example of an unsuccessful retrieval of headers because the current 3563 selected newsgroup is empty: 3564 [C] GROUP example.empty.newsgroup 3565 [S] 211 0 0 0 example.empty.newsgroup 3566 [C] HDR subject 1- 3567 [S] 423 No articles in that range 3569 Example of an unsuccessful retrieval of headers because the server 3570 does not allow HDR commands for that header: 3571 [C] GROUP misc.test 3572 [S] 211 1234 3000234 3002322 misc.test 3573 [C] HDR Content-Type 3000234-300238 3574 [S] 503 HDR not permitted on Content-Type 3576 8.6 LIST HEADERS 3578 8.6.1 Usage 3580 Indicating capability: HDR 3581 Syntax 3582 LIST HEADERS [MSGID|RANGE] 3583 Responses 3584 215 Field list follows (multiline) 3585 Parameters 3586 MSGID = requests list for access by message-id 3587 RANGE = requests list for access by range 3589 8.6.2 Description 3591 See Section 7.6.1 for general requirements of the LIST command. 3593 The LIST HEADERS command returns a list of fields that may be 3594 retrieved using the HDR command. 3596 The information is returned as a multi-line response following the 3597 215 response code and contains one line for each field name 3598 (excluding the trailing colon for headers and including the leading 3599 colon for metadata items). If the implementation allows any header 3600 to be retrieved, it MUST NOT include any header names in the list but 3601 MUST include the special entry ":" (a single colon on its own); it 3602 MUST still explicitly list any metadata items that are available. 3603 The order of items in the list is not significant; the server need 3604 not even consistently return the same order. The list MAY be empty 3605 (though in this circumstance there is little point in providing the 3606 HDR command). 3608 An implementation that also supports the OVER command SHOULD at least 3609 permit all the headers and metadata items listed in the output from 3610 the LIST OVERVIEW.FMT command. 3612 If the server treats the first form of the HDR command (message-id 3613 specified) differently to the other two forms (range specified or 3614 current article number used) in respect of which headers or metadata 3615 items are available, then: 3616 o if the MSGID argument is specified, the results MUST be those 3617 available for the first form of the HDR command; 3618 o if the RANGE argument is specified, the results MUST be those 3619 available for the second and third forms of the HDR command; 3620 o if no argument is specified, the results MUST be those available 3621 in all forms of the HDR command (that is, it MUST only list those 3622 items listed in both the previous cases). 3624 If the server does not treat the various forms differently, then it 3625 MUST always produce the same results and ignore any argument. 3627 8.6.3 Examples 3629 Example of an implementation providing access to only a few headers: 3630 [C] LIST HEADERS 3631 [S] 215 headers supported: 3632 [S] Subject 3633 [S] Message-ID 3634 [S] Xref 3635 [S] . 3637 Example of an implementation providing access to the same fields as 3638 the first example in Section 8.4.3: 3639 [C] CAPABILITIES 3640 [S] 101 Capability list: 3642 [S] VERSION 2 3643 [S] READER 3644 [S] OVER 3645 [S] HDR 3646 [S] LIST ACTIVE NEWSGROUPS HEADERS OVERVIEW.FMT 3647 [S] . 3648 [C] LIST HEADERS 3649 [S] 215 headers and metadata items supported: 3650 [S] Date 3651 [S] Distribution 3652 [S] From 3653 [S] Message-ID 3654 [S] References 3655 [S] Subject 3656 [S] Xref 3657 [S] :bytes 3658 [S] :lines 3659 [S] . 3661 Example of an implementation providing access to all headers: 3662 [C] LIST HEADERS 3663 [S] 215 metadata items supported: 3664 [S] : 3665 [S] :lines 3666 [S] :bytes 3667 [S] :x-article-number 3668 [S] . 3670 Example of an implementation distinguishing the first form of the HDR 3671 command from the other two forms: 3672 [C] LIST HEADERS RANGE 3673 [S] 215 metadata items supported: 3674 [S] : 3675 [S] :lines 3676 [S] :bytes 3677 [S] . 3678 [C] LIST HEADERS MSGID 3679 [S] 215 headers and metadata items supported: 3680 [S] Date 3681 [S] Distribution 3682 [S] From 3683 [S] Message-ID 3684 [S] References 3685 [S] Subject 3686 [S] :lines 3687 [S] :bytes 3688 [S] :x-article-number 3689 [S] . 3691 [C] LIST HEADERS 3692 [S] 215 headers and metadata items supported: 3693 [S] Date 3694 [S] Distribution 3695 [S] From 3696 [S] Message-ID 3697 [S] References 3698 [S] Subject 3699 [S] :lines 3700 [S] :bytes 3701 [S] . 3702 Note how :x-article-number does not appear in the last set of output. 3704 9. Augmented BNF Syntax for NNTP 3706 Each of the following sections describes the syntax of a major 3707 element of NNTP. This syntax extends and refines the descriptions 3708 elsewhere in this specification, and should be given precedence when 3709 resolving apparent conflicts. Note that ABNF [RFC2234] strings are 3710 case-insensitive. Non-terminals used in several places are defined 3711 in a separate section at the end. 3713 The non-terminals , , and 3714 between them specify the text that flows between client 3715 and server. For each command, the sequence is: 3716 o the client sends an instance of ; 3717 o if the client is one that immediately streams data [1], it sends 3718 an instance of ; 3719 o the server sends an instance of ; 3720 o while the latest response is one that indicates more data is 3721 required (in general, a 3xx response): 3722 * the client sends an instance of ; 3723 * the server sends an instance of . 3725 [1] There are no commands in this specification that immediately 3726 stream data, but this non-terminal is defined for the convenience of 3727 extensions. 3729 9.1 Commands 3731 This syntax defines the non-terminal , which represents 3732 what is sent from the client to the server. 3734 command-line = command EOL 3735 command = X-command 3736 X-command = keyword *(WS token) 3738 command =/ article-command / 3739 body-command / 3740 capabilities-command / 3741 date-command / 3742 group-command / 3743 hdr-command / 3744 head-command / 3745 help-command / 3746 ihave-command / 3747 last-command / 3748 list-command / 3749 listgroup-command / 3750 mode-reader-command / 3751 newgroups-command / 3752 newnews-command / 3753 next-command / 3754 over-command / 3755 post-command / 3756 quit-command / 3757 stat-command 3759 article-command = "ARTICLE" [WS article-ref] 3760 body-command = "BODY" [WS article-ref] 3761 capabilities-command = "CAPABILITIES" [WS keyword] 3762 date-command = "DATE" 3763 group-command = "GROUP" WS newsgroup-name 3764 hdr-command = "HDR" WS header-meta-name [WS range-ref] 3765 head-command = "HEAD" [WS article-ref] 3766 help-command = "HELP" 3767 ihave-command = "IHAVE" WS message-id 3768 last-command = "LAST" 3769 list-command = "LIST" [WS list-arguments] 3770 listgroup-command = "LISTGROUP" [WS newsgroup-name] 3771 mode-reader-command = "MODE" WS "READER" 3772 newgroups-command = "NEWGROUPS" WS date-time 3773 newnews-command = "NEWNEWS" WS wildmat WS date-time 3774 next-command = "NEXT" 3775 over-command = "OVER" [WS range-ref] 3776 post-command = "POST" 3777 quit-command = "QUIT" 3778 stat-command = "STAT" [WS article-ref] 3780 article-ref = article-number / message-id 3781 date = date2y / date4y 3782 date4y = 4DIGIT 2DIGIT 2DIGIT 3783 date2y = 2DIGIT 2DIGIT 2DIGIT 3784 date-time = date WS time [WS "GMT"] 3785 header-meta-name = header-name / metadata-name 3786 list-arguments = keyword [WS token] 3787 metadata-name = ":" 1*A-NOTCOLON 3788 range = article-number ["-" [article-number]] 3789 range-ref = range / message-id 3790 time = 2DIGIT 2DIGIT 2DIGIT 3792 9.2 Command continuation 3794 This syntax defines the further material sent by the client in the 3795 case of multi-stage commands and those that stream data. 3797 command-datastream = UNDEFINED 3798 ; not used, provided as a hook for extensions 3799 command-continuation = ihave-continuation / 3800 post-continuation 3802 ihave-continuation = encoded-article 3803 post-continuation = encoded-article 3805 encoded-article = content-lines termination 3806 ; after undoing the "byte-stuffing", this MUST match
3808 9.3 Responses 3810 9.3.1 Generic responses 3812 This syntax defines the non-terminal , which represents the 3813 generic form of responses - that is, what is sent from the server to 3814 the client in response to a or a. 3816 response = simple-response / multiline-response 3817 multiline-response = simple-response content-lines termination 3819 simple-response = 3820 simple-response-content [SP trailing-comment] CRLF 3821 simple-response-content = X-simple-response-content 3822 X-simple-response-content = 3DIGIT *(SP response-argument) 3823 response-argument = 1*A-CHAR 3824 trailing-comment = *U-CHAR 3826 9.3.2 Initial response line contents 3828 This syntax defines the specific initial response lines for the 3829 various commands in this specification. Only those response codes 3830 with arguments are listed. 3832 simple-response-content =/ response-111-content 3833 response-211-content 3834 response-22x-content 3835 response-401-content 3837 response-111-content = "111" SP date4y time 3838 response-211-content = "211" 3(SP article-number) SP newsgroup-name 3839 response-22x-content = ("220" / "221" / "222" / "223") 3840 SP article-number SP message-id 3841 response-401-content = "401" SP capability-label 3843 9.3.3 Multi-line response contents 3845 This syntax defines the content of the various multi-line responses 3846 (more precisely, the part of the response in ), in 3847 each case after any "byte-stuffing" has been undone. 3849 multiline-response-content = article-response / 3850 body-response / 3851 capabilities-response / 3852 hdr-response / 3853 head-response / 3854 help-response / 3855 list-response / 3856 listgroup-response / 3857 newgroups-response / 3858 newnews-response / 3859 over-response 3861 article-response = article 3862 body-response = body 3863 capabilities-response = 1*(capability-line CRLF) 3864 hdr-response = *(article-number SP hdr-content CRLF) 3865 head-response = 1*header 3866 help-response = *(*B-CHAR CRLF) 3867 list-response = body 3868 listgroup-response = *(article-number CRLF) 3869 newgroups-response = *(newsgroup-name SPA article-number 3870 SPA article-number SPA newsgroup-status CRLF) 3871 newnews-response = *(message-id CRLF) 3872 over-response = *(article-number over-content CRLF) 3874 hdr-content = *S-NONTAB 3875 hdr-n-content = [(header-name ":" / metadata-name) SP hdr-content] 3876 newsgroup-status = %x79 / %x6E / %x6D / private-status 3877 over-content = 1*6(TAB hdr-content) / 3878 7(TAB hdr-content) *(TAB hdr-n-content) 3879 private-status = token ; except the values in newsgroup-status 3881 9.4 Capability lines 3883 This syntax defines the generic form of a capability line in the 3884 capabilities list (see Section 3.3.1). 3886 capability-line = capability-entry 3887 capability-entry = X-capability-entry 3888 X-capability-entry = capability-label *(WS capability-argument) 3889 capability-label = keyword 3890 capability-argument = token 3892 This syntax defines the specific capability entries for the 3893 capabilities in this specification. 3895 capability-entry =/ 3896 hdr-capability / 3897 ihave-capability / 3898 implementation-capability / 3899 list-capability / 3900 mode-reader-capability / 3901 over-capability / 3902 reader-capability / 3903 version-capability 3905 hdr-capability = "HDR" 3906 ihave-capability = "IHAVE" 3907 implementation-capability = "IMPLEMENTATION" *(WS token) 3908 list-capability = "LIST" 1*(WS keyword) 3909 mode-reader-capability = "MODE-READER" 3910 over-capability = "OVER" [WS "MSGID"] 3911 reader-capability = "READER" *(WS reader-option) 3912 reader-option = "POST" / "LISTGROUP" ; each to appear at most once 3913 version-capability = "VERSION" 1*(WS version-number) 3914 version-number = nzDIGIT *5DIGIT 3916 9.5 LIST variants 3918 This section defines more specifically the keywords for the LIST 3919 command and the syntax of the corresponding responses. 3921 ; active 3922 list-arguments =/ "ACTIVE" [WS wildmat] 3923 list-response =/ list-active-response 3924 list-active-response = newgroups-response 3926 ; active.times 3927 list-arguments =/ "ACTIVE.TIMES" [WS wildmat] 3928 list-response =/ list-active-times-response 3929 list-active-times-response = 3930 *(newsgroup-name SPA 1*DIGIT SPA newsgroup-creator CRLF) 3931 newsgroup-creator = U-TEXT 3933 ; distrib.pats 3934 list-arguments =/ "DISTRIB.PATS" 3935 list-response =/ list-distrib-pats-response 3936 list-distrib-pats-response = 3937 *(1*DIGIT ":" wildmat ":" distribution CRLF) 3938 distribution = token 3940 ; headers 3941 list-arguments =/ "HEADERS" [WS ("MSGID" / "RANGE")] 3942 list-response =/ list-headers-response 3943 list-headers-response = *(header-meta-name CRLF) / 3944 *((metadata-name / ":") CRLF) 3946 ; newsgroups 3947 list-arguments =/ "NEWSGROUPS" [WS wildmat] 3948 list-response =/ list-newsgroups-response 3949 list-newsgroups-response = 3950 *(newsgroup-name WS newsgroup-description CRLF) 3951 newsgroup-description = S-TEXT 3953 ; overview.fmt 3954 list-arguments =/ "OVERVIEW.FMT" 3955 list-response =/ list-overview-fmt-response 3956 list-overview-fmt-response = "Subject:" CRLF 3957 "From:" CRLF 3958 "Date:" CRLF 3959 "Message-ID:" CRLF 3960 "References:" CRLF 3961 ( ":bytes" CRLF ":lines" / "Bytes:" CRLF "Lines:") CRLF 3962 *((header-name ":full" / metadata-name) CRLF) 3964 9.6 Articles 3966 This syntax defines the non-terminal
, which represents the 3967 format of an article as described in Section 3.6. 3969 article = 1*header CRLF body 3970 header = header-name ":" [CRLF] SP header-content CRLF 3971 header-content = *(S-CHAR / [CRLF] WS) 3972 body = *(*B-CHAR CRLF) 3974 9.7 General non-terminals 3976 These non-terminals are used at various places in the syntax and are 3977 collected here for convenience. A few of these non-terminals are not 3978 used in this specification but are provided for the consistency and 3979 convenience of extension authors. 3981 article-number = 1*16DIGIT 3982 content-lines = *([content-text] CRLF) 3983 content-text = (".." / B-NONDOT) *B-CHAR 3984 header-name = 1*A-NOTCOLON 3985 keyword = ALPHA 2*11(ALPHA / DIGIT / "." / "-") 3986 message-id = "<" 1*248A-NOTGT ">" 3987 newsgroup-name = 1*wildmat-exact 3988 termination = "." CRLF 3989 token = 1*P-CHAR 3991 wildmat = wildmat-pattern *("," ["!"] wildmat-pattern) 3992 wildmat-pattern = 1*wildmat-item 3993 ; must not begin with "!" if not immediately preceded by "!" 3994 wildmat-item = wildmat-exact / wildmat-wild 3995 wildmat-exact = %x21-29 / %x2B / %x2D-3E / %x40-5A / %x5E-7E / 3996 UTF8-non-ascii ; exclude * , ? [ \ ] 3997 wildmat-wild = "*" / "?" 3999 base64 = *(4base64-char) [base64-terminal] 4000 base64-char = UPPER / LOWER / DIGIT / "+" / "/" 4001 base64-terminal = 2base64-char "==" / 3base64-char "=" 4003 ; Assorted special character sets 4004 ; A- means based on US-ASCII, excluding controls and SP 4005 ; P- means based on UTF-8, excluding controls and SP 4006 ; U- means based on UTF-8, excluding NUL CR and LF 4007 ; B- means based on bytes, excluding NUL CR and LF 4008 A-CHAR = %x21-7E 4009 A-NOTCOLON = %x21-39 / %x3B-7E ; exclude ":" 4010 A-NOTGT = %x21-3D / %x3F-7E ; exclude ">" 4011 P-CHAR = A-CHAR / UTF8-non-ascii 4012 U-CHAR = CTRL / TAB / SP / A-CHAR / UTF8-non-ascii 4013 U-NONTAB = CTRL / SP / A-CHAR / UTF8-non-ascii 4014 U-TEXT = P-CHAR *U-CHAR 4015 B-CHAR = CTRL / TAB / SP / %x21-FF 4016 B-NONDOT = CTRL / TAB / SP / %x21-2D / %x2F-FF ; exclude "." 4018 ALPHA = UPPER / LOWER ; use only when case-insensitive 4019 CR = %x0D 4020 CRLF = CR LF 4021 CTRL = %x01-08 / %x0B-0C / %x0E-1F 4022 DIGIT = %x30-39 4023 nzDIGIT = %x31-39 4024 EOL = *(SP / TAB) CRLF 4025 LF = %x0A 4026 LOWER = %x61-7A 4027 SP = %x20 4028 SPA = 1*SP 4029 TAB = %x09 4030 UPPER = %x41-5A 4031 UTF8-non-ascii = UTF8-2 / UTF8-3 / UTF8-4 4032 UTF8-2 = %xC2-DF UTF8-tail 4033 UTF8-3 = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2UTF8-tail / 4034 %xED %x80-9F UTF8-tail / %xEE-EF 2UTF8-tail 4035 UTF8-4 = %xF0 %x90-BF 2UTF8-tail / %xF1-F3 3UTF8-tail / 4036 %xF4 %x80-8F 2UTF8-tail 4037 UTF8-tail = %x80-BF 4038 WS = 1*(SP / TAB) 4040 The following non-terminals require special consideration. They 4041 represent situations where material SHOULD be restricted to UTF-8, 4042 but implementations MUST be able to cope with other character 4043 encodings. Therefore there are two sets of definitions for them. 4045 Implementations MUST accept any content that meets this syntax: 4047 S-CHAR = %x21-FF 4048 S-NONTAB = CTRL / SP / S-CHAR 4049 S-TEXT = (CTRL / S-CHAR) *B-CHAR 4051 Implementations SHOULD only generate content that meets this syntax: 4053 S-CHAR = P-CHAR 4054 S-NONTAB = U-NONTAB 4055 S-TEXT = U-TEXT 4057 9.8 Extensions and Validation 4059 The specification of a registered extension MUST include formal 4060 syntax that defines additional forms for the following non-terminals: 4062 command 4063 for each new command other than a variant of the LIST command - 4064 the syntax of each command MUST be compatible with the definition 4065 of ; 4067 command-datastream 4068 for each new command that immediately streams data; 4069 command-continuation 4070 for each new command that sends further material after the initial 4071 command line - the syntax of each continuation MUST be exactly 4072 what is sent to the server, including any escape mechanisms such 4073 as "byte-stuffing"; 4074 simple-response-content 4075 for each new response code that has arguments - the syntax of each 4076 response MUST be compatible with the definition of 4077 ; 4078 multiline-response-content 4079 for each new response code that has a multi-line response - the 4080 syntax MUST show the response after the lines containing the 4081 response code and the terminating octet have been removed and any 4082 "byte-stuffing" undone; 4083 capability-entry 4084 for each new capability label - the syntax of each entry MUST be 4085 compatible with the definition of ; 4086 list-arguments 4087 for each new variant of the LIST command - the syntax of each 4088 entry MUST be compatible with the definition of ; 4089 list-response 4090 for each new variant of the LIST command - the syntax MUST show 4091 the response after the lines containing the 215 response code and 4092 the terminating octet have been removed and any "byte-stuffing" 4093 undone. 4095 The =/ notation of ABNF [RFC2234] SHOULD be used for this. 4097 When validating the syntax in this specification, or syntax based on 4098 it, it should be noted that: 4099 o the non-terminals , , 4100 , , and 4101 describe basic concepts of the 4102 protocol and are not referred to by any other rule; 4103 o the non-terminal is provided for the convenience of 4104 extension authors and is not referred to by any rule in this 4105 specification; 4106 o for the reasons given above, the non-terminals , 4107 , and each have two definitions; 4108 o the non-terminal is deliberately not defined. 4110 10. IANA Considerations 4112 This specification requires IANA to keep a registry of capability 4113 labels. The initial contents of this registry are specified in 4114 Section 3.3.4. As described in Section 3.3.3, labels beginning with 4115 X are reserved for private use while all other names are expected to 4116 be associated with a specification in an RFC on the standards-track 4117 or defining an IESG-approved experimental protocol. 4119 Different entries in the registry MUST use different capability 4120 labels. 4122 Different entries in the registry MUST NOT use the same command name. 4123 For this purpose, variants distinguished by a second or subsequent 4124 keyword (e.g. "LIST HEADERS" and "LIST OVERVIEW.FMT") count as 4125 different commands. If there is a need for two extensions to use the 4126 same command, a single harmonised specification MUST be registered. 4128 11. Security Considerations 4130 This section is meant to inform application developers, information 4131 providers, and users of the security limitations in NNTP as described 4132 by this document. The discussion does not include definitive 4133 solutions to the problems revealed, though it does make some 4134 suggestions for reducing security risks. 4136 11.1 Personal and Proprietary Information 4138 NNTP, because it was created to distribute network news articles, 4139 will forward whatever information is stored in those articles. 4140 Specification of that information is outside this scope of this 4141 document, but it is likely that some personal and/or proprietary 4142 information is available in some of those articles. It is very 4143 important that designers and implementers provide informative 4144 warnings to users so personal and/or proprietary information in 4145 material that is added automatically to articles (e.g. in headers) 4146 is not disclosed inadvertently. Additionally, effective and easily 4147 understood mechanisms to manage the distribution of news articles 4148 SHOULD be provided to NNTP Server administrators, so that they are 4149 able to report with confidence the likely spread of any particular 4150 set of news articles. 4152 11.2 Abuse of Server Log Information 4154 A server is in the position to save session data about a user's 4155 requests that might identify their reading patterns or subjects of 4156 interest. This information is clearly confidential in nature and its 4157 handling can be constrained by law in certain countries. People 4158 using the NNTP protocol to provide data are responsible for ensuring 4159 that such material is not distributed without the permission of any 4160 individuals that are identifiable by the published results. 4162 11.3 Weak Authentication and Access Control 4164 There is no user-based or token-based authentication in the basic 4165 NNTP specification. Access is normally controlled by server 4166 configuration files. Those files specify access by using domain 4167 names or IP addresses. However, this specification does permit the 4168 creation of extensions to the NNTP protocol itself for such purposes; 4169 one such extension is [NNTP-AUTH]. While including such mechanisms 4170 is optional, doing so is strongly encouraged. 4172 Other mechanisms are also available. For example, a proxy server 4173 could be put in place that requires authentication before connecting 4174 via the proxy to the NNTP server. 4176 11.4 DNS Spoofing 4178 Many existing NNTP implementations authorize incoming connections by 4179 checking the IP address of that connection against the IP addresses 4180 obtained via DNS lookups of lists of domain names given in local 4181 configuration files. Servers that use this type of authentication, 4182 and clients that find a server by doing a DNS lookup of the server 4183 name, rely very heavily on the Domain Name Service, and are thus 4184 generally prone to security attacks based on the deliberate 4185 misassociation of IP addresses and DNS names. Clients and servers 4186 need to be cautious in assuming the continuing validity of an IP 4187 number/DNS name association. 4189 In particular, NNTP clients and servers SHOULD rely on their name 4190 resolver for confirmation of an IP number/DNS name association, 4191 rather than caching the result of previous host name lookups. Many 4192 platforms already can cache host name lookups locally when 4193 appropriate, and they SHOULD be configured to do so. It is proper 4194 for these lookups to be cached, however, only when the TTL (Time To 4195 Live) information reported by the name server makes it likely that 4196 the cached information will remain useful. 4198 If NNTP clients or servers cache the results of host name lookups in 4199 order to achieve a performance improvement, they MUST observe the TTL 4200 information reported by DNS. If NNTP clients or servers do not 4201 observe this rule, they could be spoofed when a previously accessed 4202 server's IP address changes. As network renumbering is expected to 4203 become increasingly common, the possibility of this form of attack 4204 will grow. Observing this requirement thus reduces this potential 4205 security vulnerability. 4207 This requirement also improves the load-balancing behaviour of 4208 clients for replicated servers using the same DNS name and reduces 4209 the likelihood of a user's experiencing failure in accessing sites 4210 that use that strategy. 4212 11.5 UTF-8 issues 4214 UTF-8 [RFC3629] permits only certain sequences of octets and 4215 designates others as either malformed or "illegal". The Unicode 4216 standard identifies a number of security issues related to illegal 4217 sequences and forbids their generation by conforming implementations. 4219 Implementations of this specification MUST NOT generate malformed or 4220 illegal sequences and SHOULD detect them and take some appropriate 4221 action. This could include: 4222 o generating a 501 response code. 4224 o replacing such sequences by the sequence %xEF.BF.BD, which encodes 4225 the "replacement character" U+FFFD; 4226 o closing the connection; 4227 o replacing such sequences by a "guessed" valid sequence (based on 4228 properties of the UTF-8 encoding); 4229 In the last case, the implementation MUST ensure that any replacement 4230 cannot be used to bypass validity or security checks. For example, 4231 the illegal sequence %xC0.A0 is an over-long encoding for space 4232 (%x20). If it is replaced by the latter in a command line, this 4233 needs to happen before the command line is parsed into individual 4234 arguments. If the replacement came after parsing, it would be 4235 possible to generate an argument with an embedded space, which is 4236 forbidden. Use of the "replacement character" does not have this 4237 problem, since it is permitted wherever non-US-ASCII characters are. 4238 Implementations SHOULD use one of the first two solutions where the 4239 general structure of the NNTP stream remains intact, and close the 4240 connection if it is no longer possible to parse it sensibly. 4242 11.6 Caching of capability lists 4244 The CAPABILITIES command provides a capability list, which is 4245 information about the current capabilities of the server. Whenever 4246 there is a relevant change to the server state, the results of this 4247 command are required to change accordingly. 4249 In most situations the capabilities list in a given server state will 4250 not change from session to session; for example, a given extension 4251 will be installed permanently on a server. Some clients may 4252 therefore wish to remember which extensions a server supports to 4253 avoid the delay of an additional command and response, particularly 4254 if they open multiple connections in the same session. 4256 However, information about extensions related to security and privacy 4257 MUST NOT be cached, since this could allow a variety of attacks. 4259 For example, consider a server which permits the use of cleartext 4260 passwords on links that are encrypted but not otherwise: 4261 [Initial TCP connection set-up completed.] 4262 [S] 200 NNTP Service Ready, posting permitted 4263 [C] CAPABILITIES 4264 [S] 101 Capability list: 4265 [S] VERSION 2 4266 [S] READER POST 4267 [S] XENCRYPT 4268 [S] LIST ACTIVE NEWSGROUPS 4269 [S] . 4270 [C] XENCRYPT 4271 [Client and server negotiate encryption on the link] 4273 [S] 283 Encrypted link established 4274 [C] CAPABILITIES 4275 [S] 101 Capability list: 4276 [S] VERSION 2 4277 [S] READER POST 4278 [S] XSECRET 4279 [S] LIST ACTIVE NEWSGROUPS 4280 [S] . 4281 [C] XSECRET fred flintstone 4282 [S] 290 Password for fred accepted 4284 If the client caches the last capabilities list, then on the next 4285 session it will attempt to use XSECRET on an unencrypted link: 4286 [Initial TCP connection set-up completed.] 4287 [S] 200 NNTP Service Ready, posting permitted 4288 [C] XSECRET fred flintstone 4289 [S] 483 Only permitted on secure links 4290 exposing the password to any eavesdropper. While the primary cause 4291 of this is passing a secret without first checking the security of 4292 the link, caching of capability lists can increase the risk. 4294 Any security extension should include requirements to check the 4295 security state of the link in a manner appropriate to that extension. 4297 Caching should normally only be considered for anonymous clients that 4298 do not use any security or privacy extensions and for which the time 4299 required for an additional command and response is a noticeable 4300 issue. 4302 12. Acknowledgements 4304 This document is the result of much effort by the present and past 4305 members of the NNTP Working Group, chaired by Russ Allbery and Ned 4306 Freed. It could not have been produced without them. 4308 The author acknowledges the original authors of NNTP as documented in 4309 RFC 977 [RFC977]: Brian Kantor and Phil Lapsey. 4311 The author gratefully acknowledges: 4312 o The work of the NNTP committee chaired by Eliot Lear. The 4313 organization of this document was influenced by the last available 4314 draft from this working group. A special thanks to Eliot for 4315 generously providing the original machine-readable sources for 4316 that document. 4317 o The work of the DRUMS working group, specifically RFC 1869 4318 [RFC1869], which drove the original thinking which led to the 4319 CAPABILITIES command and the extensions mechanism detailed in this 4320 document. 4321 o The authors of RFC 2616 [RFC2616] for providing specific and 4322 relevant examples of security issues that should be considered for 4323 HTTP. Since many of the same considerations exist for NNTP, those 4324 examples that are relevant have been included here with some minor 4325 rewrites. 4326 o The comments and additional information provided by the following 4327 individuals in preparing one or more of the progenitors of this 4328 document: 4329 Russ Allbery 4330 Wayne Davison 4331 Chris Lewis 4332 Tom Limoncelli 4333 Eric Schnoebelen 4334 Rich Salz 4336 This work was motivated by the work of various news reader authors 4337 and news server authors, which includes those listed below: 4339 Rick Adams 4340 Original author of the NNTP extensions to the RN news reader and 4341 last maintainer of Bnews 4342 Stan Barber 4343 Original author of the NNTP extensions to the news readers that 4344 are part of Bnews 4345 Geoff Collyer 4346 Original author of the OVERVIEW database proposal and one of the 4347 original authors of CNEWS 4349 Dan Curry 4350 Original author of the xvnews news reader 4351 Wayne Davison 4352 Author of the first threading extensions to the RN news reader 4353 (commonly called TRN) 4354 Geoff Huston 4355 Original author of ANU NEWS 4356 Phil Lapsey 4357 Original author of the UNIX reference implementation for NNTP 4358 Iain Lea 4359 Original maintainer of the TIN news reader 4360 Chris Lewis 4361 First known implementer of the AUTHINFO GENERIC extension 4362 Rich Salz 4363 Original author of INN 4364 Henry Spencer 4365 One of the original authors of CNEWS 4366 Kim Storm 4367 Original author of the NN news reader 4369 Other people who contributed to this document include: 4371 Matthias Andree 4372 Greg Andruk 4373 Maurizio Codogno 4374 Mark Crispin 4375 Andrew Gierth 4376 Juergen Helbing 4377 Scott Hollenbeck 4378 Charles Lindsey 4379 Ade Lovett 4380 Ken Murchison 4381 Francois Petillon 4382 Peter Robinson 4383 Rob Siemborski 4384 Howard Swinehart 4385 Ruud van Tol 4386 Jeffrey Vinocur 4388 The author thanks them all and apologises to anyone omitted. 4390 Finally, the present author gratefully acknowledges the vast amount 4391 of work put into previous drafts by the previous author: 4392 Stan Barber 4394 13. References 4396 13.1 Normative References 4398 [ANSI1986] 4399 American National Standards Institute, "Coded Character 4400 Set - 7-bit American Standard Code for Information 4401 Interchange", ANSI X3.4, 1986. 4403 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 4404 Requirement Levels", BCP 14, RFC 2119, March 1997. 4406 [RFC2234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 4407 Specifications: ABNF", RFC 2234, November 1997. 4409 [RFC3548] Josefsson, S., "The Base16, Base32, and Base64 Data 4410 Encodings", RFC 3548, July 2003. 4412 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 4413 10646", STD 63, RFC 3629, November 2003. 4415 [RFC977] Kantor, B. and P. Lapsley, "Network News Transfer 4416 Protocol", RFC 977, February 1986. 4418 [TF.686-1] 4419 International Telecommunications Union - Radio, "Glossary, 4420 ITU-R Recommendation TF.686-1", ITU-R Recommendation 4421 TF.686-1, October 1997. 4423 13.2 Informative References 4425 [NNTP-AUTH] 4426 Vinocur, J., Murchison, K. and C. Newman, "NNTP 4427 Authentication", 4428 Internet-draft draft-ietf-nntpext-authinfo-06, December 4429 2004. 4431 [NNTP-STREAM] 4432 Vinocur, J. and K. Murchison, "NNTP Authentication", 4433 Internet-draft draft-ietf-nntpext-streaming-03, December 4434 2004. 4436 [NNTP-TLS] 4437 Vinocur, J., Murchison, K. and C. Newman, "Using TLS with 4438 NNTP", Internet-draft draft-ietf-nntpext-tls-nntp-04, 4439 December 2004. 4441 [RFC1036] Horton, M. and R. Adams, "Standard for interchange of 4442 USENET messages", RFC 1036, December 1987. 4444 [RFC1305] Mills, D., "Network Time Protocol (Version 3) 4445 Specification, Implementation", RFC 1305, March 1992. 4447 [RFC1869] Klensin, J., Freed, N., Rose, M., Stefferud, E. and D. 4448 Crocker, "SMTP Service Extensions", STD 10, RFC 1869, 4449 November 1995. 4451 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Nielsen, H., 4452 Masinter, L., Leach, P. and T. Berners-Lee, "Hypertext 4453 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 4455 [RFC2629] Rose, M., "Writing I-Ds and RFCs using XML", RFC 2629, 4456 June 1999. 4458 [RFC2822] Resnick, P., "Internet Message Format", RFC 2822, April 4459 2001. 4461 [RFC2980] Barber, S., "Common NNTP Extensions", RFC 2980, October 4462 2000. 4464 [ROBE1995] 4465 Robertson, R., "FAQ: Overview database / NOV General 4466 Information", January 1995. 4468 There is no definitive copy of this document known to the 4469 author. It was previously posted as the Usenet article 4470 4472 [SALZ1992] 4473 Salz, R., "Manual Page for wildmat(3) from the INN 1.4 4474 distribution, Revision 1.10", April 1992. 4476 There is no definitive copy of this document known to the 4477 author. 4479 Author's Address 4481 Clive D.W. Feather 4482 Thus plc 4483 322 Regents Park Road 4484 London N3 2QQ 4485 GB 4487 Phone: +44 20 8495 6138 4488 Fax: +44 870 051 9937 4489 Email: clive@demon.net 4490 URI: http://www.davros.org/ 4492 Appendix A. Interaction with other specifications 4494 NNTP is most often used for transferring articles that conform to RFC 4495 1036 [RFC1036] (such articles are called "Netnews articles" here). 4496 It is also sometimes used for transferring email messages that 4497 conform to RFC 2822 [RFC2822] (such articles are called "email 4498 articles" here). In this situation, articles must conform both to 4499 this specification and to that other one; this appendix describes 4500 some relevant issues. 4502 A.1 Header folding 4504 NNTP allows a header line to be folded (by inserting a CRLF pair) 4505 before any space or TAB character. 4507 Both email and Netnews articles are required to have at least one 4508 octet other than space or TAB on each header line. Thus folding can 4509 only happen at one point in each sequence of consecutive spaces or 4510 TABs. Netnews articles are further required to have the header name, 4511 colon, and following space all on the first line; folding may only 4512 happen beyond that space. Finally, some non-conforming software will 4513 remove trailing spaces and TABs from a line. Therefore it might be 4514 inadvisable to fold a header after a space or TAB. 4516 For maximum safety, header lines SHOULD conform to the following 4517 syntax rather than that in Section 9.6. 4519 header = header-name ":" SP [header-content] CRLF 4520 header-content = [WS] token *( [CRLF] WS token ) 4522 A.2 Message-IDs 4524 Every article handled by an NNTP server MUST have a unique 4525 message-id. For the purposes of this specification, a message-id is 4526 an arbitrary opaque string that merely needs to meet certain 4527 syntactic requirements and is just a way to refer to the article. 4529 Because there is a significant risk of old articles being reinjected 4530 into the global Usenet system, RFC 1036 [RFC1036] requires that 4531 message-ids are globally unique for all time. 4533 This specification states that message-ids are the same if and only 4534 if they consist of the same sequence of octets. Other specifications 4535 may define two different sequences as being equal because they are 4536 putting an interpretation on particular characters. RFC 2822 4537 [RFC2822] has a concept of "quoted" and "escaped" characters. It 4538 therefore considers the three message-ids: 4540 4541 <"abcd"@example.com> 4542 <"ab\cd"@example.com> 4543 as being identical. Therefore an NNTP implementation handing email 4544 articles must ensure that only one of these three appears in the 4545 protocol and the other two are converted to it as and when necessary, 4546 such as when a client checks the results of a NEWNEWS command against 4547 an internal database of message-ids. Note that RFC 1036 [RFC1036] 4548 never treats two different strings as being identical. Its draft 4549 successor restricts the syntax of message-ids so that, whenever RFC 4550 2822 would treat two strings as equivalent, only one of them is valid 4551 (in the above example only the first string is valid). 4553 This specification does not describe how the message-id of an article 4554 is determined; it may be deduced from the contents of the article or 4555 derived from some external source. If the server is also conforming 4556 to another specification that contains a definition of message-id 4557 compatible with this one, the server SHOULD use those message-ids. A 4558 common approach, and one that SHOULD be used for email and Netnews 4559 articles, is to extract the message-id from the contents of a header 4560 with name "Message-ID". This may not be as simple as copying the 4561 entire header contents; it may be necessary to strip off comments and 4562 undo quoting, or to reduce "equivalent" message-ids to a canonical 4563 form. 4565 If an article is obtained through the IHAVE command, there will be a 4566 message-id provided with the command. The server MAY either use it 4567 or determine one from the article contents. However, whichever it 4568 does it SHOULD ensure that, if the IHAVE command is repeated with the 4569 same argument and article, it will be recognized as a duplicate. 4571 If an article does not contain a message-id that the server can 4572 identify, it MUST synthesize one. This could, for example, be a 4573 simple sequence number or based on the date and time that the article 4574 arrived. When handling email or Netnews articles, a Message-ID 4575 header SHOULD be added to ensure global consistency and uniqueness. 4577 A.3 Article posting 4579 As far as NNTP is concerned, the POST and IHAVE commands provide the 4580 same basic facilities in a slightly different way. However they have 4581 rather different intentions. 4583 The IHAVE command is intended for transmitting conforming articles 4584 between a system of NNTP servers, with all articles perhaps also 4585 conforming to another specification (e.g. all articles are Netnews 4586 articles). It is expected that the client will have already done any 4587 necessary validation (or has in turn obtained the article from a 4588 third party which has done so); therefore the contents SHOULD be left 4589 unchanged. 4591 In contrast, the POST command is intended for use when an end-user is 4592 injecting a newly-created article into a such a system. The article 4593 being transferred might not be a conforming email or Netnews article, 4594 and the server is expected to validate it and, if necessary, convert 4595 it to the right form for onward distribution. This is often done by 4596 a separate piece of software on the server installation; if so, the 4597 NNTP server SHOULD pass the incoming article to that software 4598 unaltered, making no attempt to filter characters, fold or limit 4599 lines, or otherwise process the incoming text. 4601 The POST command can fail in various ways and clients should be 4602 prepared to re-send an article. When doing so, however, it is often 4603 important to ensure - as far as possible - that the same message-id 4604 is allocated to both attempts so that the server, or other servers, 4605 can recognize the two articles as being duplicates. In the case of 4606 email or Netnews articles, therefore, the posted article SHOULD 4607 contain a header with name "Message-ID" and the contents of this 4608 header SHOULD be identical on each attempt. The server SHOULD ensure 4609 that two POSTed articles with the same contents for this header are 4610 recognized as identical and the same message-id allocated, whether or 4611 not those contents are suitable for use as the message-id. 4613 Appendix B. Summary of Commands 4615 This section contains a list of every command defined in this 4616 document, ordered by command name and by indicating capability. 4618 Ordered by command name: 4620 +-------------------+-----------------------+---------------+ 4621 | Command | Indicating capability | Definition | 4622 +-------------------+-----------------------+---------------+ 4623 | ARTICLE | READER | Section 6.2.1 | 4624 | | | | 4625 | BODY | READER | Section 6.2.3 | 4626 | | | | 4627 | CAPABILITIES | mandatory | Section 5.2 | 4628 | | | | 4629 | DATE | READER | Section 7.1 | 4630 | | | | 4631 | GROUP | READER | Section 6.1.1 | 4632 | | | | 4633 | HDR | HDR | Section 8.5 | 4634 | | | | 4635 | HEAD | mandatory | Section 6.2.2 | 4636 | | | | 4637 | HELP | mandatory | Section 7.2 | 4638 | | | | 4639 | IHAVE | IHAVE | Section 6.3.2 | 4640 | | | | 4641 | LAST | READER | Section 6.1.3 | 4642 | | | | 4643 | LIST | LIST | Section 7.6.1 | 4644 | | | | 4645 | LIST ACTIVE.TIMES | LIST | Section 7.6.4 | 4646 | | | | 4647 | LIST ACTIVE | LIST | Section 7.6.3 | 4648 | | | | 4649 | LIST DISTRIB.PATS | LIST | Section 7.6.5 | 4650 | | | | 4651 | LIST HEADERS | HDR | Section 8.6 | 4652 | | | | 4653 | LIST NEWSGROUPS | LIST | Section 7.6.6 | 4654 | | | | 4655 | LIST OVERVIEW.FMT | OVER | Section 8.4 | 4656 | | | | 4657 | LISTGROUP | READER LISTGROUP | Section 6.1.2 | 4658 | | | | 4659 | MODE READER | MODE-READER | Section 5.3 | 4660 | | | | 4661 | NEWGROUPS | READER | Section 7.3 | 4662 | | | | 4663 | NEWNEWS | READER | Section 7.4 | 4664 | | | | 4665 | NEXT | READER | Section 6.1.4 | 4666 | | | | 4667 | OVER | OVER | Section 8.3 | 4668 | | | | 4669 | POST | READER POST | Section 6.3.1 | 4670 | | | | 4671 | QUIT | mandatory | Section 5.4 | 4672 | | | | 4673 | STAT | mandatory | Section 6.2.4 | 4674 +-------------------+-----------------------+---------------+ 4676 Ordered by indicating capability: 4678 +-------------------+-----------------------+---------------+ 4679 | Command | Indicating capability | Definition | 4680 +-------------------+-----------------------+---------------+ 4681 | CAPABILITIES | mandatory | Section 5.2 | 4682 | | | | 4683 | HEAD | mandatory | Section 6.2.2 | 4684 | | | | 4685 | HELP | mandatory | Section 7.2 | 4686 | | | | 4687 | QUIT | mandatory | Section 5.4 | 4688 | | | | 4689 | STAT | mandatory | Section 6.2.4 | 4690 | | | | 4691 | HDR | HDR | Section 8.5 | 4692 | | | | 4693 | LIST HEADERS | HDR | Section 8.6 | 4694 | | | | 4695 | IHAVE | IHAVE | Section 6.3.2 | 4696 | | | | 4697 | LIST | LIST | Section 7.6.1 | 4698 | | | | 4699 | LIST ACTIVE | LIST | Section 7.6.3 | 4700 | | | | 4701 | LIST ACTIVE.TIMES | LIST | Section 7.6.4 | 4702 | | | | 4703 | LIST DISTRIB.PATS | LIST | Section 7.6.5 | 4704 | | | | 4705 | LIST NEWSGROUPS | LIST | Section 7.6.6 | 4706 | | | | 4707 | MODE READER | MODE-READER | Section 5.3 | 4708 | | | | 4709 | OVER | OVER | Section 8.3 | 4710 | | | | 4711 | LIST OVERVIEW.FMT | OVER | Section 8.4 | 4712 | | | | 4713 | ARTICLE | READER | Section 6.2.1 | 4714 | | | | 4715 | BODY | READER | Section 6.2.3 | 4716 | | | | 4717 | DATE | READER | Section 7.1 | 4718 | | | | 4719 | GROUP | READER | Section 6.1.1 | 4720 | | | | 4721 | LAST | READER | Section 6.1.3 | 4722 | | | | 4723 | NEWGROUPS | READER | Section 7.3 | 4724 | | | | 4725 | NEWNEWS | READER | Section 7.4 | 4726 | | | | 4727 | NEXT | READER | Section 6.1.4 | 4728 | | | | 4729 | LISTGROUP | READER LISTGROUP | Section 6.1.2 | 4730 | | | | 4731 | POST | READER POST | Section 6.3.1 | 4732 +-------------------+-----------------------+---------------+ 4734 Where two keywords are given in the capability column, the second is 4735 an argument to the first. 4737 Appendix C. Summary of Response Codes 4739 This section contains a list of every response code defined in this 4740 document, whether it is multi-line, which commands can generate it, 4741 what arguments it has, and what its meaning is. 4743 Response code 100 (multi-line) 4744 Generated by: HELP 4745 Meaning: help text follows. 4746 Response code 101 (multi-line) 4747 Generated by: CAPABILITIES 4748 Meaning: capabilities list follows. 4749 Response code 111 4750 Generated by: DATE 4751 1 argument: yyyymmddhhmmss 4752 Meaning: server date and time. 4753 Response code 200 4754 Generated by: initial connection, MODE READER 4755 Meaning: service available, posting allowed. 4756 Response code 201 4757 Generated by: initial connection, MODE READER 4758 Meaning: service available, posting prohibited. 4759 Response code 205 4760 Generated by: QUIT 4761 Meaning: connection closing (the server immediately closes the 4762 connection). 4763 Response code 211 4764 The 211 response code has two completely different forms depending 4765 on which command generated it: 4766 Generated by: GROUP 4767 4 arguments: number low high group 4768 Meaning: group selected. 4770 (multi-line) 4771 Generated by: LISTGROUP 4772 4 arguments: number low high group 4773 Meaning: article numbers follow. 4774 Response code 215 (multi-line) 4775 Generated by: LIST 4776 Meaning: information follows. 4777 Response code 220 (multi-line) 4778 Generated by: ARTICLE 4779 2 arguments: n message-id 4780 Meaning: article follows. 4781 Response code 221 (multi-line) 4782 Generated by: HEAD 4783 2 arguments: n message-id 4784 Meaning: article headers follow. 4786 Response code 222 (multi-line) 4787 Generated by: BODY 4788 2 arguments: n message-id 4789 Meaning: article body follows. 4790 Response code 223 4791 Generated by: LAST, NEXT, STAT 4792 2 arguments: n message-id 4793 Meaning: article exists and selected. 4794 Response code 224 (multi-line) 4795 Generated by: OVER 4796 Meaning: overview information follows. 4797 Response code 225 (multi-line) 4798 Generated by: HDR 4799 Meaning: headers follow. 4800 Response code 230 (multi-line) 4801 Generated by: NEWNEWS 4802 Meaning: list of new articles follows. 4803 Response code 231 (multi-line) 4804 Generated by: NEWGROUPS 4805 Meaning: list of new newsgroups follows. 4806 Response code 235 4807 Generated by: IHAVE (second stage) 4808 Meaning: article transferred OK. 4809 Response code 240 4810 Generated by: POST (second stage) 4811 Meaning: article received OK. 4812 Response code 335 4813 Generated by: IHAVE (first stage) 4814 Meaning: send article to be transferred. 4815 Response code 340 4816 Generated by: POST (first stage) 4817 Meaning: send article to be posted. 4818 Response code 400 4819 Generic response and generated by initial connection 4820 Meaning: service not available or no longer available (the server 4821 immediately closes the connection). 4822 Response code 401 4823 Generic response 4824 1 argument: capability-label 4825 Meaning: the server is in the wrong mode; the indicated capability 4826 should be used to change the mode. 4827 Response code 403 4828 Generic response 4829 Meaning: internal fault or problem preventing action being taken. 4830 Response code 411 4831 Generated by: GROUP, LISTGROUP 4832 Meaning: no such newsgroup. 4834 Response code 412 4835 Generated by: ARTICLE, BODY, HDR, HEAD, LAST, LISTGROUP, NEXT, 4836 OVER, STAT 4837 Meaning: no newsgroup selected. 4838 Response code 420 4839 Generated by: ARTICLE, BODY, HDR, HEAD, LAST, NEXT, OVER, STAT 4840 Meaning: current article number is invalid. 4841 Response code 421 4842 Generated by: NEXT 4843 Meaning: no next article in this group. 4844 Response code 422 4845 Generated by: LAST 4846 Meaning: no previous article in this group. 4847 Response code 423 4848 Generated by: ARTICLE, BODY, HDR, HEAD, OVER, STAT 4849 Meaning: no article with that number or in that range. 4850 Response code 430 4851 Generated by: ARTICLE, BODY, HDR, HEAD, OVER, STAT 4852 Meaning: no article with that message-id. 4853 Response code 435 4854 Generated by: IHAVE (first stage) 4855 Meaning: article not wanted. 4856 Response code 436 4857 Generated by: IHAVE (either stage) 4858 Meaning: transfer not possible (first stage) or failed (second 4859 stage); try again later. 4860 Response code 437 4861 Generated by: IHAVE (second stage) 4862 Meaning: transfer rejected; do not retry. 4863 Response code 440 4864 Generated by: POST (first stage) 4865 Meaning: posting not permitted. 4866 Response code 441 4867 Generated by: POST (second stage) 4868 Meaning: posting failed. 4869 Response code 480 4870 Generic response 4871 Meaning: command unavailable until the client has authenticated 4872 itself. 4873 Response code 483 4874 Generic response 4875 Meaning: command unavailable until suitable privacy has been 4876 arranged. 4877 Response code 500 4878 Generic response 4879 Meaning: unknown command. 4881 Response code 501 4882 Generic response 4883 Meaning: syntax error in command. 4884 Response code 502 4885 Generic response and generated by initial connection 4886 Meaning for the initial connection and the MODE READER command: 4887 service permanently unavailable (the server immediately closes the 4888 connection). 4889 Meaning for all other commands: command not permitted (and there 4890 is no way for the client to change this). 4891 Response code 503 4892 Generic response 4893 Meaning: feature not supported. 4894 Response code 504 4895 Generic response 4896 Meaning: error in base64-encoding [RFC3548] of an argument 4898 Intellectual Property Statement 4900 The IETF takes no position regarding the validity or scope of any 4901 Intellectual Property Rights or other rights that might be claimed to 4902 pertain to the implementation or use of the technology described in 4903 this document or the extent to which any license under such rights 4904 might or might not be available; nor does it represent that it has 4905 made any independent effort to identify any such rights. Information 4906 on the procedures with respect to rights in RFC documents can be 4907 found in BCP 78 and BCP 79. 4909 Copies of IPR disclosures made to the IETF Secretariat and any 4910 assurances of licenses to be made available, or the result of an 4911 attempt made to obtain a general license or permission for the use of 4912 such proprietary rights by implementers or users of this 4913 specification can be obtained from the IETF on-line IPR repository at 4914 http://www.ietf.org/ipr. 4916 The IETF invites any interested party to bring to its attention any 4917 copyrights, patents or patent applications, or other proprietary 4918 rights that may cover technology that may be required to implement 4919 this standard. Please address the information to the IETF at 4920 ietf-ipr@ietf.org. 4922 Disclaimer of Validity 4924 This document and the information contained herein are provided on an 4925 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS 4926 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET 4927 ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, 4928 INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE 4929 INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED 4930 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 4932 Copyright Statement 4934 Copyright (C) The Internet Society (2005). This document is subject 4935 to the rights, licenses and restrictions contained in BCP 78, and 4936 except as set forth therein, the authors retain all their rights. 4938 Acknowledgment 4940 Funding for the RFC Editor function is currently provided by the 4941 Internet Society.