ietf-nntp Response codes - generic

Clive D.W. Feather clive at demon.net
Tue Aug 15 11:44:31 PDT 2000


Near the end of section 4, the present text reads:

> A server MUST respond to an unrecognized, unimplemented, or
> syntactically invalid command with a negative response code
> (status indicators of the form 5XX).  For unrecognized
> commands, the 500 response code MUST be returned. This
> includes servers that have not implemented the optional
> extensions outlined later in this memo. For recognized
> commands where the syntax is wrong, the 501 response code MUST
> be returned. A server MUST respond to a command issued when 
> the session is in an incorrect state by responding with a 
> negative status indicator. This may be from either the 4XX or 
> 5XX group as appropriate.

I have proposed the following text to replace this (it's moved within the
section as well, but that's not important):

! A server MUST respond to an unrecognized, unimplemented, or
! invalid command with a negative response code as follows. An
! unrecognised command, or an optional command or extension that
! is not implemented by the server, MUST be given a 500 response.
! A syntax error in a recognised command MUST be given a 501
! response. A command that is valid but not permitted because of
! the current internal state of the server MUST be given a 4XX or
! 5XX response.

With both of these the last sentence is ambiguous. As read, it means that
the server can give any code from 400 to 599 to mean "not permitted", and
it doesn't mean that the code used has to be documented elsewhere. All the
opinions I have read say that this was not the intention.

In practice, many commands use 502 to mean "not permitted at present" and
503 to mean "not supported in this implementation". There's also a need for
generic codes for "service about to break", "can't provide this right now",
and "something went wrong in the server". The only 40x codes in the draft
are:
    400 greeting and MODE READER meaning "service temporarily unavailable"
    400 LIST EXTENSIONS "service no longer available"
    402 LIST EXTENSIONS meaning "no extensions"

I would therefore suggest that we reword this area to provide a set of
generic responses which could be returned by any command. The set I would
define are:

    400 service temporarily unavailable (TCP connection is then closed)
    401 service about to shut down temporarily
    403 facility temporarily unavailable
    500 unrecognised command
    501 syntax error in command
    502 not authorised
    503 optional feature not supported

Here's how I would reword my text and the following sentence, which
currently reads:

! Each recognised command MUST return 501 (as above) or one of the
! response codes specifically listed in its description or in an
! extension.

(1) Replace the quoted text with:

! An unrecognised command, or an optional command or extension that
! is not implemented by the server, MUST be given a 500 response.
! If the command is recognised, the server MUST give either one of the
! generic responses listed in section 4.1.1 or else one of the responses
! listed in the description of that command.

This is then followed - in a new paragraph - by the text that begins:

  A server MAY provide extensions to this specification,

(2) Add a new section 4.1.1:

+ 4.1.1 Generic response codes
+ 
+ The server MUST respond to any command with the appropriate one of the
+ following generic responses if it represents the situation.
+ 
+ If there is a syntax error in the arguments of a recognised command, the
+ response code 501 MUST be returned.
+ 
+ If the client is not authorised to use the specified facility when the
+ server is in its current state, the response code 502 MUST be returned.
+ A different command MIGHT change the server state and permit the command
+ if retried.
+ 
+ If the server does not provide an optional feature, then the response
+ code 403 MUST be returned if the omission is temporary (e.g. because a
+ necessary facility is unavailable) and the code 503 if it is permanent
+ (e.g. because the server does not store the required information).
+ 
+ If the server has to terminate the connection for some reason, it MUST
+ give a 400 response code to the next command and then immediately close
+ the TCP connection. It MAY give a 401 response code to any command
+ indicate that termination is imminent (following a 401 response, it MUST
+ NOT close the TCP connection immediately).

(3) Delete all references to the relevant codes in specific commands.

The resulting section 4 is on my web site at:

    <http://www.davros.org/nntp-texts/section-4gen.txt>

Comments ? Either about the concept or the details ?

-- 
Clive D.W. Feather  | Work:  <clive at demon.net>   | Tel:  +44 20 8371 1138
Internet Expert     | Home:  <clive at davros.org>  | Fax:  +44 20 8371 1037
Demon Internet      | WWW: http://www.davros.org | DFax: +44 20 8371 4037
Thus plc            |                            | Mobile: +44 7973 377646 



More information about the ietf-nntp mailing list