🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #46451

Re: Encoding binary data

#46451
From: Andrew Gierth
Date: Wed, 17 May 2000 00:00
53 lines
3002 bytes
>>>>> "Anne" == Anne Wilson <anne@unidata.ucar.edu> writes:

 Anne> Hi again!  and more questions about transmission of binary
 Anne> data:

 Anne> When using NNTP my understanding is that lines
 Anne> can't be greater than 1000 chars, is that right?

The NNTP standards don't specify a limit. Neither does the old news
article format standard, as far as I can tell. Most of the NNTP
_transit_ software I know of will deal with body lines of arbitrary
length, but not all of it will handle long header lines. (Client
software is more likely to break, but as I recall you're looking at
this for a specialised application?)

 Anne> Why is there a line limit at all?  And, assuming
 Anne> there is a line limit, is 8 bit encoding ok, or
 Anne> must it be some other encoding?

As far as NNTP is concerned, the limits on data are:

  - no NUL characters (many implementations choke on them)

  - CR+LF should occur only together and only as a line terminator
    (some implementations convert line endings to local format on
    reception, this usually results in bare LFs being converted to
    CR+LF on transmission)

  - '.' at the start of a line must be escaped with another '.'

Using all 8 bits is fine, but arbitrary binary data will fall foul of
the above restrictions at some stage.

 Anne> In transferring our binary data, we don't want to spend lots of
 Anne> time encoding the data.  Also, we go to some trouble to
 Anne> compress the data for faster transmission, but I'm afraid the
 Anne> subsequent encoding will mitigate that gain.  On a very simple
 Anne> test of a very large binary, mimencode took several minutes and
 Anne> increased the size of a binary product by 35%.  That's
 Anne> depressing! :-(

On my system, mimencode takes one second per 8 megabytes of data.

MIME base64 is designed for robustness not for maximum efficiency, the
64 data characters are chosen from the set that is least prone to
mangling when passing through foreign gateways (especially ones that
translate character sets). In an NNTP-only environment you can do much
better with a custom encoding algorithm.

-- 
Andrew.

Technical Details
Message-ID: <87bt2511sn.fsf@erlenstar.demon.co.uk>
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>

Show Full Headers
Complete Article Headers
Message-ID: <87bt2511sn.fsf@erlenstar.demon.co.uk>
Subject: Re: Encoding binary data
Date: Wed, 17 May 2000 00:00:00 +0000
From: Andrew Gierth <andrew@erlenstar.demon.co.uk>
References: <3921BBF8.F251A540@unidata.ucar.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: 624638095
X-Mayan-Date: Long count = 12.19.7.3.17; tzolkin = 3 Caban; haab = 0 Zip
X-Complaints-To: andrew@erlenstar.demon.co.uk
Organization: disorganised
X-Attribution: AG
X-Pgp-0x0E9FFBE9: 87 25 7F 14 41 24 B3 51 E0 19 8B DE 49 74 0C 29
X-P-Persistent-Headers: are a bad idea.
Newsgroups: news.software.nntp
X-Post-Filter: postfilter v0.6 alpha