🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #46530

Re: Encoding binary data

#46530
From: Curt Welch
Date: Sat, 20 May 2000 00:00
69 lines
4190 bytes
Russ Allbery <rra@stanford.edu> wrote:
> Curt Welch <curt@kcwc.com> writes:
>
> > Newer news servers avoid all this by not converting the articles when
> > they are saved.  They save them in raw NNTP format (wire format as it's
> > commonly called), so when it's read back by a newsreader, the LFs, and
> > CRs, and CR LFs, are all preserved correctly, and for those, you can
> > actually get away with using raw binary formats in articles.

> It's certainly *possible* to handle raw binary, but it's overly
> optimistic to say that existing newer news servers that use wireformat
> storage all do so.

True, that's why I didn't say that :).

But I did say "newer servers" work, and that's not really true like you
point out because some of the newest (latest release of INN ?), even though
they do use a wire format to avoid the problems of conversion, elect not to
allow pure binary for other reasons.

> >> Yes.  You're going to need to do some sort of encoding at least to
> >> avoid the sequence CRLF.CRLF in the body of the message (normally
> >> dot-stuffing is used),
>
> > dot-stuffing is _required_, not just _normally used_.
>
> Not quite true.
>
> What is *required* is that one not send "CR LF . CR LF" except at the end
> of the article.  Dot-stuffing is the method a program speaking NNTP
> should use to deal with a line beginning with . to avoid causing the
> above problem, but an equally valid way of handling the problem, when you
> control the article encoding, is to just avoid ever generating a period
> at the beginning of a line.  This too will work fine and doesn't require
> dot stuffing.
>
> Remember the context of the discussion.  The person asking these
> questions is considering a customized encoding format.

Well not quite.  It depends on whether the "wire format" of the server
is after or before dot stuffing.

My server for example has zero lines of dot stuff processing code.  It
stores the article in true raw wire format, exactly as it looks on the
wire.  So my server fits your description above.  The _only_ thing it
cares about is that article ends with CR LF . CF LF.  So any technique
to escape that sequence would work fine for my server.

BTW, I also terminate the articles with the DOT in the spool, so that
way, it's simple to parse the spool file and find the begin and end
of all the articles without the need for the indexes.

But if a server did the dot de-stuffing when it was received, and put
the dots back on transmission, then you would have a problem.  Any
article which had the CR LF DOT <not-dot> sequence in the data would
be corrupted (or rejected).  But it couldn't make it thought the server
correctly.

I have no idea if there are any servers which otherwise work with binary
data, but require dot stuffing because of this, but... the safest way to
avoid the issue completely, would be to use dot stuffing on your binary
NNTP data (or of course, use any technique to avoid not just CR LF DOT CR
LF, but to avoid any CR LF DOT sequence).

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

Technical Details
Message-ID: <20000520095302.145$8b@newsreader.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
References: <3921BBF8.F251A540@unidata.ucar.edu> <87bt2511sn.fsf@erlenstar.demon.co.uk> <3924568F.463ADE1@unidata.ucar.edu> <yl8zx7m4tm.fsf@windlord.stanford.edu> <20000519124008.263$A6@newsreader.com> <ylln160vy8.fsf@windlord.stanford.edu>

Show Full Headers
Complete Article Headers
Message-ID: <20000520095302.145$8b@newsreader.com>
Subject: Re: Encoding binary data
Date: Sat, 20 May 2000 00:00:00 +0000
From: curt@kcwc.com (Curt Welch)
References: <3921BBF8.F251A540@unidata.ucar.edu> <87bt2511sn.fsf@erlenstar.demon.co.uk> <3924568F.463ADE1@unidata.ucar.edu> <yl8zx7m4tm.fsf@windlord.stanford.edu> <20000519124008.263$A6@newsreader.com> <ylln160vy8.fsf@windlord.stanford.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 625743822
X-User: Curt@NewsReader.Com
X-Face: "p}G*1KH{+F7EYGKLb>ogDguabZ+%,?^epeFB!nzu`)`$=QcvL1KF6<0GH!Tbc!Sqo[|tV5 %IW48mQf3K=Ci&gZ7]]aazx@]Y-nq!r5{yH/#,?@lDdUDvOfByB2hVW0.@OM%{l/{cT'{w
Organization: NewsReader.Com
X-Url: http://CurtWelch.Com/
User-Agent: NewsReader.Com
Newsgroups: news.software.nntp