🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
4 messages
4 total messages Started by Daniel Hartmeier Wed, 24 Jun 1998 00:00
How to seperate header from body?
#29332
Author: Daniel Hartmeier
Date: Wed, 24 Jun 1998 00:00
47 lines
2444 bytes
I have a Usenet article saved in a text file just like I received it
from my NNTP server using the ARTICLE command (including header lines).
I could have used the commands HEAD and BODY, but I think the single
ARTICLE command is faster (is that actually true?).

How can a I tell where the header ends and the body begins? RFC977
states that there should be an empty line between header and body. But
most articles I get don't have this empty line and the body immediately
follows the header.

Yet, my newsreader displays the header separately. So how is this done?
Does it 'guess' what could be a header field? Like, a string containing
no spaces, followed by a ':' and a blank? Or does it have a list of all
possible header field names (which grows every day)?

What if someone posts an article like:

  From: foo
  Subject: bar
  Date: 24 Jun 98 14:20:00 GMT
  Question: Foo?
    Some question.
  Answer: Bar!
    Some answer to the question.

What is the newsreader supposed to do? How can it tell whether
'Question: Foo?' is the last line of the header or the first of the
body?

Many articles contain the header 'Lines:' which provides the number of
lines in the body. Though RFC1036 lists this header as optional, I
haven't found an article without it. Is this a save way to calculate the
border between header and body? Is there an faster method (that won't
require counting the lines of the text file)?

If this is answered in a FAQ or RFC, I'd be glad if someone could tell
me the reference.

Thanks for your help,
-- 
Daniel Hartmeier  <daniel@reichardt.ch>  PGP 6A3A7409  ICQ# 12742482

"The woods are lovely, dark and deep.  But I have promises to keep,
And lines to code before I sleep, And lines to code before I sleep."

Re: How to seperate header from body?
#29338
Author: Forrest J. Cavalier III
Date: Wed, 24 Jun 1998 00:00
31 lines
1911 bytes
Posted and emailed

In article <359207eb.28171678@news.reichardt.ch>, daniel@reichardt.ch wrote...
>
>I have a Usenet article saved in a text file just like I received it
>from my NNTP server using the ARTICLE command (including header lines).
>I could have used the commands HEAD and BODY, but I think the single
>ARTICLE command is faster (is that actually true?).
>
>How can a I tell where the header ends and the body begins? RFC977
>states that there should be an empty line between header and body. But
>most articles I get don't have this empty line and the body immediately
>follows the header.
  [snip]

Perhaps you are doing something wrong?  All *valid* Usenet articles
*always* have an empty line between the header and the body.  (That is
what the news server software itself looks for when satisfying HEAD and
BODY requests.)

Find documentation for Usenet software developers organized at:
    http://www.mibsoftware.com/userkt/forsoft.htm

Forrest J. Cavalier III, Mib Software, INN customization and consulting 
'Pay-as-you-go' commercial support for INN: Only $64/hour! 
Searchable hypertext INN docs, FAQ, RFCs, etc: 650+ pages: Free access! 
   http://www.mibsoftware.com/innsup.htm 


Re: How to seperate header from body?
#29340
Author: Todd Fiske
Date: Wed, 24 Jun 1998 00:00
21 lines
1382 bytes
Hi Daniel -

Daniel Hartmeier <daniel@reichardt.ch> wrote in article
<359207eb.28171678@news.reichardt.ch>...
> But most articles I get don't have this empty line and the body 
> immediately follows the header.

Are you using Telnet to port 119 to read these articles? Is it possible
that something in the communcations settings (like line-end configuration)
is not seeing or passing blank lines, ie double LFs or double CR-LFs being
stripped out?

How about within posts? There is a blank line between the first two lines
of this message (the salutation and the attribution stuff), before the "Are
you..." line, and before the "How about..." line. Do you see these?

-tf


Re: How to seperate header from body?
#29345
Author: Andrew Still
Date: Wed, 24 Jun 1998 00:00
50 lines
2945 bytes
On Wed, 24 Jun 1998 14:40:37 GMT, Daniel Hartmeier <daniel@reichardt.ch> wrote:
>I have a Usenet article saved in a text file just like I received it
>from my NNTP server using the ARTICLE command (including header lines).
>I could have used the commands HEAD and BODY, but I think the single
>ARTICLE command is faster (is that actually true?).

Depends on what you need, if you want to get all the headers, and then
get the bodies you've selected from there, you'd use HEAD, then BODY,
if you just want to get all the article at once use ARTICLE.  In other
words, a head command, then a body command should be slower (just from
duplication of actions) then just and article command.

>How can a I tell where the header ends and the body begins? RFC977
>states that there should be an empty line between header and body. But
>most articles I get don't have this empty line and the body immediately
>follows the header.

From this very article on our newserver here:
--------------------------------BEGIN---------------------------------
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Newsreader: Forte Agent 1.5/32.451
Xref: news.panix.com news.software.nntp:49890 alt.usenet.offline-reader:33008

I have a Usenet article saved in a text file just like I received it
from my NNTP server using the ARTICLE command (including header lines).
I could have used the commands HEAD and BODY, but I think the single
--------------------------------END--------------------------------------

You server should have that space there too.  as for the actual
snipping... sed, perl, awk, should all be able to do this.

[snip]
>Many articles contain the header 'Lines:' which provides the number of
>lines in the body. Though RFC1036 lists this header as optional, I
>haven't found an article without it. Is this a save way to calculate the
>border between header and body? Is there an faster method (that won't
>require counting the lines of the text file)?
[snip]

I keep hearing from people on various mail and news related groups
that some clients don't follow this header correctly.

-- 
Those who make peaceful revolution impossible will make violent
revolution inevitable.
				-- John F. Kennedy

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