🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #30099

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

#30099
From: Curt Welch
Date: Tue, 28 Jul 1998 00:00
88 lines
5687 bytes
dillon@best.net (Matt Dillon) wrote:
>     If the original article as written in someone's text editor is this:
>
>         X CR LF LF CR CR CR LF Y LF CR LF Z CR CR LF
>
>     Then the article escaped with the NNTP protocol is this:
>
>         X CR CR LF CR LF CR CR CR CR LF Y CR LF CR CR LF Z CR CR CR LF

Matt, I think you have spent too much time writing transports and not
enough time writing clients.

That type of escaping is NOT part of the NNTP protocol. It's something
that's done on _UNIX_ systems to convert the Unix format text files to NNTP
format text files.

If I create a text file on a PC (which I try not to do :)), then the lines
already end in CR LF.  So when I send the file to an NNTP server with a
POST command, I don't map the LF's to CR LFs.  If that file has an imbeded
raw JPEG file, then I also don't expect to do any type of translating of
characters. I'd just expect to send it in it's raw format.  But if I do
that, then Diablo will corrupt the file by adding a CR in front of any LF
that didn't already have one.

If the text file was created on a Mac, then the lines would end with a
single CR.  So the code that reads this format file and sends it with an
NNTP POST command will translate CR to CR LF.  What should it do with the
JPEG segment?

This is exactly the same problem as ftp file transfers in text versus
binary mode.  The problem is that NNTP clients and servers treat the NNTP
format as a TEXT format transfer, and they convert articles to and from
their local text formats.  For Unix this means mapping LF to CRLF when
sending.  For PCs and other DEC like sytems (like VMS) this means no
mapping required (execpt sometimes adding the ^Z EOF marker).  For Macs,
this means translating CR to CRLF.

There WILL BE problems if all the transports and clients try to send raw
binary data and still do their own "local" text conversions (like they do
today).  It's the same problem that happens if you ftp a binary file from a
Unix system to a PC in text mode.

You can move a binary file over FTP in text mode if the sending and
receiving systems are doing the same type of translation (i.e UNIX to UNIX,
or PC to PC etc).  But if you send it from Unix to PC in text mode, it
won't work.  I know you understand this.

What you seem to be saying is that everyone should be doing Unix text file
conversion and if they aren't then too bad for them.  That can work, but it
means all systems must do a UNIX like CR LF to LF translation when storing
the article in order to correctly extract the raw binary data.  And then
read lines in the UNIX style with an LF marking the end of the line.  And
it means that on a system that uses other styles of end-of-line markers you
can't convert the article to "local" end-of-line format without a complex
translation that requres you to read and parse mime headers so you know
which section of the file is "text" (and needs the conversion) and which
section is "raw binary" and doesn't need the conversion.

So, I repeat.  How to send binary data on an NNTP connection isn't obvious.
And for starters, I think all NNTP transports should send articles exactly
like they recieve them (i.e true 8 bit clean).  And if you translate your
articles into Unix text format and back again, then you won't be able to
receive and retransmit LF CR LF without changing it to CR LF CR LF, and I
think that's a bug.  And if there were a Mac transport that received CR CR
LF and translated that into CR LF CR LF when it was sent to the next
server, that too would be a bug in my mind.

I notice that CNFS seem to store the CR LF - so maybe INN 2.0 with the new
storage format gets this right.  And I suspect that the Highwind products
store the data in NNTP format so they too don't have the translation
problem.  But once the transports are all "fixed", we still need to decide
on how to send binary data over this "Text" protocol.  Is the binary left
unchaged (which strikes me as the natural way to do it), or does it go
though a Unix like LF to CR LF translation that you seem to think is the
obvious and only "right" way to do it?

Making Usenet transports 8 bit clean is a good thing.  I have my doubts
about whether we really want to send binaries in raw form, but there are
various other good reasons to make the transports 8 bit clean.  But I think
it's not as simple and obvious as you think.  And if Diablo is still
translating articles to local Unix format, I'd say Diablo isn't yet
(completely) 8 bit clean.

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

Technical Details
Message-ID: <19980728010652.281$Rf@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: <slrn6qs63j.8b9.usenet@hmmm.colo.erols.net> <19980727160307.629$hL@newsreader.com> <6pintb$1eo$1@flea.best.net> <19980727203523.032$aP@newsreader.com> <6pjaar$9te$1@flea.best.net>

Show Full Headers
Complete Article Headers
Message-ID: <19980728010652.281$Rf@newsreader.com>
Subject: Re: REPOST: Re: Content-Transfer-Encoding: binary
Date: Tue, 28 Jul 1998 00:00:00 +0000
From: curt@kcwc.com (Curt Welch)
References: <slrn6qs63j.8b9.usenet@hmmm.colo.erols.net> <19980727160307.629$hL@newsreader.com> <6pintb$1eo$1@flea.best.net> <19980727203523.032$aP@newsreader.com> <6pjaar$9te$1@flea.best.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: 375560170
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/
Newsgroups: news.software.readers,news.software.nntp