🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
10 messages
10 total messages Started by Fred J. LeFevre Mon, 17 May 1999 00:00
nntp client - method question
#37516
Author: Fred J. LeFevre
Date: Mon, 17 May 1999 00:00
18 lines
1495 bytes
I have been reading RFC 977, and I have what may be a very simple question.

Let's say a command is issued to a server, the server sends a status response 
and then begins sending textual responses.  Because certain status responses 
may be sent at any time, how can the client ascertain with certainty that a 
given response is textual or status?

I recognize that the status response will always begin with the 3-digit code, 
however, it seems to me a 3-digit code at the start of some line in a text 
message would not be that unusual.
-- 
------------------------------------------------------------------------
Fred J. LeFevre                                          FJFevre@IBM.net
6307 Hammel Avenue                                        (513) 631-7881
Cincinnati, Ohio 45237-4905


Re: nntp client - method question
#37503
Author: Greg Andrews
Date: Mon, 17 May 1999 00:00
16 lines
1306 bytes
fjfevre@ibm.net (Fred J. LeFevre) writes:
>I have been reading RFC 977, and I have what may be a very simple question.
>
>Let's say a command is issued to a server, the server sends a status response 
>and then begins sending textual responses.  Because certain status responses 
>may be sent at any time, how can the client ascertain with certainty that a 
>given response is textual or status?
>

The RFC defines which commands will receive single-line responses
and which will receive multi-line responses.  That's how the client
knows what to expect.

  -Greg

Re: nntp client - method question
#37520
Author: Fred J. LeFevre
Date: Mon, 17 May 1999 00:00
33 lines
2087 bytes
I guess I was fixating on the sentence in 2.4.2, "In addition, below is listed 
a general set of response codes that may be received at any time.".

Can a client make the assumption that the server will end textual response via 
the single line containing only a period before sending one of these section 
2.4.3 General Responses such as '400 service discontinued'?

In article <7hpipj$igb$1@shell1.ncal.verio.com>, gerg@shell1.ncal.verio.com 
says...
>
>fjfevre@ibm.net (Fred J. LeFevre) writes:
>>I have been reading RFC 977, and I have what may be a very simple question.
>>
>>Let's say a command is issued to a server, the server sends a status response 
>>and then begins sending textual responses.  Because certain status responses 
>>may be sent at any time, how can the client ascertain with certainty that a 
>>given response is textual or status?
>>
>
>The RFC defines which commands will receive single-line responses
>and which will receive multi-line responses.  That's how the client
>knows what to expect.
>
>  -Greg

-- 
------------------------------------------------------------------------
Fred J. LeFevre                                          FJFevre@IBM.net
6307 Hammel Avenue                                        (513) 631-7881
Cincinnati, Ohio 45237-4905


Re: nntp client - method question
#37525
Author: Fred J. LeFevre
Date: Tue, 18 May 1999 00:00
39 lines
2833 bytes
In article <19990518164439.847$Gi@newsreader.com>, curt@kcwc.com says...
>
>fjfevre@ibm.net (Fred J. LeFevre) wrote:
>> I guess I was fixating on the sentence in 2.4.2, "In addition, below is
>> listed a general set of response codes that may be received at any
>> time.".
>
>> Can a client make the assumption that the server will end textual
>> response via the single line containing only a period before sending one
>> of these section 2.4.3 General Responses such as '400 service
>> discontinued'?
>
>I've never heard of a server which did that.  But more important, you
>don't need to worry about it.  It's unreasonable (and downright wrong)
>to assume a client will look for those responses imbedded in a text
>response from the server.  You might get a response code at any time (like
>while the line is idle) telling you the connection has been closed.  But
>the newer RFCs say the server should not send that.  In practice, you only
>need to look for those responses after you have sent a command.

I guess I'm not making myself clear.  RFC 977 has an example in section 4.5 
entitled "Example 5 - interruption due to operator request".  In that example, 
the server prematurely ends the textual response via sending "." before sending 
the 400 status response.  This seems very reasonable to me, however, the RFC 
doesn't seem to dictate that behavior.  My question is whether the client can 
always assume that behavior.  I think from your answer, you imply the server 
will always end the textual response, even prematurely, by sending the "." 
line.  That's what I wanted to know.

As far as servers following newer RFC's, (or current drafts), I don't think I 
want to depend upon that!     
-- 
------------------------------------------------------------------------
Fred J. LeFevre                                          FJFevre@IBM.net
6307 Hammel Avenue                                        (513) 631-7881
Cincinnati, Ohio 45237-4905


Re: nntp client - method question
#37531
Author: Russ Allbery
Date: Tue, 18 May 1999 00:00
22 lines
1719 bytes
Fred J LeFevre <fjfevre@ibm.net> writes:

> I guess I'm not making myself clear.  RFC 977 has an example in section
> 4.5 entitled "Example 5 - interruption due to operator request".  In
> that example, the server prematurely ends the textual response via
> sending "." before sending the 400 status response.  This seems very
> reasonable to me, however, the RFC doesn't seem to dictate that
> behavior.  My question is whether the client can always assume that
> behavior.  I think from your answer, you imply the server will always
> end the textual response, even prematurely, by sending the "."  line.
> That's what I wanted to know.

I would say that you should be able to depend on that.  Any server that
sends coded replies in the middle of a multi-line response and expects the
client to treat them as something other than just more of the multi-line
response would be pretty severely broken in practice.  I highly doubt any
news clients do that.

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

Re: nntp client - method question
#37532
Author: Greg Andrews
Date: Tue, 18 May 1999 00:00
57 lines
2837 bytes
fjfevre@ibm.net (Fred J. LeFevre) writes:
>
>I guess I was fixating on the sentence in 2.4.2, "In addition, below is
>listed a general set of response codes that may be received at any time.".
>

Are you paraphrasing the RFC's real wording?  My copy of the RFC doesn't
say that.  Section 2.4.2 says:

   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 section that talks about general responses is 2.4.3, which doesn't
say they'll be received "at any time".  It says they'll be received
as the result of certain events:

   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.


>
>Can a client make the assumption that the server will end textual
>response via the single line containing only a period before sending
>one of these section 2.4.3 General Responses such as '400 service
>discontinued'?
>

No, the reverse of that.  The one-line response with the 3-digit code
and english description of the response will come first.  The subsequent
lines of multi-line responses will come after that first line.

It's been a few years since I dug into the RFC deeply, but my recollection
is that the response to any command will be a single line containing the
3-digit response code.  If the code is a 3xx, 4xx, or 5xx code, that one
line is all you'll get.  If you get a 2xx code and the command produces
a multi-line response, then you'll get the rest of the lines until the
end line (.).


  -Greg
-- 
:::::::::::::::::::  Greg Andrews  gerg@netcom.com  :::::::::::::::::::
Fortune Cookie:  Nondeterminism means never having to say you are wrong.
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Re: nntp client - method question
#37535
Author: Curt Welch
Date: Tue, 18 May 1999 00:00
23 lines
1901 bytes
fjfevre@ibm.net (Fred J. LeFevre) wrote:
> I guess I was fixating on the sentence in 2.4.2, "In addition, below is
> listed a general set of response codes that may be received at any
> time.".

> Can a client make the assumption that the server will end textual
> response via the single line containing only a period before sending one
> of these section 2.4.3 General Responses such as '400 service
> discontinued'?

I've never heard of a server which did that.  But more important, you
don't need to worry about it.  It's unreasonable (and downright wrong)
to assume a client will look for those responses imbedded in a text
response from the server.  You might get a response code at any time (like
while the line is idle) telling you the connection has been closed.  But
the newer RFCs say the server should not send that.  In practice, you only
need to look for those responses after you have sent a command.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/

Re: nntp client - method question
#37538
Author: Fred J. LeFevre
Date: Tue, 18 May 1999 00:00
79 lines
4187 bytes
In article <gergFBxvKq.81t@netcom.com>, gerg@netcom.com says...
>
>fjfevre@ibm.net (Fred J. LeFevre) writes:
>>
>>I guess I was fixating on the sentence in 2.4.2, "In addition, below is
>>listed a general set of response codes that may be received at any time.".
>>
>
>Are you paraphrasing the RFC's real wording?  My copy of the RFC doesn't
>say that.  Section 2.4.2 says:
>
>   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.
>
>

Yes, I am paraphrasing the RFC's exact, real wording.  If you'll look a few 
paragraphs down from that which you sited above, you'll see a paragraph that 
begins "The exact response codes that should be expected...".  The last 
sentence in that paragraph is the one I've quoted.  When it says "...below is 
listed a general set of response codes that may be received at any time.", I 
can only think it's refering to the very next section, 2.4.3 General Responses.

>The section that talks about general responses is 2.4.3, which doesn't
>say they'll be received "at any time".  It says they'll be received
>as the result of certain events:
>
>   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.
>

See my comments above.  I believe the RFC does say these responses "may be 
received at any time".

>
>>
>>Can a client make the assumption that the server will end textual
>>response via the single line containing only a period before sending
>>one of these section 2.4.3 General Responses such as '400 service
>>discontinued'?
>>
>
>No, the reverse of that.  The one-line response with the 3-digit code
>and english description of the response will come first.  The subsequent
>lines of multi-line responses will come after that first line.
>
>It's been a few years since I dug into the RFC deeply, but my recollection
>is that the response to any command will be a single line containing the
>3-digit response code.  If the code is a 3xx, 4xx, or 5xx code, that one
>line is all you'll get.  If you get a 2xx code and the command produces
>a multi-line response, then you'll get the rest of the lines until the
>end line (.).
>

It might be helpful to point out that the RFC gives a specific example in 
section 4.5  Example 5 - interruption due to operator request.  You'll note 
that this example shows the server terminating textual responses prematurely 
via sending ".", then gives the 400 status response.  My question specifically 
is whether the client can depend on this behavior from the server.  The RFC 
doesn't seem to mandate that behavior, but it sure seems like the best 
approach.
-- 
------------------------------------------------------------------------
Fred J. LeFevre                                          FJFevre@IBM.net
6307 Hammel Avenue                                        (513) 631-7881
Cincinnati, Ohio 45237-4905


Re: nntp client - method question
#37541
Author: Russ Allbery
Date: Tue, 18 May 1999 00:00
51 lines
2767 bytes
Greg Andrews <gerg@netcom.com> writes:

> But Russ, he didn't suggest a status code in the middle of a multi-line
> response.  He said the multi-line response is ended prematurely with the
> proper '.' line, then followed by the 400 status code.

Ah, I see, there are two things going on at the same time here.

> I.e. a response to 'list newsgroups' that would ordinarily return:

>         a 2xx line
>         100 lines of group names
>         a '.' line

> but in Fred's scenario would return:

>         a 2xx line
>         15 lines of group names
>         a '.' line
>         a 4xx line

Oh, no, I really don't think you can rely on that.  I highly doubt most
clients handle it.  The syntax for multiline replies doesn't include
another return code after the trailing ".\r\n".

> Fred, I see where the wording of the RFC allows that.  Based on the list
> of such status messages and the examples given, I think the authors were
> trying to describe the scenarios where the server sends a status line
> that is *not* the response to a command:

I'm pretty sure that NNTP implementations, just like ftp implementations
and most other text-based Internet protocols that aren't IMAP, doesn't
allow asychronous data of any sort.  In other words, at any point in the
protocol you are unambiguously either waiting for data from the server or
the server is waiting for data from you.  If the server is waiting for
data from you, it's not going to send you data (unless it also closes the
connection, something that's hard to miss).

> As a data point, my copy of Trn4 doesn't seem to notice a 503 timeout
> notice from the server until it tries to send a new command.  I'll have
> to trace the client-server conversation to know for sure, though.  It
> might be that the Typhoon server my ISP uses doesn't send the 503 until
> a command is received.

The latter is what I would expect.  That's the recommendation for solving
this same problem in the ftp control channel.

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

Re: nntp client - method question
#37556
Author: greg andruk
Date: Wed, 19 May 1999 00:00
22 lines
1930 bytes
Russ Allbery <rra@stanford.edu> writes:

> I'm pretty sure that NNTP implementations, just like ftp implementations
> and most other text-based Internet protocols that aren't IMAP, doesn't
> allow asychronous data of any sort.  In other words, at any point in the
> protocol you are unambiguously either waiting for data from the server or
> the server is waiting for data from you.  If the server is waiting for
> data from you, it's not going to send you data (unless it also closes the
> connection, something that's hard to miss).

Oh yeah, definitely.  That's not going to be a real-life problem, if
only because it would be a pain to write the server that way.  Even in
a threaded situation, it's easier just to queue up responses than to
try and get fancy with cutting in.

The only exception would be the CHECK/TAKETHIS pair, but newsreaders
don't use those; and even then it's a specific request for
asynchronous responses.
-- 
Misc. Meowing: <URL:http://members.xoom.com/meowing/> **meow**

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