RFC du protocole NNTP : specification


2. The NNTP Specification

2.1. Overview

   The news server specified by this document uses a stream connection
   (such as TCP) and SMTP-like commands and responses.  It is designed
   to accept connections from hosts, and to provide a simple interface
   to the news database.

   This server is only an interface between programs and the news
   databases. It does not perform any user interaction or presentation-
   level functions. These "user-friendly" functions are better left to
   the client programs, which have a better understanding of the
   environment in which they are operating.

   When used via Internet TCP, the contact port assigned for this
   service is 119.

2.2. Character Codes

   Commands and replies are composed of characters from the ASCII
   character set.  When the transport service provides an 8-bit byte
   (octet) transmission channel, each 7-bit character is transmitted
   right justified in an octet with the high order bit cleared to zero.

2.3. Commands

   Commands consist of a command word, which in some cases may be
   followed by a parameter.  Commands with parameters must separate the
   parameters from each other and from the command by one or more space
   or tab characters.  Command lines must be complete with all required
   parameters, and may not contain more than one command.

   Commands and command parameters are not case sensitive. That is, a
   command or parameter word may be upper case, lower case, or any
   mixture of upper and lower case.

   Each command line must be terminated by a CR-LF (Carriage Return -
   Line Feed) pair.

   Command lines shall not exceed 512 characters in length, counting all
   characters including spaces, separators, punctuation, and the
   trailing CR-LF (thus there are 510 characters maximum allowed for the
   command and its parameters).  There is no provision for continuation
   command lines.

2.4. Responses

   Responses are of two kinds, textual and status.

2.4.1. Text Responses

   Text is sent only after a numeric status response line has been sent
   that indicates that text will follow.  Text is sent as a series of
   successive lines of textual matter, each terminated with CR-LF pair.
   A single line containing only a period (.) is sent to indicate the
   end of the text (i.e., the server will send a CR-LF pair at the end
   of the last line of text, a period, and another CR-LF pair).

   If the text contained a period as the first character of the text
   line in the original, that first period is doubled.  Therefore, the
   client must examine the first character of each line received, and
   for those beginning with a period, determine either that this is the
   end of the text or whether to collapse the doubled period to a single
   one.

   The intention is that text messages will usually be displayed on the
   user's terminal whereas command/status responses will be interpreted
   by the client program before any possible display is done.

2.4.2. Status Responses

   These are status reports from the server and indicate the response to
   the last command received from the client.

   Status response lines begin with a 3 digit numeric code which is
   sufficient to distinguish all responses.  Some of these may herald
   the subsequent transmission of text.

   The first digit of the response broadly indicates the success,
   failure, or progress of the previous command.

      1xx - Informative message
      2xx - Command ok
      3xx - Command ok so far, send the rest of it.
      4xx - Command was correct, but couldn't be performed for
            some reason.
      5xx - Command unimplemented, or incorrect, or a serious
            program error occurred.

   The next digit in the code indicates the function response category.

      x0x - Connection, setup, and miscellaneous messages
      x1x - Newsgroup selection
      x2x - Article selection
      x3x - Distribution functions
      x4x - Posting
      x8x - Nonstandard (private implementation) extensions
      x9x - Debugging output

   The exact response codes that should be expected from each command
   are detailed in the description of that command.  In addition, below
   is listed a general set of response codes that may be received at any
   time.

   Certain status responses contain parameters such as numbers and
   names. The number and type of such parameters is fixed for each
   response code to simplify interpretation of the response.

   Parameters are separated from the numeric response code and from each
   other by a single space. All numeric parameters are decimal, and may
   have leading zeros. All string parameters begin after the separating
   space, and end before the following separating space or the CR-LF
   pair at the end of the line. (String parameters may not, therefore,
   contain spaces.) All text, if any, in the response which is not a
   parameter of the response must follow and be separated from the last
   parameter by a space.  Also, note that the text following a response
   number may vary in different implementations of the server. The
   3-digit numeric code should be used to determine what response was
   sent.

   Response codes not specified in this standard may be used for any
   installation-specific additional commands also not specified. These
   should be chosen to fit the pattern of x8x specified above.  (Note
   that debugging is provided for explicitly in the x9x response codes.)
   The use of unspecified response codes for standard commands is
   prohibited.

   We have provided a response pattern x9x for debugging.  Since much
   debugging output may be classed as "informative messages", we would
   expect, therefore, that responses 190 through 199 would be used for
   various debugging outputs.  There is no requirement in this
   specification for debugging output, but if such is provided over the
   connected stream, it must use these response codes.  If appropriate
   to a specific implementation, other x9x codes may be used for
   debugging.  (An example might be to use e.g., 290 to acknowledge a
   remote debugging request.)

2.4.3. General Responses

   The following is a list of general response codes that may be sent by
   the NNTP server.  These are not specific to any one command, but may
   be returned as the result of a connection, a failure, or some unusual
   condition.

   In general, 1xx codes may be ignored or displayed as desired;  code
   200 or 201 is sent upon initial connection to the NNTP server
   depending upon posting permission; code 400 will be sent when the
   NNTP server discontinues service (by operator request, for example);
   and 5xx codes indicate that the command could not be performed for
   some unusual reason.

      100 help text
      190
        through
      199 debug output

      200 server ready - posting allowed
      201 server ready - no posting allowed

      400 service discontinued

      500 command not recognized
      501 command syntax error
      502 access restriction or permission denied
      503 program fault - command not performed