🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
33 messages
33 total messages Started by Julien ÉLIE Fri, 20 Mar 2009 20:17
Questions about datastream answers (especially to TAKETHIS)
#80419
Author: Julien ÉLIE
Date: Fri, 20 Mar 2009 20:17
103 lines
3942 bytes
Hi,

With pipelining:

   [C] CHECK <good@mid>
   [C] CHECK <good@mid>
   [C] CHECK bad-mid
   [C] CHECK <another@good-mid>

   [S] 238 <good@mid>
   [S] 431 <good@mid>
   [S] 501 Syntax error in message-ID
   [S] 238 <another@good-mid>

431 (defer) for the second one because it has "recently" been sent.
501 (and not 438 -- do not send the article) for the third one because
the syntax of the CHECK command is wrong.

I think we're OK about that.



As for TAKETHIS, what if:

   [C] TAKETHIS bad-mid
   [C] From: ...
   [C] (with a valid article)
   [C] .


Such a case is not dealt with RFC 4644.  What should be done?

   [C] TAKETHIS bad-mid
   [S] 501 Syntax error in message-ID

and unfortunately

   [C] From: ...
   [C] (with a valid article)
   [S] 500 What?
   [S] 500 What?
   [S] 500 What?
   [S] 500 What?
   [S] 500 What?

and so on...


Or should we wait for the final
   [C] .
and then send
   [S] 501 Syntax error in message-ID



RFC 3977 states:

   For each command, the sequence is as follows:

   o  The client sends an instance of <command-line>; the syntax for the
      EXAMPLE command is <example-command>.

   o  If the client is one that immediately streams data, it sends an
      instance of <command-datastream>; the syntax for the EXAMPLE
      command is <example-datastream>.

   o  The server sends an instance of <response>.


But to what command does the server send a response?
The TAKETHIS command?  Or the (TAKETHIS+datastream) command?
It is not clear.
How a news server is it supposed to parse that?
   [C] TAKETHIS <good@mid> other arguments
Shouldn't it be 501 too?

Anyway, it would be the behaviour of a server which does not advertise
STREAMING (TAKETHIS would be unknown to it).




I also see that 403 is not a valid answer to TAKETHIS in case the
server does not want to accept or reject the article.
As a matter of fact:

   The server MUST return either a 239 response,
   indicating that the article was successfully transferred, or a 439
   response, indicating that the article was rejected.  If the server
   encounters a temporary error that prevents it from processing the
   article but does not want to reject the article, it MUST reply with a
   400 response to the client and close the connection.

I do not understand why 403 would be a problem; only because the sender
will never see the message-ID in "239/439 message-ID"?  For backwards
compatibility with RFC 2980 which defined 400 for not accepting articles?
Something else?

-- 
Julien ÉLIE

« Un petit pås pøur møi, un grånd bønd pøur l'humanité ! » (Kerøzen)
Re: Questions about datastream answers (especially to TAKETHIS)
#80420
Author: Russ Allbery
Date: Fri, 20 Mar 2009 20:36
57 lines
3339 bytes
Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:

> Such a case is not dealt with RFC 4644.  What should be done?
>
>   [C] TAKETHIS bad-mid
>   [S] 501 Syntax error in message-ID
>
> and unfortunately
>
>   [C] From: ...
>   [C] (with a valid article)
>   [S] 500 What?
>   [S] 500 What?
>   [S] 500 What?
>   [S] 500 What?
>   [S] 500 What?
>
> and so on...
>
> Or should we wait for the final
>   [C] .
> and then send
>   [S] 501 Syntax error in message-ID

The response can be sent immediately, but we have to continue consuming
lines from the client until we see a period on a line by itself because
TAKETHIS immediately sends data and hence the data always has to be
consumed even if the command is syntactically invalid.

> How a news server is it supposed to parse that?
>   [C] TAKETHIS <good@mid> other arguments
> Shouldn't it be 501 too?

Yes.

> I also see that 403 is not a valid answer to TAKETHIS in case the server
> does not want to accept or reject the article.  As a matter of fact:
>
>   The server MUST return either a 239 response, indicating that the
>   article was successfully transferred, or a 439 response, indicating
>   that the article was rejected.  If the server encounters a temporary
>   error that prevents it from processing the article but does not want
>   to reject the article, it MUST reply with a 400 response to the client
>   and close the connection.
>
> I do not understand why 403 would be a problem; only because the sender
> will never see the message-ID in "239/439 message-ID"?

I don't see a reason why 403 wouldn't be fine if that represents the
situation.  Generally, the Generic Response Codes are always allowed in
response to any command when they're appropriate.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: Questions about datastream answers (especially to TAKETHIS)
#80421
Author: Julien ÉLIE
Date: Fri, 20 Mar 2009 21:03
59 lines
3608 bytes
Hi Russ,

>>   [C] TAKETHIS bad-mid
>>   [S] 501 Syntax error in message-ID
>>
>> Or should we wait for the final
>>   [C] .
>> and then send
>>   [S] 501 Syntax error in message-ID
>
> The response can be sent immediately, but we have to continue consuming
> lines from the client until we see a period on a line by itself because
> TAKETHIS immediately sends data and hence the data always has to be
> consumed even if the command is syntactically invalid.

OK, that's wise.


>> I also see that 403 is not a valid answer to TAKETHIS in case the server
>> does not want to accept or reject the article.  As a matter of fact:
>>
>>   The server MUST return either a 239 response, indicating that the
>>   article was successfully transferred, or a 439 response, indicating
>>   that the article was rejected.  If the server encounters a temporary
>>   error that prevents it from processing the article but does not want
>>   to reject the article, it MUST reply with a 400 response to the client
>>   and close the connection.
>
> Generally, the Generic Response Codes are always allowed in
> response to any command when they're appropriate.

OK.  I found out in RFC 3977:

   The server MUST respond to any command with the appropriate generic
   response (given in Section 3.2.1) if it represents the situation.
   Otherwise, each recognized command MUST return one of the response
   codes specifically listed in its description or in an extension.


> I don't see a reason why 403 wouldn't be fine if that represents the
> situation.

OK, though it is difficult to make a clear difference between a RFC 4644
"temporary error" which leads to answer 400 and close the connection
and a RFC 3977 "internal fault or problem that means it is unable to
carry out the command (for example, a necessary file is missing or
a necessary service could not be contacted)" which leads to answer
a mere 403.

I guess the question is more "do we need to close the connection"
than discussing the error.  (And it can be extended to other
commands, not only TAKETHIS.)

-- 
Julien ÉLIE

« -- Depuis quelque temps, Zérozérosix n'attire plus les mouches !
  -- Espérons qu'il ne nous attirera pas d'ennuis ! » (Astérix)
Re: Questions about datastream answers (especially to TAKETHIS)
#80422
Author: Russ Allbery
Date: Fri, 20 Mar 2009 21:12
33 lines
3096 bytes
Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:

>> I don't see a reason why 403 wouldn't be fine if that represents the
>> situation.
>
> OK, though it is difficult to make a clear difference between a RFC 4644
> "temporary error" which leads to answer 400 and close the connection and
> a RFC 3977 "internal fault or problem that means it is unable to carry
> out the command (for example, a necessary file is missing or a necessary
> service could not be contacted)" which leads to answer a mere 403.
>
> I guess the question is more "do we need to close the connection" than
> discussing the error.  (And it can be extended to other commands, not
> only TAKETHIS.)

The problem with streaming is that you can easily get desynchronized.  I
remember now why we did this: always closing the connection when something
goes wrong in the middle of streaming articles is safer.  Otherwise, you
run a higher risk of not being able to associate error replies with
articles or having the client guess wrong about what you're trying to do.

In particular, if you send back a 403 for a particular article and
otherwise continue to accept articles, the client has no way of knowing
which article was rejected with the 403 unless they're paying a lot of
attention to sequencing (which often they don't).  If you use 400 and just
close the connection, then the client will defer all unacknowledged
articles, which is usually what you want.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: Questions about datastream answers (especially to TAKETHIS)
#80423
Author: Julien ÉLIE
Date: Fri, 20 Mar 2009 22:05
14 lines
1932 bytes
> In particular, if you send back a 403 for a particular article and
> otherwise continue to accept articles, the client has no way of knowing
> which article was rejected with the 403 unless they're paying a lot of
> attention to sequencing (which often they don't).  If you use 400 and just
> close the connection, then the client will defer all unacknowledged
> articles, which is usually what you want.

All right, thanks Russ.

-- 
Julien ÉLIE

« Love is blind but marriage is an eye-opener. » 
Re: Questions about datastream answers (especially to TAKETHIS)
#80424
Author: Julien ÉLIE
Date: Fri, 20 Mar 2009 23:21
65 lines
3517 bytes
Hi Russ,

> The problem with streaming is that you can easily get desynchronized.  I
> remember now why we did this: always closing the connection when something
> goes wrong in the middle of streaming articles is safer.  Otherwise, you
> run a higher risk of not being able to associate error replies with
> articles or having the client guess wrong about what you're trying to do.

Oh hmm...  If that's so, should we really send 501 to:

   [C] TAKETHIS bad-mid and/or four arguments
   [C] From: ...
   [C] (with a valid article)
   [C] .

We will get desynchronized the same way.
If 501 can be sent in that case, so does 403...

But I am under the impression that we MUST send 501 and continue the
connection on a syntax error, and that we MUST sent 400 and close
the connection in other cases.
So desynchronization can occur in the first case.  (I hope it scarcely
happens.)


The same goes for CHECK:

   [C] CHECK <good@mid>
   [C] CHECK bad-mid
   [C] CHECK <another@good-mid>

   [S] 238 <good@mid>
   [S] 501 Syntax error in message-ID
   [S] 238 <good@mid>

The client will not know what it should do with "bad-id".
Besides, it may (but should not) keep sending CHECK in an endless loop
for "bad-id"...



> In particular, if you send back a 403 for a particular article and
> otherwise continue to accept articles, the client has no way of knowing
> which article was rejected with the 403 unless they're paying a lot of
> attention to sequencing (which often they don't).

OK.  But it would be the same if, for instance, a client is not allowed
to send articles to "private.group"; we should answer 480 to TAKETHIS if
the newsgroup the article is sent to is "private.group".  Or if encryption
is needed for that group, 483.
Other *unlikely* scenarii could not happen with that design.



> If you use 400 and just
> close the connection, then the client will defer all unacknowledged
> articles, which is usually what you want.

OK.

-- 
Julien ÉLIE

« Dès que le silence se fait, les gens le meublent. » (Raymond Devos)
Re: Questions about datastream answers (especially to TAKETHIS)
#80425
Author: Russ Allbery
Date: Sat, 21 Mar 2009 00:22
54 lines
3405 bytes
Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:

> Oh hmm...  If that's so, should we really send 501 to:
>
>   [C] TAKETHIS bad-mid and/or four arguments
>   [C] From: ...
>   [C] (with a valid article)
>   [C] .
>
> We will get desynchronized the same way.
> If 501 can be sent in that case, so does 403...

I think we didn't discuss this in the working group since this case is so
much less common.  In this case, the TAKETHIS client is actually broken,
so who knows what horrible thing it's going to do.  We don't have as good
of a chance of doing the right thing.

You can always send 400 replies.  I'm not sure if I'd send 501 or 400 for
this -- although the risk of sending 400 and closing the connection is
that the client will keep retrying the same bad message ID.  (That's the
reason why you don't want to use 400 for any problem with the article
itself, only for more general system problems.)

> The same goes for CHECK:
>
>   [C] CHECK <good@mid>
>   [C] CHECK bad-mid
>   [C] CHECK <another@good-mid>
>
>   [S] 238 <good@mid>
>   [S] 501 Syntax error in message-ID
>   [S] 238 <good@mid>
>
> The client will not know what it should do with "bad-id".  Besides, it
> may (but should not) keep sending CHECK in an endless loop for
> "bad-id"...

Yeah.  This is kind of nasty, and there isn't a good solution for it.

> OK.  But it would be the same if, for instance, a client is not allowed
> to send articles to "private.group"; we should answer 480 to TAKETHIS if
> the newsgroup the article is sent to is "private.group".  Or if
> encryption is needed for that group, 483.  Other *unlikely* scenarii
> could not happen with that design.

Agreed.  I'm not sure what the right thing to do is.  Really, ideally,
every reply to TAKETHIS or CHECK should include the message ID, but that's
not how the protocol currently works.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: Questions about datastream answers (especially to TAKETHIS)
#80427
Author: Julien ÉLIE
Date: Sat, 21 Mar 2009 08:03
90 lines
4502 bytes
Hi Russ,

>>   [C] TAKETHIS bad-mid and/or four arguments
>>   [C] From: ...
>>   [C] (with a valid article)
>>   [C] .
>>
>> We will get desynchronized the same way.
>> If 501 can be sent in that case, so does 403...
>
> I think we didn't discuss this in the working group since this case is so
> much less common.  In this case, the TAKETHIS client is actually broken,
> so who knows what horrible thing it's going to do.  We don't have as good
> of a chance of doing the right thing.

INN 2.4.6/2.5.0-RC1 currently does:

   [C] CHECK bad-mid and/or four arguments
   [S] 438 bad-mid and/or four arguments

(There is no 501 on CHECK or TAKETHIS.  Only rejects by INN.)

But ABNF says it is "CHECK" WS message-id, and not a byte string until
the end of the line.  So it is not following RFC 4644.

The CHECK/TAKETHIS client is not necessarily all broken:  it could send
a message-ID whose length is 300 (> 250).  How are such articles supposed
to be propagated?
The protocol does not allow that (no problem to POST them, but
IHAVE/TAKETHIS cannot propagate them).



> You can always send 400 replies.  I'm not sure if I'd send 501 or 400 for
> this -- although the risk of sending 400 and closing the connection is
> that the client will keep retrying the same bad message ID.  (That's the
> reason why you don't want to use 400 for any problem with the article
> itself, only for more general system problems.)

Understood.  No 400 here.
Thus:

   [C] TAKETHIS
   [C] (with article afterwards...)
   [C] TAKETHIS bad-mid
   [C] TAKETHIS a b c
   [S] 439
   [S] 439 bad-mid
   [S] 439 a b c

Such answers are not RFC-compliant (not 501, and 439 not followed
by a message-ID) but are maybe the best thing to do.
I only see a clear 438/439 reject response for the client not to loop
when the syntax used is not accepted.  But such a behaviour is
documented nowhere.



> Agreed.  I'm not sure what the right thing to do is.  Really, ideally,
> every reply to TAKETHIS or CHECK should include the message ID, but that's
> not how the protocol currently works.

You mean the byte string passed after CHECK/TAKETHIS then.  And we would do:

   [C] TAKETHIS
   [C] (with article afterwards...)
   [C] TAKETHIS bad-mid
   [C] TAKETHIS a b c
   [S] 501
   [S] 501 bad-mid
   [S] 501 a b c

The advantage is that these answers are RFC 3977-compliant (501, with a valid
response argument).  But I doubt that implementations are properly handling
the arguments of 501 after CHECK/TAKETHIS.
The same goes for 400, 403, etc.

The solution you suggest is the cleanest thing to do and complies with RFCs.
The only issue is that it is not documented ("501 bad-mid" is both
not forbidden and not mentioned).

Should we go on that way?

-- 
Julien ÉLIE

« Les femmes forment un sexe purement décoratif. Elles n'ont jamais rien
  à dire, mais elles le disent d'une facon charmante. »
  (Oscar Wilde, _The Picture of Dorian Gray_, IV) 
Re: Questions about datastream answers (especially to TAKETHIS)
#80431
Author: Russ Allbery
Date: Sat, 21 Mar 2009 20:43
89 lines
4588 bytes
Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:

> INN 2.4.6/2.5.0-RC1 currently does:
>
>   [C] CHECK bad-mid and/or four arguments
>   [S] 438 bad-mid and/or four arguments
>
> (There is no 501 on CHECK or TAKETHIS.  Only rejects by INN.)
>
> But ABNF says it is "CHECK" WS message-id, and not a byte string until
> the end of the line.  So it is not following RFC 4644.

Right.

> The CHECK/TAKETHIS client is not necessarily all broken:  it could send
> a message-ID whose length is 300 (> 250).  How are such articles
> supposed to be propagated?

They're not.  Such messages are invalid Usenet messages.  USEFOR restricts
the length of the Message-ID field to 250 octets.

In practice, it's not much of a problem.  We saw a few messages like that
which sparked the original discussion, but I think they were spam or other
weird cases, not people generating such message IDs for some real purpose.

> Understood.  No 400 here.
> Thus:
>
>   [C] TAKETHIS
>   [C] (with article afterwards...)
>   [C] TAKETHIS bad-mid
>   [C] TAKETHIS a b c
>   [S] 439
>   [S] 439 bad-mid
>   [S] 439 a b c
>
> Such answers are not RFC-compliant (not 501, and 439 not followed
> by a message-ID) but are maybe the best thing to do.

Yeah, I guess I'd lean towards doing this because it's the least likely to
confuse the other side, although all options here are kind of eh.  I
wouldn't argue with someone who felt 501 was the right reply.

> I only see a clear 438/439 reject response for the client not to loop
> when the syntax used is not accepted.  But such a behaviour is
> documented nowhere.

Yup.

>> Agreed.  I'm not sure what the right thing to do is.  Really, ideally,
>> every reply to TAKETHIS or CHECK should include the message ID, but
>> that's not how the protocol currently works.
>
> You mean the byte string passed after CHECK/TAKETHIS then.

Right.

> And we would do:
>
>   [C] TAKETHIS
>   [C] (with article afterwards...)
>   [C] TAKETHIS bad-mid
>   [C] TAKETHIS a b c
>   [S] 501
>   [S] 501 bad-mid
>   [S] 501 a b c
>
> The advantage is that these answers are RFC 3977-compliant (501, with a
> valid response argument).  But I doubt that implementations are properly
> handling the arguments of 501 after CHECK/TAKETHIS.  The same goes for
> 400, 403, etc.

Oh, yeah, I'm sure they don't.

> The solution you suggest is the cleanest thing to do and complies with
> RFCs.  The only issue is that it is not documented ("501 bad-mid" is
> both not forbidden and not mentioned).
>
> Should we go on that way?

It makes me a little uneasy, since 501 is really the correct response, but
I can see the justification for it.  I wonder if anyone else has an
opinion on what should be done in this corner case.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: Questions about datastream answers (especially to TAKETHIS)
#80429
Author: Michael Grimm
Date: Sat, 21 Mar 2009 22:45
21 lines
2066 bytes
Russ Allbery <rra@stanford.edu> wrote:
> Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:

>> The solution you suggest is the cleanest thing to do and complies
>> with RFCs.  The only issue is that it is not documented ("501
>> bad-mid" is both not forbidden and not mentioned).
>>
>> Should we go on that way?
>
> It makes me a little uneasy, since 501 is really the correct response,
> but I can see the justification for it.  I wonder if anyone else has
> an opinion on what should be done in this corner case.

I do support to go that way, although it's not "documented". As long
it's not explicitely mentioned, thus not forbidden I wouldn't hesitate
to go for it. 

Regards,
Michael
-- 
to let
Re: Questions about datastream answers (especially to TAKETHIS)
#80430
Author: Julien ÉLIE
Date: Sun, 22 Mar 2009 10:47
60 lines
3829 bytes
Hi Michael,

>>> The solution you suggest is the cleanest thing to do and complies
>>> with RFCs.  The only issue is that it is not documented ("501
>>> bad-mid" is both not forbidden and not mentioned).
>>>
>>> Should we go on that way?
>>
>> It makes me a little uneasy, since 501 is really the correct response,
>> but I can see the justification for it.  I wonder if anyone else has
>> an opinion on what should be done in this corner case.
>
> I do support to go that way, although it's not "documented". As long
> it's not explicitely mentioned, thus not forbidden I wouldn't hesitate
> to go for it.

I would also like to answer the right 501 response code instead of
a 438/439 reject (these codes have a different meaning than what
we really want to answer).

Nonetheless, if we currently answer 501 to innfeed (both INN 2.4.6 and
2.5.0-RC1), supposing of course that innfeed has sent a wrong message-ID,
innfeed does not understand and will go on sending the same command
the next time it tries:

          default:
            warn ("%s:%d cxnsleep response unknown: %d %s", peerName,
                  cxn->ident, code, response) ;
            cxnSleepOrDie (cxn) ;

Therefore, innfeed will be blocked.  Maybe other news server will also block
the same way :-/


RFC 4644 does not say anything about that.  According to RFCs,
we MUST answer 501 but it breaks existing implementations.


Incidentally, innfeed has a lot of different cases to understand
other broken implementations.  For instance, it accepts 439 answers
to CHECK (which is not a valid answer -> 438 is the one) because
NNTPRelay does that (according to a comment).
I do not mind if such cases exist.  But we're also introducing bad
things with the handling of 501 if we return 438/439 instead.


Another amusing thing to answer to innfeed is another message-ID:

  [C] CHECK <mid1>
  [S] 239 <mid2>

It will go into sleep mode.
Shouldn't the right behaviour be to ignore this 239 answer and
consider we still haven't got an answer for <mid1>?

-- 
Julien ÉLIE

« Vbi solitudinem faciunt, pacem appellant. » (Galgagus de Tacite) 
Re: Questions about datastream answers (especially to TAKETHIS)
#80432
Author: Julien ÉLIE
Date: Sun, 22 Mar 2009 11:37
47 lines
3415 bytes
Hi Russ,

>> The solution you suggest is the cleanest thing to do and complies with
>> RFCs.  The only issue is that it is not documented ("501 bad-mid" is
>> both not forbidden and not mentioned).
>>
>> Should we go on that way?
>
> It makes me a little uneasy, since 501 is really the correct response, but
> I can see the justification for it.  I wonder if anyone else has an
> opinion on what should be done in this corner case.

More a hack than anything else but if we have received "CAPABILITIES"
previously in the session, we send "501 the whole byte string" (RFC-compliant);
otherwise, "439 the whole byte string" (not RFC-compliant).


But well, it is not very proper...


In both cases, RFC 4644 needs an addendum to say:
* either that generic responses will include that byte string (which can
  be a well-formed message-ID for instance after 480, 483, etc.);
* or that 438/439 is always sent in such cases and that their answer is
  always the whole byte string.

I would of course prefer the first one.

And we still do not handle the case of a "whole byte string" whose size is
greater than the maximum allowed (for instance 600 bytes -> we must truncate
it after 501 or do something else).


Or it can also be assumed that RFC 4644 does not need an addendum and is
well as-is, which is fine except for the absence of message-ID (the client
will not know which command has triggered the problem).  This solution,
as well as the first one, still has the disadvantage of not being compatible
with current NNTP implementations :-/
And the second solution, though fine with current implementations, prevents
the use of useful code responses.

-- 
Julien ÉLIE

« -- J'ai horreur de tirer des chefs sans provisions !
  -- Et moi, je ne peux pas encaisser les chefs aux porteurs. » (Astérix)
Re: Questions about datastream answers (especially to TAKETHIS)
#80433
Author: Julien ÉLIE
Date: Sun, 22 Mar 2009 11:39
123 lines
4857 bytes
Hi Russ,

>> The CHECK/TAKETHIS client is not necessarily all broken:  it could send
>> a message-ID whose length is 300 (> 250).  How are such articles
>> supposed to be propagated?
>
> They're not.  Such messages are invalid Usenet messages.  USEFOR restricts
> the length of the Message-ID field to 250 octets.
>
> In practice, it's not much of a problem.  We saw a few messages like that
> which sparked the original discussion, but I think they were spam or other
> weird cases, not people generating such message IDs for some real purpose.

OK, that's good then.


>> Understood.  No 400 here.
>> Thus:
>>
>>   [C] TAKETHIS
>>   [C] (with article afterwards...)
>>   [C] TAKETHIS bad-mid
>>   [C] TAKETHIS a b c
>>   [S] 439
>>   [S] 439 bad-mid
>>   [S] 439 a b c
>>
>> Such answers are not RFC-compliant (not 501, and 439 not followed
>> by a message-ID) but are maybe the best thing to do.
>
> Yeah, I guess I'd lean towards doing this because it's the least likely to
> confuse the other side, although all options here are kind of eh.  I
> wouldn't argue with someone who felt 501 was the right reply.

I believe that for interoperability reasons, we should indeed send 438/439.
Both DNews and Diablo do that.  But... in different ways!

200 DNEWS Version  5.7e1,, S0, posting OK
CHECK <a@b>
238 <a@b> not here, please send it to me
CHECK a b
438 a article not wanted - Missing opening angle bracket
CHECK <a@
438 <a@ article not wanted - Closing angle bracket missing
TAKETHIS a
..
439 a transfer failed - do not try again later (No msgid in headers)


200 NNTP Service Ready (DIABLO 5.0-REL)
check <k
CHECK <a@b>
238 <a@b>
CHECK a b
438 a b Bad Message-ID
CHECK <a@
438 <a@ Bad Message-ID
TAKETHIS a
..
439 <> 3 000001 TooSmall


DNews replies with the *first* keyword ("CHECK a b" -> "438 a")
whereas Diablo uses everything.

For TAKETHIS, Diablo actually uses the message-ID found in the article.


[Diablo]

TAKETHIS abc
Path: test!not-for-mail
From: "test" <test@test.com>
Newsgroups: fr.test
Subject: Test
Date: 22 Mar 2009 04:38:40 -0500
Message-ID: <another@id.com>

Test!
..
439 <> 187 000001 MsgIdMismatch


It works with "TAKETHIS <another@id.com>".
As for DNews, there is no such checks and it uses the argument provided
to TAKETHIS.



It makes me think that RFC 3977 states:

   Example of sending an article to another site that rejects it.  Note
   that the message-id in the IHAVE command is not the same as the one
   in the article headers; while this is bad practice and SHOULD NOT be
   done, it is not forbidden.

Though we do not have a similar comment in RFC 4644, it is similarly
not forbidden.



>>   [C] TAKETHIS
>>   [C] (with article afterwards...)
>>   [C] TAKETHIS bad-mid
>>   [C] TAKETHIS a b c
>>   [S] 501
>>   [S] 501 bad-mid
>>   [S] 501 a b c
>>
>> The advantage is that these answers are RFC 3977-compliant (501, with a
>> valid response argument).  But I doubt that implementations are properly
>> handling the arguments of 501 after CHECK/TAKETHIS.  The same goes for
>> 400, 403, etc.
>
> Oh, yeah, I'm sure they don't.

:)

-- 
Julien ÉLIE

« Vbi solitudinem faciunt, pacem appellant. » (Galgagus de Tacite) 
Re: Questions about datastream answers (especially to TAKETHIS)
#80434
Author: D. Stussy
Date: Sun, 22 Mar 2009 20:21
136 lines
5633 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message
news:gq583d$nj5$1@news.trigofacile.com...
> >> The CHECK/TAKETHIS client is not necessarily all broken:  it could
send
> >> a message-ID whose length is 300 (> 250).  How are such articles
> >> supposed to be propagated?
> >
> > They're not.  Such messages are invalid Usenet messages.  USEFOR
restricts
> > the length of the Message-ID field to 250 octets.
> >
> > In practice, it's not much of a problem.  We saw a few messages like
that
> > which sparked the original discussion, but I think they were spam or
other
> > weird cases, not people generating such message IDs for some real
purpose.
>
> OK, that's good then.
>
> >> Understood.  No 400 here.
> >> Thus:
> >>
> >>   [C] TAKETHIS
> >>   [C] (with article afterwards...)
> >>   [C] TAKETHIS bad-mid
> >>   [C] TAKETHIS a b c
> >>   [S] 439
> >>   [S] 439 bad-mid
> >>   [S] 439 a b c
> >>
> >> Such answers are not RFC-compliant (not 501, and 439 not followed
> >> by a message-ID) but are maybe the best thing to do.
> >
> > Yeah, I guess I'd lean towards doing this because it's the least likely
to
> > confuse the other side, although all options here are kind of eh.  I
> > wouldn't argue with someone who felt 501 was the right reply.
>
> I believe that for interoperability reasons, we should indeed send
438/439.
> Both DNews and Diablo do that.  But... in different ways!
>
> 200 DNEWS Version  5.7e1,, S0, posting OK
> CHECK <a@b>
> 238 <a@b> not here, please send it to me
> CHECK a b
> 438 a article not wanted - Missing opening angle bracket
> CHECK <a@
> 438 <a@ article not wanted - Closing angle bracket missing
> TAKETHIS a
> .
> 439 a transfer failed - do not try again later (No msgid in headers)
>
>
> 200 NNTP Service Ready (DIABLO 5.0-REL)
> check <k
> CHECK <a@b>
> 238 <a@b>
> CHECK a b
> 438 a b Bad Message-ID
> CHECK <a@
> 438 <a@ Bad Message-ID
> TAKETHIS a
> .
> 439 <> 3 000001 TooSmall
>
>
> DNews replies with the *first* keyword ("CHECK a b" -> "438 a")
> whereas Diablo uses everything.
>
> For TAKETHIS, Diablo actually uses the message-ID found in the article.
>
>
> [Diablo]
>
> TAKETHIS abc
> Path: test!not-for-mail
> From: "test" <test@test.com>
> Newsgroups: fr.test
> Subject: Test
> Date: 22 Mar 2009 04:38:40 -0500
> Message-ID: <another@id.com>
>
> Test!
> .
> 439 <> 187 000001 MsgIdMismatch
>
>
> It works with "TAKETHIS <another@id.com>".
> As for DNews, there is no such checks and it uses the argument provided
> to TAKETHIS.
>
>
>
> It makes me think that RFC 3977 states:
>
>    Example of sending an article to another site that rejects it.  Note
>    that the message-id in the IHAVE command is not the same as the one
>    in the article headers; while this is bad practice and SHOULD NOT be
>    done, it is not forbidden.
>
> Though we do not have a similar comment in RFC 4644, it is similarly
> not forbidden.
>
>
>
> >>   [C] TAKETHIS
> >>   [C] (with article afterwards...)
> >>   [C] TAKETHIS bad-mid
> >>   [C] TAKETHIS a b c
> >>   [S] 501
> >>   [S] 501 bad-mid
> >>   [S] 501 a b c
> >>
> >> The advantage is that these answers are RFC 3977-compliant (501, with
a
> >> valid response argument).  But I doubt that implementations are
properly
> >> handling the arguments of 501 after CHECK/TAKETHIS.  The same goes for
> >> 400, 403, etc.
> >
> > Oh, yeah, I'm sure they don't.
>
> :)

If I understand the question properly, I believe the best course of action
for a TAKETHIS command with a bad parameter is:
1) Return the appropriate error code (asychronously with the transfer of
the message?), and
2) Simply absorb and discard everything that is transferred up to the next
end-of-message marker.
The discarded message's MID shall NOT be added to the history archive (so
it may be accepted via a different source that isn't buggy).

Re: Questions about datastream answers (especially to TAKETHIS)
#80436
Author: Julien ÉLIE
Date: Sun, 22 Mar 2009 21:06
29 lines
2844 bytes
Hi D. Stussy,

> If I understand the question properly, I believe the best course of action
> for a TAKETHIS command with a bad parameter is:
> 1) Return the appropriate error code (asychronously with the transfer of
> the message?), and
> 2) Simply absorb and discard everything that is transferred up to the next
> end-of-message marker.
> The discarded message's MID shall NOT be added to the history archive (so
> it may be accepted via a different source that isn't buggy).

Sure:  the discarded message-ID should not be remembered.

The question we are discussing is more "what the client understands if
the server sends the appropriate code" (the client does not currently
expect appropriate codes!) than "what the server does with what it
receives".
The problem is that appropriate codes have been made mandatory
by RFCs 3977+4644 (I think RFCs 977+2980 were also encouraging appropriate
codes) but it appears that clients (INN [innfeed] and Diablo [dnewslink]
affected, amongst others) are not expected them during streaming.
That's why I wondered what we should do.

-- 
Julien ÉLIE

« -- Sauve qui peut !
  -- Je ne sais pas si je peux, mais je vais essayer ! » (Astérix) 
Re: Questions about datastream answers (especially to TAKETHIS)
#80438
Author: Russ Allbery
Date: Mon, 23 Mar 2009 01:46
44 lines
3470 bytes
Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:

> Nonetheless, if we currently answer 501 to innfeed (both INN 2.4.6 and
> 2.5.0-RC1), supposing of course that innfeed has sent a wrong
> message-ID, innfeed does not understand and will go on sending the same
> command the next time it tries:
>
>          default:
>            warn ("%s:%d cxnsleep response unknown: %d %s", peerName,
>                  cxn->ident, code, response) ;
>            cxnSleepOrDie (cxn) ;
>
> Therefore, innfeed will be blocked.  Maybe other news server will also
> block the same way :-/

Yeah, I was afraid of that.

> Incidentally, innfeed has a lot of different cases to understand other
> broken implementations.  For instance, it accepts 439 answers to CHECK
> (which is not a valid answer -> 438 is the one) because NNTPRelay does
> that (according to a comment).  I do not mind if such cases exist.  But
> we're also introducing bad things with the handling of 501 if we return
> 438/439 instead.

Yes.  That makes a strong argument for not returning 501.  (I wish I had
time to put together a web page with details like this about the NNTP
protocol.)

> Another amusing thing to answer to innfeed is another message-ID:
>
>  [C] CHECK <mid1>
>  [S] 239 <mid2>
>
> It will go into sleep mode.  Shouldn't the right behaviour be to ignore
> this 239 answer and consider we still haven't got an answer for <mid1>?

Isn't that what it's doing in sleep mode -- waiting for another reply from
the remote server?  (I haven't looked at the code.)

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: Questions about datastream answers (especially to TAKETHIS)
#80439
Author: Russ Allbery
Date: Mon, 23 Mar 2009 01:48
42 lines
3448 bytes
Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:

> More a hack than anything else but if we have received "CAPABILITIES"
> previously in the session, we send "501 the whole byte string"
> (RFC-compliant); otherwise, "439 the whole byte string" (not
> RFC-compliant).

> But well, it is not very proper...

Plus, the text after 501 is not specified by the standard, so there still
isn't any clue in the standard that the client is supposed to use that to
figure out what message the 501 refers to.  (We should reply in order and
the remote site should rely on that, but I don't think current
implementations do that.)

> In both cases, RFC 4644 needs an addendum to say:
> * either that generic responses will include that byte string (which can
>  be a well-formed message-ID for instance after 480, 483, etc.);
> * or that 438/439 is always sent in such cases and that their answer is
>  always the whole byte string.
>
> I would of course prefer the first one.

Or that clients must remember the order of their CHECK or TAKETHIS
commands and use that to match up the 501 response.  I believe that
streaming still requires that the replies match the order of commands.

Ideally, we should modify innfeed to support that as well.  I'm not sure
how much work that would be, though.  (Potentially quite a lot.)

> And we still do not handle the case of a "whole byte string" whose size
> is greater than the maximum allowed (for instance 600 bytes -> we must
> truncate it after 501 or do something else).

Well, at that point the client is breaking the NNTP protocol badly enough
that I'm not sure there's much we can do.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: Questions about datastream answers (especially to TAKETHIS)
#80440
Author: Julien ÉLIE
Date: Mon, 23 Mar 2009 18:49
18 lines
2247 bytes
Hi Russ,

> Or that clients must remember the order of their CHECK or TAKETHIS
> commands and use that to match up the 501 response.  I believe that
> streaming still requires that the replies match the order of commands.

RFC 4644 does not speak about the order of commands AFAIK.  Therefore,
the following MUST of RFC 3977 applies:

    Irrespective of whether pipelining is used, the server MUST process
    commands in the order they are sent.

-- 
Julien ÉLIE

« Il buvait toutes mes paroles, et comme je parlais beaucoup,
  à un moment, je le vois qui titubait... » (Raymond Devos) 
Re: Questions about datastream answers (especially to TAKETHIS)
#80441
Author: Julien ÉLIE
Date: Mon, 23 Mar 2009 18:49
32 lines
2693 bytes
Hi Russ,

>> Therefore, innfeed will be blocked.  Maybe other news server will also
>> block the same way :-/
>
> That makes a strong argument for not returning 501.

Then, let's return 439 with innd and, as you suggested, also accept 501
with innfeed.  The best would be if innfeed only uses the response code
and never the message-ID in argument.


>> Another amusing thing to answer to innfeed is another message-ID:
>>
>>  [C] CHECK <mid1>
>>  [S] 239 <mid2>
>>
>> It will go into sleep mode.  Shouldn't the right behaviour be to ignore
>> this 239 answer and consider we still haven't got an answer for <mid1>?
>
> Isn't that what it's doing in sleep mode -- waiting for another reply from
> the remote server?  (I haven't looked at the code.)

Yes, innfeed waits for another reply.  It marks all the articles as deferred
and starts spooling.

-- 
Julien ÉLIE

« Prouidentia, dum ortum ante obitum ponit, sapienter fecit,
  sin autem quid uitae sit notum ? » (Alphonse Allais) 
Re: Questions about datastream answers (especially to TAKETHIS)
#80442
Author: Russ Allbery
Date: Mon, 23 Mar 2009 19:24
23 lines
2356 bytes
Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:

>>> Another amusing thing to answer to innfeed is another message-ID:
>>>
>>>  [C] CHECK <mid1>
>>>  [S] 239 <mid2>
>>>
>>> It will go into sleep mode.  Shouldn't the right behaviour be to ignore
>>> this 239 answer and consider we still haven't got an answer for <mid1>?

>> Isn't that what it's doing in sleep mode -- waiting for another reply
>> from the remote server?  (I haven't looked at the code.)

> Yes, innfeed waits for another reply.  It marks all the articles as
> deferred and starts spooling.

That seems vaguely correct to me, but I may be missing something.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: Questions about datastream answers (especially to TAKETHIS)
#80443
Author: D. Stussy
Date: Mon, 23 Mar 2009 21:34
34 lines
3000 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message
news:gq69ao$ni0$1@news.trigofacile.com...
> > If I understand the question properly, I believe the best course of
action
> > for a TAKETHIS command with a bad parameter is:
> > 1) Return the appropriate error code (asychronously with the transfer
of
> > the message?), and
> > 2) Simply absorb and discard everything that is transferred up to the
next
> > end-of-message marker.
> > The discarded message's MID shall NOT be added to the history archive
(so
> > it may be accepted via a different source that isn't buggy).
>
> Sure:  the discarded message-ID should not be remembered.
>
> The question we are discussing is more "what the client understands if
> the server sends the appropriate code" (the client does not currently
> expect appropriate codes!) than "what the server does with what it
> receives".
> The problem is that appropriate codes have been made mandatory
> by RFCs 3977+4644 (I think RFCs 977+2980 were also encouraging
appropriate
> codes) but it appears that clients (INN [innfeed] and Diablo [dnewslink]
> affected, amongst others) are not expected them during streaming.
> That's why I wondered what we should do.

Since NNTP borrows alot from the mail system, perhaps what RFC-2821 says
about SMTP should be applied to unknown states:  Accept error replies that
aren't otherwise known based on their leading digit (4 or 5 imply temp and
perm-errors for SMTP).

Re: Questions about datastream answers (especially to TAKETHIS)
#80444
Author: Julien ÉLIE
Date: Tue, 24 Mar 2009 06:43
40 lines
3208 bytes
Hi D. Stussy,

> Since NNTP borrows alot from the mail system, perhaps what RFC-2821 says
> about SMTP should be applied to unknown states:  Accept error replies that
> aren't otherwise known based on their leading digit (4 or 5 imply temp and
> perm-errors for SMTP).

It is also what RFC 3977 suggests.  The problem is that it is not currently
implemented in news servers.

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

      1xx - Informative message
      2xx - Command completed OK
      3xx - Command OK so far; send the rest of it
      4xx - Command was syntactically correct but failed for some reason
      5xx - Command unknown, unsupported, unavailable, or syntax error

   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 - Reserved for authentication and privacy extensions
      x9x - Reserved for private use (non-standard extensions)

   If a client receives an unexpected response, it SHOULD use the first
   digit of the response to determine the result.  For example, an
   unexpected 2xx should be taken as success, and an unexpected 4xx or
   5xx as failure.

-- 
Julien ÉLIE

« Pourquoi les programmeurs confondent-ils Halloween et Noël ?
  Parce que OCT 31 == DEC 25. » 
Re: Questions about datastream answers (especially to TAKETHIS)
#80533
Author: Curt Welch
Date: Thu, 09 Apr 2009 18:22
45 lines
3780 bytes
Russ Allbery <rra@stanford.edu> wrote:
> Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:
>
> > Oh hmm...  If that's so, should we really send 501 to:
> >
> >   [C] TAKETHIS bad-mid and/or four arguments
> >   [C] From: ...
> >   [C] (with a valid article)
> >   [C] .
> >
> > We will get desynchronized the same way.
> > If 501 can be sent in that case, so does 403...
>
> I think we didn't discuss this in the working group since this case is so
> much less common.  In this case, the TAKETHIS client is actually broken,
> so who knows what horrible thing it's going to do.  We don't have as good
> of a chance of doing the right thing.

An old bug I remember having to code around related to this was that Diablo
used to (and maybe still does?) allow spaces in message-ids.  Every once in
a great while, a Diablo server would try to send an article with a space in
it.  My code incorrectly rejected the TAKETHIS as an invalid command (too
many arguments) and as such, never tried to read the article which
followed.  That of course broke the protocol and all hell broke loose.  Or
it would reject the CHECK as invlid, and Diablo would keep resending the
same article over and over.

To fix this, I had to write the code to accept and deal with those
otherwise very invalid Message-IDs and reject them correctly.  So, for
CHECK and TAKETHIS, and IHAVE I had to use completely different argument
parsing code to make this work correctly.

Though it's fine to say Diablo was broken, the fact was that a lot of my
peers used it, and as such, I had to deal with it.

These are some of the things you just can't specify with the RFC because
it's stupid to require servers to deal with broken Message-IDs in the RFC
but yet when you find your server is talking to one, you have to do
something to make it work.   It's just the stuff you have to deal with when
you find it in the wild.  I don't know if it's possible to write a working
server from the spec alone.  It certainly didn't used to be.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                                        http://NewsReader.Com/
Re: Questions about datastream answers (especially to TAKETHIS)
#80532
Author: Curt Welch
Date: Thu, 09 Apr 2009 19:11
93 lines
6619 bytes
Julien_ÉLIE <iulius@nom-de-mon-site.com.invalid> wrote:
> Hi Russ,
>
> >> The solution you suggest is the cleanest thing to do and complies with
> >> RFCs.  The only issue is that it is not documented ("501 bad-mid" is
> >> both not forbidden and not mentioned).
> >>
> >> Should we go on that way?
> >
> > It makes me a little uneasy, since 501 is really the correct response,
> > but I can see the justification for it.  I wonder if anyone else has an
> > opinion on what should be done in this corner case.
>
> More a hack than anything else but if we have received "CAPABILITIES"
> previously in the session, we send "501 the whole byte string"
> (RFC-compliant); otherwise, "439 the whole byte string" (not
> RFC-compliant).
>
> But well, it is not very proper...
>
> In both cases, RFC 4644 needs an addendum to say:
> * either that generic responses will include that byte string (which can
>   be a well-formed message-ID for instance after 480, 483, etc.);
> * or that 438/439 is always sent in such cases and that their answer is
>   always the whole byte string.
>
> I would of course prefer the first one.
>
> And we still do not handle the case of a "whole byte string" whose size
> is greater than the maximum allowed (for instance 600 bytes -> we must
> truncate it after 501 or do something else).
>
> Or it can also be assumed that RFC 4644 does not need an addendum and is
> well as-is, which is fine except for the absence of message-ID (the
> client will not know which command has triggered the problem).  This
> solution, as well as the first one, still has the disadvantage of not
> being compatible with current NNTP implementations :-/
> And the second solution, though fine with current implementations,
> prevents the use of useful code responses.

Ok, so I'm jumping in to this thread late, and haven't read the rest of the
responses yet.

My thought is that it's very wrong to assume the client needs the
message-id argument in order to correctly match up a response with commands
sent. It just doesn't need them.  The correct way to write a client is to
queue up the commands and match the responses to the commands as they come
back. It's rival to code.  At the same time, the server must keep track of
what has been sent, but not responded to, so that it can correctly re-queue
articles in the case of a dropped connection. So if you get a 5xx response,
you know something has gone wrong and you know which article it was for and
the client shouldn't try to resend.

I've not read the current RFCs but I hope the protocol hasn't been broken
by the new RFC allowing the response to come back out out of order.

The reason one would choose not to code it correctly like that, is because
they don't care to correctly handle errors.  And if they don't care to
correctly handle errors, then it really makes little difference what you
send back to them.  They have probably written the code to do something
simple like never retry (spam injector or other stupid client), or they
simply retry everything that is not accepted or rejected a few times, and
then give up and simply ignore all other returns.

I would actually vote for NOT sending the message-id back with the response
on any of the commands to prevent people from being sloppy in the coding
(if such an option was possible to vote for which it is not at this point).

I hav no issue at all with sending 5xx codes back (without the Message-ID
argument) for all errors.  I actually think it's far more useful to put a
descriptive error (what the error was) on the 5xx code than to replace a
useful message with the mostly useless and redundant Message-ID.  There are
a ton of reasons why a TAKETHIS my be considered invalid.  Such as the
invalid Message-ID syntax or size, or the command being too long.  Or what
do you do when the Message-ID in the article sent doesn't actually match
what was in the article that was sent?  Or if the article itself has major
format issues, like a Missing Message-ID, or dup Message-IDs?

Those issues show up when transit servers have disk corruption issues and
they end up sending garbage for an article.  If you respond with a 5xx code
with an argument saying "Missing message-id in article", it's more likely
that error ends up the log file of the sending server, and helps the admin
on the sending side realize he's got an corruption problem than if you
silently reject the article with a 4xx code or reject it with a 5xx code
with nothing but a Message-ID argument.

Again, I've not read the RFCs so I'm not making an argument about how all
this is specified in the RFC (since I don't know), but just talking from
practical experience of writing servers and making them work.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                                        http://NewsReader.Com/
Re: Questions about datastream answers (especially to TAKETHIS)
#80534
Author: Curt Welch
Date: Thu, 09 Apr 2009 19:24
31 lines
3182 bytes
Russ Allbery <rra@stanford.edu> wrote:
> Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:

> > Another amusing thing to answer to innfeed is another message-ID:
> >
> >  [C] CHECK <mid1>
> >  [S] 239 <mid2>
> >
> > It will go into sleep mode.  Shouldn't the right behaviour be to ignore
> > this 239 answer and consider we still haven't got an answer for <mid1>?

I think the correct thing is to assume the 239 IS for the check it should
match up with.

As I ranted a little bit in my last message, clients should _always_
(streaming or not streaming) be smart enough to match responses to the
commands they sent.

I believe the odds that a server will send back responses out of order is
far less likely, then the odds that the server will get the argument wrong
for some reason (like sending the message-id from the article instead of
from the TAKETHIS command argument).  So I would think the most logical way
to code the client is to match up responses per the protocol, and deal with
it as you should, instead of writing complex code that assumes the server
is sending back extra responses, or sending back responses out of order.
(unless you actually saw a server doing that and you were writing the code
to deal with that specific server).

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                                        http://NewsReader.Com/
Re: Questions about datastream answers (especially to TAKETHIS)
#80535
Author: Julien ÉLIE
Date: Thu, 09 Apr 2009 21:38
31 lines
2642 bytes
Hi Curt,

>> >  [C] CHECK <mid1>
>> >  [S] 239 <mid2>
>
> I think the correct thing is to assume the 239 IS for the check it should
> match up with.

It normally should match.


> I believe the odds that a server will send back responses out of order is
> far less likely, then the odds that the server will get the argument wrong
> for some reason (like sending the message-id from the article instead of
> from the TAKETHIS command argument).

Diablo still uses the message-ID from the article for TAKETHIS answers.

Note that it is not valid by RFC 4644:

   The first parameter of the 239 and 439 responses MUST be the
   message-id provided by the client as the parameter to TAKETHIS.


(And what should be done was not clear at all in RFC 2980.)

-- 
Julien ÉLIE

« Moi, je n'ai pas goûté le sel de cette plaisanterie. » (Astérix) 
Re: Questions about datastream answers (especially to TAKETHIS)
#80537
Author: Julien ÉLIE
Date: Thu, 09 Apr 2009 21:48
36 lines
2900 bytes
Hi Curt,

> The correct way to write a client is to
> queue up the commands and match the responses to the commands as they come
> back.

It is indeed proper to do.


> I've not read the current RFCs but I hope the protocol hasn't been broken
> by the new RFC allowing the response to come back out out of order.

Responses are still required to come back in order.


> Or what
> do you do when the Message-ID in the article sent doesn't actually match
> what was in the article that was sent?

It is not specified in RFC 4644.  I believe such articles *may* be accepted
(though they should not have been sent this way).
The reason I see is that RFC 3977 explicitly allows such a discrepancy
for IHAVE (an example is even provided).  So the same should apply to TAKETHIS.

   Example of sending an article to another site that rejects it.  Note
   that the message-id in the IHAVE command is not the same as the one
   in the article headers; while this is bad practice and SHOULD NOT be
   done, it is not forbidden.

I for one think they should be rejected.  It is proper.

-- 
Julien ÉLIE

« En vérité, le chemin importe peu, la volonté d'arriver suffit à tout. » 
Re: Questions about datastream answers (especially to TAKETHIS)
#80536
Author: Julien ÉLIE
Date: Thu, 09 Apr 2009 21:53
17 lines
2018 bytes
Hi Curt,

> An old bug I remember having to code around related to this was that Diablo
> used to (and maybe still does?) allow spaces in message-ids.

This Diablo bug was fixed in V1.15 according to their release notes:
    "Spaces no longer tolerated inside message-id's."

I see that release V1.29 was in 2000.


-- 
Julien ÉLIE

« Dieu a dit : il faut partager. Les riches auront la nourriture,
  les pauvres de l'appétit. » (Coluche)
Re: Questions about datastream answers (especially to TAKETHIS)
#80538
Author: Curt Welch
Date: Fri, 10 Apr 2009 01:17
17 lines
2351 bytes
=?Windows-1252?Q?Julien_=C9LIE?= <iulius@nom-de-mon-site.com.invalid>
> wrote: Hi Curt,
>
> > An old bug I remember having to code around related to this was that
> > Diablo used to (and maybe still does?) allow spaces in message-ids.
>
> This Diablo bug was fixed in V1.15 according to their release notes:
>     "Spaces no longer tolerated inside message-id's."
>
> I see that release V1.29 was in 2000.

Good to hear that was done.  It was a messy thing to have to deal with on
the receiving end.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                                        http://NewsReader.Com/
Re: Questions about datastream answers (especially to TAKETHIS)
#80539
Author: Julien ÉLIE
Date: Fri, 10 Apr 2009 06:05
22 lines
2460 bytes
Hi Curt,

> I have no issue at all with sending 5xx codes back (without the Message-ID
> argument) for all errors.
[...]
> Again, I've not read the RFCs so I'm not making an argument about how all
> this is specified in the RFC (since I don't know), but just talking from
> practical experience of writing servers and making them work.

The problem is that currently wide-spread news servers like INN and Diablo
do not expect such 5xx answers in response to CHECK or TAKETHIS.
innfeed for instance will keep trying to send the CHECK or TAKETHIS.

Thus, it is difficult to start sending 5xx codes.  How could we make it work?
News servers should understand 5xx answers first...

-- 
Julien ÉLIE

« Commencez à creuser des trous pour planter les piquets.
  De beaux trous normands ! » (Astérix)
Re: Questions about datastream answers (especially to TAKETHIS)
#80540
Author: Curt Welch
Date: Fri, 10 Apr 2009 16:08
79 lines
6053 bytes
=?Windows-1252?Q?Julien_=C9LIE?= <iulius@nom-de-mon-site.com.invalid>
> wrote: Hi Curt,
>
> > I have no issue at all with sending 5xx codes back (without the
> > Message-ID argument) for all errors.
> [...]
> > Again, I've not read the RFCs so I'm not making an argument about how
> > all this is specified in the RFC (since I don't know), but just talking
> > from practical experience of writing servers and making them work.
>
> The problem is that currently wide-spread news servers like INN and
> Diablo do not expect such 5xx answers in response to CHECK or TAKETHIS.
> innfeed for instance will keep trying to send the CHECK or TAKETHIS.
>
> Thus, it is difficult to start sending 5xx codes.  How could we make it
> work? News servers should understand 5xx answers first...

Ok, I took a look at some of the code I wrote 10 years ago to see what it
would do and spent some time thinking about this.  I've got to change what
I said before.

Any unexpected result code (including 5xx) is taken to be some sort of
random error from the receiving server and as such, the article is not
thrown away, but kept on the queue.  And at the same time my server would
close the connection and try again after a delay like a minute or more
(under the assumption that something bad was happening).  So if you send
back a 5xx code to my server, it's going to keep trying to send the same
article over and over again as well.

The problem is that it's very important not to accidentally drop articles.
You can't assume you are feeding a server with redundant feeds.  Feeds must
work correctly even if it's only a single feed.  So the sending server has
to error on the side of caution and not drop articles whenever something
unexpected happens.

After thinking a bit more about it, it's clear that the idea at work here
is that if the receiving server doesn't correctly reject the article with
the correct 4xx code, or accept it with the correct 2xx code, then the
article is going to get stuck in the queue and be sent over and over.

So there's just no way given the current state of things, to start ending
5xx result codes to mean "reject article because of bad error".  And I
think the bottom line is that there's really little point to it as well.

The bottom line, is that when receiving a feed, the server must do it's
best to accept whatever is sent, and for all errors such as invalid
message-id or command syntax errors, send back the best reject response you
can or else you could end with a jammed feed.  Unless you think the error
is so bad that you would want to feed to jam.  But normally, when the
sending side can't do what seems to be the "right thing", you want to tell
it to stop bothering you, which means, sending back reject codes.

The other thing I had forgotten because it's been so long since I had to
deal with this, is that many servers do send back extra information on the
reject codes (after the message-id) to explain why it was rejected.  I
don't remember if that practice was part of the standard or not, but over
the years, I ended up adding a lot of special code to my server to look at
that information and do special things with it - but just for logging and
statistic tracking, not for changing the basic nature of the protocol.

For example, some would tell you the article was rejected because it was
too large.  When I saw that, my server would spit out special log messages
that included the size of the article I tried to send.  That made it
possible for me to look at my logs and know what size articles a peer
wanted (and adjust what I was sending them), without having to talk to the
other admin.  I had lots of special code like that in my server.

Because you can send back extra information like that, and at least some
servers (mine :)) would log such data so the admin could see it, then we
have a way already to let the admin of the sending side know his server is
doing bad things without having to do it with 5xx codes.

Is the ability to add information to the end of the result code after the
message-id part of the standard?  Or was it just something people started
doing?

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                                        http://NewsReader.Com/
Re: Questions about datastream answers (especially to TAKETHIS)
#80542
Author: Julien ÉLIE
Date: Fri, 10 Apr 2009 17:30
84 lines
5188 bytes
Hi Curt,

Thanks a lot for your very detailed article!


> Any unexpected result code (including 5xx) is taken to be some sort of
> random error from the receiving server and as such, the article is not
> thrown away, but kept on the queue.  And at the same time my server would
> close the connection and try again after a delay like a minute or more
> (under the assumption that something bad was happening).  So if you send
> back a 5xx code to my server, it's going to keep trying to send the same
> article over and over again as well.

Yep, it is similar as what I see in INN and Diablo.
It looks as though nothing else than 438/439 is expected in response to
CHECK and TAKETHIS to reject an article.  A 5xx error is not handled.
Yet, 501 should be what a news server answers when the syntax is not
correct and there is no reason why, upon sending the same article again,
another response code than 501 will be sent.  So it should be assumed
that it is a reject.  Maybe it is a widespread bug in all news servers:
they should not block that way in an endless loop.

I understand that 502 should *not* be considered as a reject, as well as
503 and 504.  502 may turn into something else after some time.  503 and 504
are unexpected answers for CHECK/TAKETHIS.
I think that only 500 and 501 should be considered as a reject in 5xx answers.
And not lead to an endless loop.


> The problem is that it's very important not to accidentally drop articles.

I agree with you.


> You can't assume you are feeding a server with redundant feeds.  Feeds must
> work correctly even if it's only a single feed.  So the sending server has
> to error on the side of caution and not drop articles whenever something
> unexpected happens.

Well, 501 is not unexpected.  It can be returned in response to TAKETHIS!
For instance if the message-ID is too long or, as you took that example,
if it contains a space.


> So there's just no way given the current state of things, to start ending
> 5xx result codes to mean "reject article because of bad error".

However, news servers should start *understanding* 5xx result codes.


> The bottom line, is that when receiving a feed, the server must do it's
> best to accept whatever is sent, and for all errors such as invalid
> message-id or command syntax errors, send back the best reject response you
> can or else you could end with a jammed feed.

Unfortunately, it is not said in current RFCs.  I understand that it is
currently better to send 439 and not 501, thus breaking the protocol,
but making everything work.


> I don't remember if that practice was part of the standard or not, but over
> the years, I ended up adding a lot of special code to my server to look at
> that information and do special things with it - but just for logging and
> statistic tracking, not for changing the basic nature of the protocol.

Good idea!  That's indeed great to do that.
As for INN, only nnrpd currently sends additional comments; innd does not.


> Is the ability to add information to the end of the result code after the
> message-id part of the standard?  Or was it just something people started
> doing?

It is part of the standard.

     initial-response-line =
           initial-response-content [SP trailing-comment] CRLF

-- 
Julien ÉLIE

« Commencez à creuser des trous pour planter les piquets.
  De beaux trous normands ! » (Astérix) 
Re: Questions about datastream answers (especially to TAKETHIS)
#80543
Author: Curt Welch
Date: Fri, 10 Apr 2009 20:14
106 lines
8016 bytes
=?ISO-8859-15?Q?Julien_=C9LIE?= <iulius@nom-de-mon-site.com.invalid> wrote:

> > You can't assume you are feeding a server with redundant feeds.  Feeds
> > must work correctly even if it's only a single feed.  So the sending
> > server has to error on the side of caution and not drop articles
> > whenever something unexpected happens.
>
> Well, 501 is not unexpected.  It can be returned in response to TAKETHIS!
> For instance if the message-ID is too long or, as you took that example,
> if it contains a space.
>
> > So there's just no way given the current state of things, to start
> > ending 5xx result codes to mean "reject article because of bad error".
>
> However, news servers should start *understanding* 5xx result codes.

Well, I think this is just one of those cases where the RFC doesn't match
what's actually done in the real world.  If none of the servers can deal
correctly with 5xx codes, then you have to question who's fault this
mismatch between the RFC and reality is.  Are the servers wrong, or is the
RFC wrong?  You might be the first person in the entire history of Usenet
to actually try to write code from the RFC because it's only been very
recently that there was an RFC that was detailed and complete enough to do
that - all the old RFCs were far to vague and inconsistent (and in some
cases just dead wrong) in too many important areas to do that.  The RFCs
were at best starting guides, with all the real work done by testing the
code in the wild and adjusting until it worked (and by reading INN source
code, etc).  When there was a conflict between the RFC, and INN source, the
INN source was considered the authority, not the RFC.  So is this maybe
something we should just consider the RFC to be wrong about?

News feeds are very tricky things - they are by far the most complex and
tricky part of Usenet to get right.  The problem is that both sides are
automated in a news feed and must (as best as is possible) keep working
when unsupervised.  Not to mention the sheer complexity of making streaming
feeds work well

There are two major ways to error on news feeds - either the feed drops
articles, but otherwise keeps working, or it hangs - which means the feed
is down until one (or worse both) admins takes the time to research and fix
the problem.  Both errors are very bad.  Admins don't have the time to keep
hand holding feeds that keep breaking, and Usenet doesn't work if articles
get dropped randomly for poor reasons.  Will trying to add support for 5xx
codes in a feed make things better, or worse?

The problem, is that when the feed is working correctly, you will normally
never see a 5xx response, so testing your feed code to make sure you
implemented the response to a 5xx correctly will be difficult.  It will be
a special case condition that may never be tested, when the server is
written, or changes are made - unless the developer has a very advanced
code test environment that is used after every change to the server.  If we
design the protocol, and write the RFC, so that the only codes used, are
ones that are expected to be very common in normal usage, then it's far
more likely that the code is working correctly, if you simply run it for a
real feed - without having to create a complex test driver.

The type of problem that could show up, is an edge case where one brand
server accepts a given format Message-id, and others reject it with 501.
Everything could be working fine for years, simply because no one ever
tried to create an article with one of the special edge-case ids.  But
then, one day, someone sends one out, and it could shut down large parts of
Usenet if the result is feeds that block while they keep trying over and
over to send the weird article and having to drop and restart the feed
every time it gets that 501 error back.

So the idea here, is if you limit the protocol design to only use a very
small set of response codes - and most important, all the response codes
normally show up very frequently in real feeds, then the odds of a future
melt-down of Usenet is reduced, because if feed code can last a week
without propblems, it can probably last 10 years.

My gut at the moment (though my mind on these things can change hourly when
I think of new issues), is that expecting servers to recognize and respond
correctly to a rare 501 to mean "reject" would cause more problems in the
long run, rather than less.

Ah, I think I just thought up another way 501 for "reject" might cause an
issue.

One issue that happens in some servers, is that they send articles from
disk without checking for proper dot protocol.  If their disk data gets
corrupted (disk errors/server crash leaving disk data corrupted), they can
sometimes send invalid data - such as a CR LF DOT CR LF in the middle of
the article without realizing it happened.  The receiving system then
starts to read some raw article data as if they were commands, and then
starts to do things like send 5xx codes back as errors.  When something
like that happens, you don't want the sending server to just start dropping
all the articles from the queue.  You want the queue to hang, until the
admin on the sending side fixes his problem.  If it takes any of the 5xx
responses to mean reject, then the entire feed could just get flushed or
dropped causing some very large blocks of articles to be lost and making it
very hard to re-feed the lost articles since there is probably no good
documentation on what was lost.

It just seems far safer to me to allow the sending system to see all 5xx
codes to mean "something is really messed up - stop trying to send and try
again later" instead of trying to make 501 mean reject while leaving all
other 5xx codes to mean stop sending and try again later.  Even though this
might make the RFC seem kludge, (not being able to specify 501 for _all_
commands) I suspect it makes the protocol better.

It seems to be a complex question no matter how you look at it. :)

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                                        http://NewsReader.Com/
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