🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #30264

Re: REPOST: Re: Content-Transfer-Encoding: binary

#30264
From: Forrest J. Cavalier III
Date: Mon, 03 Aug 1998 00:00
113 lines
5608 bytes
In article <slrn6rtb90.qn.usenet@hmmm.colo.erols.net>, usenet@oneill.net wrote...
>
>On 28 Jul 1998 22:43:43 GMT, Curt Welch <curt@kcwc.com> wrote:
>|dillon@best.net (Matt Dillon) wrote:
>|>     Curt, you are severely misinterpreting the RFC's
>|
>|Well, I think it comes down to this.  What we are talking about (i.e. how
>|to send raw binary data over an NNTP connections), isn't defined in any
>|RFC.  As a matter of fact, all the current RFCs say don't do it.  On top of
>|that, no client is currently trying to do it (no common practice to turn
>|to).
>
>IMHO, both of you are wrong.  Transit servers should treat all data
>following the first \r\n\r\n they find as a byte stream where \r\n.\r\n is
>the article terminator.  They should escape \r\n. as \r\n.. until they reach the
>intended end of the article.  Any clients or servers producing articles that
>don't meet this standards are broken.
>
>I don't care what rfc977 says, this is the BCP, and is what both INN and
>Highwind products do to the best of my knowledge.  I'd bet that NNTPRelay
>also does this.  As far as I can tell, rfc1036 is completely irrelevent,
>since the only place where it addresses the body of the message is with the
>optional Lines header.  I personally believe it should be replaced with
>Content-Length.
>
>Matt, I have no idea what you're talking about wrt to LF escaping, but I can
>assure you that INN does no such thing.

Clayton, perhaps you don't remember something correctly.

Removing CR's is exactly the action of the code in nc.c::NCclean().  In
INN 2.0 there is an innconf->wireformat test added around the call to
NCclean() in nc.c::NCproc().

Actually, what the software does internally is irrelevant.  Software
can store articles in EBCDIC as long as the sequence of bytes on output
matches the sequence of bytes on input.  I don't see things the
way Matt does, but his explanation of "LF escaping" seems accurate to me.

Anyway, here is my story (I looked at the code) of what INN does
with Matt's example, in case anyone still cares......

Using Matt's example:
    If the original data is: (I)

        'a' 'b' 'c' LF 'd' CR LF 'b' 'a' 'r' CR LF

("original" meaning "what the newsreader thinks.")  This must go
out to INN as what Matt calls the "escaped" version, because that
is what the NNTP spec says, and for the example I detail below.

    The escaped version is: (II)

        'a' 'b' 'c' CR LF 'd' CR CR LF 'b' 'a' 'r' CR CR LF

This will be what INN gets from a read() of the socket.
(INN doesn't care what the posting news client thought the
"original" actually was.  All it knows is what it got from read().)

In INN 1.x, (and INN 2.0 with wireformat FALSE), NCclean() is called
on this buffer.  NCclean() finds CR LF sequences and replaces them with
LF.  (Note that it does not just blindly strip CR's which would cause
the problem Curt was pointing out.)

The result is stored to disk as this: (III)
        'a' 'b' 'c' LF 'd' CR LF 'b' 'a' 'r' CR LF

This happens to match Matt's original, but that is irrelevant in
modern servers, which don't have local readers.  If you have local
readers it is very relevant.

When innxmit (or innfeed) sends this file, an LF is always preceeded
by a CR.  (See the code to do exactly this, yourself.)  So it does go
out exactly as it came in: (II)
        'a' 'b' 'c' CR LF 'd' CR CR LF 'b' 'a' 'r' CR CR LF

-----------------------------------------------------------
Next question:
-----------------------------------------------------------
Is INN 8 bit article body compliant using NNTP.  yes and no.

You see, if you give INN the "CR escaped" version (II), it will
spit back the CR-escaped version.  But, as Curt points out,
if you give it the "original" version there is data loss: 

The original (I), 

        'a' 'b' 'c' LF 'd' CR LF 'b' 'a' 'r' CR LF

if returned from a socket read(), stores to disk as: (IV)

        'a' 'b' 'c' LF 'd' LF 'b' 'a' 'r' LF

And is sent back out as: (V)

        'a' 'b' 'c' CR LF 'd' CR LF 'b' 'a' 'r' CR LF


which is not the original at all, for exactly the reasons
Curt points out, and Matt points out.  

INN and diablo should not be concerned about what is the "original"
They should send out what they get in.  When an article is given to
traditional INN without at least one CR preceeding each LF, it will not
do the "right thing."

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 


Technical Details
Message-ID: <6q5bhd$ejk$1@news1.epix.net>
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: <slrn6qs63j.8b9.usenet@hmmm.colo.erols.net> <19980728010652.281$Rf@newsreader.com> <6pjqjp$hdl$1@flea.best.net> <19980728133745.073$Lq@newsreader.com> <6plakh$j51$1@flea.best.net> <19980728184343.123$fa@newsreader.com> <slrn6rtb90.qn.usenet@hmmm.colo.erols.net>

Show Full Headers
Complete Article Headers
Message-ID: <6q5bhd$ejk$1@news1.epix.net>
Subject: Re: REPOST: Re: Content-Transfer-Encoding: binary
Date: Mon, 03 Aug 1998 00:00:00 +0000
From: mibsoft@mibsoftware.com (Forrest J. Cavalier III)
References: <slrn6qs63j.8b9.usenet@hmmm.colo.erols.net> <19980728010652.281$Rf@newsreader.com> <6pjqjp$hdl$1@flea.best.net> <19980728133745.073$Lq@newsreader.com> <6plakh$j51$1@flea.best.net> <19980728184343.123$fa@newsreader.com> <slrn6rtb90.qn.usenet@hmmm.colo.erols.net>
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: 377620094
Content-Type: Text/Plain; charset=US-ASCII
Organization: Mib Software
Mime-Version: 1.0
Newsgroups: news.software.readers,news.software.nntp