Thread View: news.software.nntp
4 messages
4 total messages
Started by Julien ÉLIE
Thu, 22 Oct 2009 18:03
500 or 501 for invalid command lines?
Author: Julien ÉLIE
Date: Thu, 22 Oct 2009 18:03
Date: Thu, 22 Oct 2009 18:03
43 lines
2545 bytes
2545 bytes
Hi,
What should be sent by a news server when a client
sends "A"? Is it 500 or 501?
"A" is not a command (it does not follow the syntax for
a command). It it an "unknown command" or a "syntax error
in command"?
Extracts from RFC 3977:
command-line = command EOL
command = X-command
X-command = keyword *(WS token)
keyword = ALPHA 2*(ALPHA / DIGIT / "." / "-")
token = 1*P-CHAR
Response code 500
Generic response
Meaning: unknown command.
Response code 501
Generic response
Meaning: syntax error in command.
If the command is not recognized, or if it is an optional command
that is not implemented by the server, the response code 500 MUST be
returned.
If there is a syntax error in the arguments of a recognized command,
including the case where more arguments are provided than the command
specifies or the command line is longer than the server accepts, the
response code 501 MUST be returned. The line MUST NOT be truncated
or split and then interpreted. Note that where a command has
variants depending on a second keyword (e.g., LIST ACTIVE and LIST
NEWSGROUPS), 501 MUST be used when the base command is implemented
but the requested variant is not, and 500 MUST be used only when the
base command itself is not implemented.
--
Julien ÉLIE
« Encore un peu, et cette histoire finira en queue de poisson ! » (Astérix)
Re: 500 or 501 for invalid command lines?
Author: D. Stussy
Date: Thu, 22 Oct 2009 21:38
Date: Thu, 22 Oct 2009 21:38
46 lines
2817 bytes
2817 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message news:hbq6r3$lpp$1@news.trigofacile.com... > What should be sent by a news server when a client > sends "A"? Is it 500 or 501? > "A" is not a command (it does not follow the syntax for > a command). It it an "unknown command" or a "syntax error > in command"? You seem to answer your own question: 500. Now, for a command "A B" where A is valid, and B is not: 501. For REPETITIVE blank lines, I'd issue a 500. (Is that the "real" question?) > Extracts from RFC 3977: > > command-line = command EOL > command = X-command > X-command = keyword *(WS token) > keyword = ALPHA 2*(ALPHA / DIGIT / "." / "-") > token = 1*P-CHAR > > Response code 500 > Generic response > Meaning: unknown command. > > Response code 501 > Generic response > Meaning: syntax error in command. > > If the command is not recognized, or if it is an optional command > that is not implemented by the server, the response code 500 MUST be > returned. > > If there is a syntax error in the arguments of a recognized command, > including the case where more arguments are provided than the command > specifies or the command line is longer than the server accepts, the > response code 501 MUST be returned. The line MUST NOT be truncated > or split and then interpreted. Note that where a command has > variants depending on a second keyword (e.g., LIST ACTIVE and LIST > NEWSGROUPS), 501 MUST be used when the base command is implemented > but the requested variant is not, and 500 MUST be used only when the > base command itself is not implemented.
Re: 500 or 501 for invalid command lines?
Author: Julien ÉLIE
Date: Fri, 23 Oct 2009 21:47
Date: Fri, 23 Oct 2009 21:47
49 lines
2685 bytes
2685 bytes
Hi D. Stussy,
>> What should be sent by a news server when a client
>> sends "A"? Is it 500 or 501?
>> "A" is not a command (it does not follow the syntax for
>> a command). It it an "unknown command" or a "syntax error
>> in command"?
>
> You seem to answer your own question: 500.
>
> Now, for a command "A B" where A is valid, and B is not: 501.
My point was that "A" is not a command; a command is a keyword
of at least three chars:
command-line = command EOL
command = X-command
X-command = keyword *(WS token)
keyword = ALPHA 2*(ALPHA / DIGIT / "." / "-")
500 is for an "unknown command".
It is like we say: we expect a noun and send 500 if we receive
an "unknown noun". The grammar mentions that a noun does not
begin with "to".
Then, what if I send "to be"?
500 because of an "unknown noun" or 501 because of a "syntax
error in noun"?
"to be" is not an "unknown noun" since it is not a noun.
There is a syntax error here.
If we consider 500 for an "unknown command line" and 501 for
a "syntax error in command line", it looks more 501 for our case
(500 being for a syntactically correct command line, with
an unknown command).
Well, I do not know if I am clear in what I am trying to say...
--
Julien ÉLIE
« -- Il est vraiment formidable !
-- Qui ça ?
-- Ben, vous.
-- Ah, lui ! » (César)
Re: 500 or 501 for invalid command lines?
Author: D. Stussy
Date: Sat, 24 Oct 2009 01:55
Date: Sat, 24 Oct 2009 01:55
45 lines
2778 bytes
2778 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message news:hbt89a$a51$1@news.trigofacile.com... > >> What should be sent by a news server when a client > >> sends "A"? Is it 500 or 501? > >> "A" is not a command (it does not follow the syntax for > >> a command). It it an "unknown command" or a "syntax error > >> in command"? > > > > You seem to answer your own question: 500. > > > > Now, for a command "A B" where A is valid, and B is not: 501. > > My point was that "A" is not a command; a command is a keyword > of at least three chars: > command-line = command EOL > command = X-command > X-command = keyword *(WS token) > keyword = ALPHA 2*(ALPHA / DIGIT / "." / "-") > > 500 is for an "unknown command". > > It is like we say: we expect a noun and send 500 if we receive > an "unknown noun". The grammar mentions that a noun does not > begin with "to". > Then, what if I send "to be"? > 500 because of an "unknown noun" or 501 because of a "syntax > error in noun"? > > "to be" is not an "unknown noun" since it is not a noun. > There is a syntax error here. > > > If we consider 500 for an "unknown command line" and 501 for > a "syntax error in command line", it looks more 501 for our case > (500 being for a syntactically correct command line, with > an unknown command). > > > > Well, I do not know if I am clear in what I am trying to say... One sends 500. We don't see the other stuff unless the first "word" (non-whitespace) is valid.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads