🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #1663

Re: Questions for writing newsreader

#1663
From: Jonathan I. Kamens
Date: Mon, 01 Jun 1992 18:30
69 lines
4885 bytes
In article <lordbah.0zh3@amusing.Bah.Rochester.NY.US>, lordbah@amusing.Bah.Rochester.NY.US (Jeff Van Epps) writes:
|> Is there consensus on the best way to handle long header lines?  Just
|> fold at some random space character, or let the line grow as long as
|> it needs to, or try to preserve any pre-existing folding, or what?

Some headers fields, e.g. Path and Newsgroups, can't be folded.  Well,
actually, RFC 1036 implies that the Path field can be folded, since it says
that "Path: teklabs, zehntel, sri-unix@cca!decvax" is a valid path, and that's
equivalent to "Path: teklabs, zehntel,\n\tsri-unix@cca!decvax", but I don't
know of any software that actually allows Path lines like that :-).

Anyway, since there are some header fields that can't be folded and that can
therefore in essence be arbitrary long, you're software had better be prepared
to deal with arbitrarily long header lines.  The optimal behavior, of course,
is to allow lines as long as there are resources for the program, i.e., do not
impose any limits on line length that the system does not impose on you (in
the form of failed malloc()s, e.g.).  It *is* possible to do this.... look at
Perl or GNU grep, for example.

Among the header fields that *can* be folded, whether or not you choose to
fold them, and in what way, is pretty much up to you.  Whatever you think is
cosmetic.  Yes, folding them at the whitespace character closest to but less
than eighty characters past the beginning of the line is generally recognized
as a reasonable way to do the folding, but beware of problems like ^Hs for
underlining or discarding whitespace in the process of folding (e.g. if you
fold at the first space in a sequence of two spaces, you will only end up with
one space if there is software that unfolds the line later).

Beware, also, that unfortunately it is not unusual, even today, to find
software that chokes on multi-line header fields.  For example, some of the
FAQ postings in news.answers have multi-line Summary fields, and I
occasionally get approved postings mailed to me anyway because some site that
doesn't understand multi-line header fields (usually an ANU-NEWS site using
out-of-date software) chokes on the Summary field and assumes that the message
header ends in the middle of it, before the Approved field is noticed.

|> How long do you let the References: line get?  As long as it needs to?
|> Limit to one or two?

See above in re arbitrarily long header lines.  The References header for a
posting is generally constructed by concatenating the References header of the
message being followed up with some whitespace and the Message-ID header of
the message being followed up; there is generally no reason to prune the
References header.  They can get pretty long, but they don't usually get
*that* long.

|> For followups, I write a template to a file and bring up the editor
|> on that.  Is it best to put in all the normal headers (Keywords, Summary,
|> etc.) so the user can fill them in?  Should they be removed afterward
|> if they are still blank?  Should a user-specified template be added
|> instead of canned headers?

It is a good idea to insert at least some of the optional headers so that the
user knows what is required.  It is also a good idea to verify that the
headers that are not allowed to be non-blank are not blank; even though the
NNTP server is supposed to do this and return an error, that doesn't always
work.  For example, you should not try to feed a message with a blank or
nonexistent Subject header to the NNTP server.

You might as well delete blank header lines before sending the message to the
server, if only to reduce bandwidth.  If you don't delete them, then make sure
that all header lines, including the blank ones, have a space after the colon.

-- 
Jonathan Kamens						jik@MIT.Edu
MIT Information Systems/Athena		    Moderator, news.answers
    (Send correspondence related to the news.answers newsgroup
	{and ONLY correspondence related to the newsgroup}
		 to news-answers-request@MIT.Edu.)
Technical Details
Message-ID: <1992Jun1.183026.23434@athena.mit.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!sparky!uunet!usc!sol.ctr.columbia.edu!destroyer!gumby!yale!mintaka.lcs.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!jik
References: <lordbah.0zh3@amusing.Bah.Rochester.NY.US>

Show Full Headers
Complete Article Headers
Message-ID: <1992Jun1.183026.23434@athena.mit.edu>
Subject: Re: Questions for writing newsreader
Date: Mon, 1 Jun 1992 18:30:26 GMT
From: jik@athena.mit.edu (Jonathan I. Kamens)
References: <lordbah.0zh3@amusing.Bah.Rochester.NY.US>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!sparky!uunet!usc!sol.ctr.columbia.edu!destroyer!gumby!yale!mintaka.lcs.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!jik
Newsgroups: news.software.readers
Sender: news@athena.mit.edu (News system)
Nntp-Posting-Host: pit-manager.mit.edu
Organization: Massachusetts Institute of Technology
Lines: 69