🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
28 messages
28 total messages Started by Anne Wilson Tue, 16 May 2000 00:00
Encoding binary data
#46440
Author: Anne Wilson
Date: Tue, 16 May 2000 00:00
71 lines
3813 bytes
--------------E5DE9B2DE8105F5FA45CCA08
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

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

When using NNTP my understanding is that lines
can't be greater than 1000 chars, is that right?
Why is there a line limit at all?  And, assuming
there is a line limit, is 8 bit encoding ok, or
must it be some other encoding?

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

Any information would be appreciated.  Thank you!

Anne

--
***************************************************
Anne Wilson                     UCAR Unidata Program
anne@unidata.ucar.edu                  P.O. Box 3000
                                  Boulder, CO  80307
----------------------------------------------------
Unidata WWW server       http://www.unidata.ucar.edu/
****************************************************



--------------E5DE9B2DE8105F5FA45CCA08
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi again!&nbsp;&nbsp; and more questions about transmission of binary data:
<p>When using NNTP my understanding is that lines can't be greater than
1000 chars, is that right?&nbsp; Why is there a line limit at all?&nbsp;
And, assuming there is a line limit, is 8 bit encoding ok, or must it be
some other encoding?
<p>In transferring our binary data, we don't want to spend lots of time
encoding the data.&nbsp; Also, we go to some trouble to compress the data
for faster transmission, but I'm afraid the subsequent encoding will mitigate
that gain.&nbsp; On a very simple test of a very large binary, mimencode
took several minutes and increased the size of a binary product by 35%.&nbsp;&nbsp;
That's depressing! :-(
<p>Any information would be appreciated.&nbsp; Thank you!
<p>Anne
<pre>--&nbsp;
***************************************************
Anne Wilson&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UCAR Unidata Program&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
anne@unidata.ucar.edu&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; P.O. Box 3000
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Boulder, CO&nbsp; 80307
----------------------------------------------------
Unidata WWW server&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A HREF="http://www.unidata.ucar.edu/">http://www.unidata.ucar.edu/</A>
****************************************************</pre>
&nbsp;</html>

--------------E5DE9B2DE8105F5FA45CCA08--


Re: Encoding binary data
#46451
Author: 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.

Re: Encoding binary data
#46452
Author: Paul Martin
Date: Wed, 17 May 2000 00:00
39 lines
1715 bytes
In article <3921BBF8.F251A540@unidata.ucar.edu>,
	Anne Wilson wrote:

>--------------E5DE9B2DE8105F5FA45CCA08
>Content-Type: text/plain; charset=us-ascii
>Content-Transfer-Encoding: 7bit

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

>When using NNTP my understanding is that lines
>can't be greater than 1000 chars, is that right?
>Why is there a line limit at all?  And, assuming
>there is a line limit, is 8 bit encoding ok, or
>must it be some other encoding?

Usenet is not for the transmission of binary data, contrary to popular
opinion. It's for text discussions.

Lines should not be longer than 80 characters, by convention. If it
can't be displayed on a terminal without wrapping, it's too long.


>--------------E5DE9B2DE8105F5FA45CCA08
>Content-Type: text/html; charset=us-ascii
>Content-Transfer-Encoding: 7bit

[snip]

>--------------E5DE9B2DE8105F5FA45CCA08--

Come back when you've set up your newsreader correctly. MIME
multipart/alternative is "not done".

-- 
Paul Martin <pm@zetnet.net>
at home, swap dash to dot to email.

Re: Encoding binary data
#46453
Author: Paul Martin
Date: Wed, 17 May 2000 00:00
38 lines
2060 bytes
In article <87bt2511sn.fsf@erlenstar.demon.co.uk>,
	Andrew Gierth wrote:

>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.


ASCII85 encoding is tempting, but you'd have to ensure that a "."
doesn't fall on the first character of a line. (Spaces are ignored...
or you can use the normal dot escape mechanism built into the news
software.)

In essence, take four octets of binary data, and convert them to a 32
bit value, and output the base85 equivalent of that number using the
set of ASCII characters "!" (0) through to "u" (84). The special value
of 0.0.0.0 is given the character "z" instead of "!!!!!".

That results in a 25% expansion -- less for data that has runs of
zeroes.

One word about performance. ASCII85 will be slower running than MIME
base64, as it's not as easy a number to divide by on a binary system.

ASCII85 is more commonly known as "btoa", and there's plenty of source
around on the net for that.

Some tips for doing the mod85 stuff are on:

http://www.machtech.com/articles/Vol.09/09.12/Dec93Challenge/

-- 
Paul Martin <pm@zetnet.net>
at home, swap dash to dot to email.

Re: Encoding binary data
#46457
Author: Paul Martin
Date: Wed, 17 May 2000 00:00
33 lines
1984 bytes
In article <brad-4A6385.12264817052000@news.skynet.be>,
	Brad Knowles wrote:
>In article <slrn8i3hft.3pm.pm@manlap.zetnet.co.uk>, 
>pm@nowster-zetnet.co.uk (Paul Martin) wrote:

>> Usenet is not for the transmission of binary data, contrary to popular
>> opinion. It's for text discussions.

>    If you've been reading this newsgroup closely for the past few 
>weeks, then you would know that Anne is talking about an application she 
>has on a private network where NETNEWS would be used as a mechanism for 
>transferring large quantities of data relating to the weather.

OK. Is NETNEWS still a good way of doing this? I can think of other
ways of doing this that would be more efficient.

If there are relatively few recipients, a mailing list would be more
efficient. If there are relatively few senders, some sort of
distributed http cache would be more efficient on bandwidth used.

I have gone back to look at Anne's posts, now.

NNTP is a workable, but sub-optimal solution for such data distribution.

In response to Anne, I'd suggest she explains the structure of the data
flow -- whether it's towards and from central collation agency
(moderator), or whether it's more random.

-- 
Paul Martin <pm@zetnet.net>
at home, swap dash to dot to email.

Re: Encoding binary data
#46459
Author: Brad Knowles
Date: Wed, 17 May 2000 00:00
29 lines
2158 bytes
In article <slrn8i3hft.3pm.pm@manlap.zetnet.co.uk>, 
pm@nowster-zetnet.co.uk (Paul Martin) wrote:

> Usenet is not for the transmission of binary data, contrary to popular
> opinion. It's for text discussions.

    If you've been reading this newsgroup closely for the past few 
weeks, then you would know that Anne is talking about an application she 
has on a private network where NETNEWS would be used as a mechanism for 
transferring large quantities of data relating to the weather.

    While USENET in general is not intended for the transit of large 
binary content, the popularity of the alt.binaries.* hierarchy (and 
other binary hierarchies) proves that it is capable of doing it and at 
higher levels of volume than Anne is likely to need.  Therefore, it 
makes one presumably adequate solution for her problem.


    I would encourage you to familiarize yourself with the history of a 
situation before you comment in an excessively negative fashion.

-- 
Brad Knowles <brad@shub-internet.org> <http://www.shub-internet.org/brad/>

Are you a news server administrator outside of North America and Western
Europe?  If so, and you're interested in getting a newsfeed from a server
in the Freenix Top 50, please send me private e-mail for details.

Re: Encoding binary data
#46460
Author: Anne Wilson
Date: Wed, 17 May 2000 00:00
67 lines
3550 bytes
Hi Brad!  I really appreciate your response.  And, thank you for defending my
honor!

Most likely we will actually distribute the software that will make up our
network, so we will not be relying on an arbitrary news servers at remote
sites.   (We don't expect our sites to have to the background or support to
set up and configure a news server from scratch.)

If I need to make 'small' changes to INN, I can do that (although that may
lead to a maintenence morass that could be bad enough to make it
prohibitive...)  In looking at the innxmit code, it looks like the only
encoding it explicitly handles is quoted printable:

            if (ContentEncoding
                && (caseEQ(ContentEncoding, "binary")
                 || caseEQ(ContentEncoding, "8bit"))) {
                if (ContentType == NULL || caseEQ(ContentType, "text"))
                    MimeArticle = MTquotedprintable;
                } else {
                    /* Shouldbe MTbase64, but not implemented yet. */
                    MimeArticle = MTnotmime;
                }

Does this mean that anything else will bomb?

On the other hand, the latest IETF draft of "News Article Format" (Feb.
2000)  says explicitly,

    "Transmission paths for news articles MUST treat news articles as
   uninterpreted sequences of octets, excluding the values 0 (ASCII NUL)
   and 13 and 10 (ASCII CR and LF, which MUST ONLY appear in the
   combination CRLF which denotes a line separator).

        NOTE: this correspponds to the range of octets permitted for
        Mime "8bit data" [RFC 2045].  Thus raw binary data cannot be
        transmitted in an article body except by the use of a Content-
        Transfer-Encoding such as base64.

   An octet, or a sequence of octets, may represent a character in some
   Coded Character Set (CCS) as determined by some Character Encoding
   Scheme (CES) [RFC 2130]."

I need to look at these RFCs to see what a news server SHOULD do, but that
still doesn't tell me if INN will handle some other encoding.  I'm tempted to
research some 8-bit encoders and try it on my test network.    Other
statements in that draft imply that UTF-8 encoding might work.  I don't yet
know enough about 8-bit encoders or INN to know how speculative this is.  If
you think this is a complete waste of time please let me know.    Or, if
there's some other encoding that you might recommed I'd like to know that
too.


Anne

--
***************************************************
Anne Wilson                     UCAR Unidata Program
anne@unidata.ucar.edu                  P.O. Box 3000
                                  Boulder, CO  80307
----------------------------------------------------
Unidata WWW server       http://www.unidata.ucar.edu/
****************************************************




Re: Encoding binary data
#46461
Author: Andrew Gierth
Date: Wed, 17 May 2000 00:00
15 lines
1355 bytes
>>>>> "Brad" == Brad Knowles <brad@shub-internet.org> writes:

 Brad>     Hey, be glad you only increased the size by 35%!  If you
 Brad> had uuencoded it instead, that would have been more like 45%
 Brad> larger.

The difference between uuencoding and base64 is only about 2% on large
files. The basic algorithm is exactly the same (encoding 6 bits per
character), but base64 has more characters per line (so fewer CRLFs)
and no per-line length byte.

-- 
Andrew.

Re: Encoding binary data
#46462
Author: Andrew Gierth
Date: Wed, 17 May 2000 00:00
18 lines
1592 bytes
>>>>> "Paul" == Paul Martin <pm@nowster-zetnet.co.uk> writes:

 >> 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.

 Paul> ASCII85 encoding is tempting,

why bother? base 128 would be even easier (use octets 128-255 to encode
7 bits each, that avoids all the dangerous characters, have the decoder
ignore all octets <128 and insert line breaks at fixed intervals).

-- 
Andrew.

Re: Encoding binary data
#46467
Author: Andrew Gierth
Date: Wed, 17 May 2000 00:00
43 lines
2623 bytes
>>>>> "Anne" == Anne Wilson <anne@unidata.ucar.edu> writes:

 Anne> If I need to make 'small' changes to INN, I can do that
 Anne> (although that may lead to a maintenence morass that could be
 Anne> bad enough to make it prohibitive...)  In looking at the
 Anne> innxmit code, it looks like the only encoding it explicitly
 Anne> handles is quoted printable:

Forget about innxmit's encoding nonsense - that should probably never
have been included in the first place, and it has never been more than
an optional feature of dubious legitimacy.

 Anne> Does this mean that anything else will bomb?

News transit code generally works on the principle that article
bodies are uninterpreted sequences of lines, and the only reason
that they even look at the line terminations is to handle article
termination, quoting of '.', and the Lines: value in the overview
data.

 Anne> On the other hand, the latest IETF draft of "News Article
 Anne> Format" (Feb.  2000) says explicitly,

 Anne>     "Transmission paths for news articles MUST treat news
 Anne>    articles as uninterpreted sequences of octets, excluding the
 Anne>    values 0 (ASCII NUL) and 13 and 10 (ASCII CR and LF, which
 Anne>    MUST ONLY appear in the combination CRLF which denotes a
 Anne>    line separator).

This is consistent with common implementations.

 Anne> I need to look at these RFCs to see what a news server SHOULD
 Anne> do, but that still doesn't tell me if INN will handle some
 Anne> other encoding.

INN (and Diablo, and NNTPRelay, and Cyclone) will handle any encoding
you like, providing the restrictions on NUL, CR, LF (and the proper
handling of '.') are followed.

-- 
Andrew.

Re: Encoding binary data
#46470
Author: Brad Knowles
Date: Wed, 17 May 2000 00:00
52 lines
2993 bytes
In article <3921BBF8.F251A540@unidata.ucar.edu>, Anne Wilson 
<anne@unidata.ucar.edu> wrote:

> When using NNTP my understanding is that lines
> can't be greater than 1000 chars, is that right?
> Why is there a line limit at all?  And, assuming
> there is a line limit, is 8 bit encoding ok, or
> must it be some other encoding?

    I don't think that you can safely assume that 8-bit encoding is 
okay.  The best thing to do is to properly MIME base64 encode the 
content, and it will take care of line length limitations, character set 
limitations, etc... for you.

    While the network may be 8-bit clean, the news transit software at 
the other end might not (in fact, it probably wouldn't be able to handle 
embedded NULLs).

> In transferring our binary data, we don't want to
> spend lots of time encoding the data.  Also, we go
> to some trouble to compress the data for faster
> transmission, but I'm afraid the subsequent
> encoding will mitigate that gain.

    Yup, that's one of the prices you pay.

>                                    On a very
> simple test of a very large binary, mimencode took
> several minutes and increased the size of a binary
> product by 35%.   That's depressing! :-(

    Hey, be glad you only increased the size by 35%!  If you had 
uuencoded it instead, that would have been more like 45% larger.

> Any information would be appreciated.  Thank you!

    I understand your desire to simply squirt out the data as rapidly as 
you possibly can, and with an absolute minimum of additional processing, 
but if you want to use off-the-shelf USENET news server software as a 
medium upon which to transmit your large quantities of data, then I 
believe that there are certain prices you're going to have to pay -- one 
of them is that you'll have to MIME base64 encode all your outgoing 
binary data.

-- 
Brad Knowles <brad@shub-internet.org> <http://www.shub-internet.org/brad/>

Are you a news server administrator outside of North America and Western
Europe?  If so, and you're interested in getting a newsfeed from a server
in the Freenix Top 50, please send me private e-mail for details.

Re: Encoding binary data
#46479
Author: Anne Wilson
Date: Thu, 18 May 2000 00:00
53 lines
3443 bytes
Brad Knowles wrote:

>     You have to decide for yourself where the best balance falls between
> a completely customized and more optimal solution, versus something that
> presumably gets up and running faster but with a suboptimal solution on
> standard off-the-shelf software.

Well, this is the question I'm trying to answer now.  Currently we do have a
customized application to push the data.  However, it's old and would benefit
from significant overhaul.  I'm trying to determine how well NNTP would meet
our needs in order to avoid a very significant development effort.

When I first investigated this, I was very excited.  The similarities between
INN functionality and our current functionality were very great.    There was
logging, article expiration, unique message signatures, it uses a push
approach, it tracks which articles need to be delivered to which sites, and
provides daily reporting.  Furthermore, INN offered even more functionality
that looked really useful: the flooding approach sounded promising (like I
said sometime earlier, an Internet2 person told me this was a perfectly
appropriate use of that network), it was highly configurable, there's a pull
approach available (SUCK), multiple storage buffers of varying kinds/speeds,
CNFS storage method (actually quite similar to what we're using now),  it
handles a very large number of newsgroups,  you can subscribe to newsgroups
dynamically (very useful for people interested in tracking a moving storm, for
example), you can stream some feeds and batch others, etc.

So, this is all great!  and pretty darn close to optimal.  I built a prototype
and was able to transfer thousands of products with a relatively small
effort.  However, the devil is in the details.   The prototype I set up is
clunky and slow so now I'm working on improving the performance, which is how
I arrived at this encoding issue.  If the protocol had specified that the end
of the article would be determined by a by a byte count instead of a CR/LF/'.'
sequence I'd be walking on air!  I'm going to try to evaluate whether solving
the encoding problem is too high a price to pay.

THANK YOU! to everyone who has contributed to this discussion.  It has been
very valuable for me.

Anne

--
***************************************************
Anne Wilson                     UCAR Unidata Program
anne@unidata.ucar.edu                  P.O. Box 3000
                                  Boulder, CO  80307
----------------------------------------------------
Unidata WWW server       http://www.unidata.ucar.edu/
****************************************************




Re: Encoding binary data
#46482
Author: Anne Wilson
Date: Thu, 18 May 2000 00:00
50 lines
2159 bytes
Andrew Gierth wrote:

> 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)

Sorry - I don't follow the "only as a line terminator" part.  If CRLF
should occur in my binary file,  is that a problem?

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

Why is this?

> 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.

It would be an NNTP-only environment.  Maybe custom encoding is worth
investigating.

Thanks again, Andrew!

Anne

--
***************************************************
Anne Wilson                     UCAR Unidata Program
anne@unidata.ucar.edu                  P.O. Box 3000
                                  Boulder, CO  80307
----------------------------------------------------
Unidata WWW server       http://www.unidata.ucar.edu/
****************************************************




Re: Encoding binary data
#46483
Author: Andrew Gierth
Date: Thu, 18 May 2000 00:00
20 lines
1608 bytes
>>>>> "Brad" == Brad Knowles <brad@shub-internet.org> writes:

 >> The NNTP standards don't specify a limit. Neither does the old news
 >> article format standard, as far as I can tell.

 Brad>     However, what the NNTP standards *do* say is that messages
 Brad> will be formatted according to the Internet mail standards
 Brad> (with some further restrictions), and those standards *do*
 Brad> specify maximum line length limitations.

RFC1036 references RFC822, which also doesn't specify a line length.

RFC821 (SMTP) _does_ specify a line length, but that isn't referenced
either directly or indirectly by 1036 or any other news RFC as far as
I can tell.

-- 
Andrew.

Re: Encoding binary data
#46484
Author: Russ Allbery
Date: Thu, 18 May 2000 00:00
31 lines
1993 bytes
Anne Wilson <anne@unidata.ucar.edu> writes:

> If I need to make 'small' changes to INN, I can do that (although that
> may lead to a maintenence morass that could be bad enough to make it
> prohibitive...)  In looking at the innxmit code, it looks like the only
> encoding it explicitly handles is quoted printable:

>             if (ContentEncoding
>                 && (caseEQ(ContentEncoding, "binary")
>                  || caseEQ(ContentEncoding, "8bit"))) {
>                 if (ContentType == NULL || caseEQ(ContentType, "text"))
>                     MimeArticle = MTquotedprintable;
>                 } else {
>                     /* Shouldbe MTbase64, but not implemented yet. */
>                     MimeArticle = MTnotmime;
>                 }

> Does this mean that anything else will bomb?

That's legacy stuff from really early on in the adoption of MIME; it's
since been ripped out completely.  innxmit doesn't need to know anything
at all about the article body encoding.

You should be able to use practically any encoding in the body that avoids
CR and NUL as far as INN is concerned, I *think*.  But I've not tested
this.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

Re: Encoding binary data
#46486
Author: Process Pasteurized Fluffy Produ...
Date: Thu, 18 May 2000 00:00
10 lines
1448 bytes
Andrew Gierth <andrew@erlenstar.demon.co.uk> wrote:

> Forget about innxmit's encoding nonsense - that should probably
> never have been included in the first place, and it has never been
> more than an optional feature of dubious legitimacy.

Also, that stuff was excised from recent INN k0dez (2.3 & up), so it
would be a doubly bad idea to rely on its presence.

Re: Encoding binary data
#46487
Author: Brad Knowles
Date: Thu, 18 May 2000 00:00
66 lines
3903 bytes
In article <3922D896.DE4D25D5@unidata.ucar.edu>, Anne Wilson 
<anne@unidata.ucar.edu> wrote:

> Hi Brad!  I really appreciate your response.  And, thank you for 
> defending my honor!

    I'm glad to be able to help.

> Most likely we will actually distribute the software that will make up 
> our network, so we will not be relying on an arbitrary news servers at
> remote sites.   (We don't expect our sites to have to the background or
> support to set up and configure a news server from scratch.)

    If you go that route, I'd strongly encourage you to use standard 
off-the-shelf software with very, very little or preferably no 
modifications whatsoever.  That will make it a lot easier to support, 
and to upgrade as improvements are made in the software that you're 
going to use as the baseline.

> If I need to make 'small' changes to INN, I can do that (although that 
> may lead to a maintenence morass that could be bad enough to make it
> prohibitive...)

    Right, you really don't want to go that route.  Use standard code 
only, and if you need any changes made, the submit them back to the 
original project so that you (hopefully) don't have to continue to 
maintain them.

> I need to look at these RFCs to see what a news server SHOULD do, but 
> that still doesn't tell me if INN will handle some other encoding.  I'm 
> tempted to research some 8-bit encoders and try it on my test network.
> Other statements in that draft imply that UTF-8 encoding might work.  I
> don't yet know enough about 8-bit encoders or INN to know how speculative
> this is.

    When it comes to "what is in the standard" versus "what does INN 
actually do", the best people to talk to are the folks on the 
INN-workers mailing list, including Russ Allbery, etc....

>           If you think this is a complete waste of time please let me
> know.    Or, if there's some other encoding that you might recommed I'd
> like to know that too.

    I think Andrew has a point -- I believe that using USENET news as a 
transit medium for this sort of stuff is likely to lead you to 
suboptimal solutions.

    However, it does have the advantage that many of the sites might 
already have experienced news administrators who could more easily deal 
with something based on news, and it should allow you to get up to speed 
more quickly since you'd be using essentially standard off-the-shelf 
software.

    You have to decide for yourself where the best balance falls between 
a completely customized and more optimal solution, versus something that 
presumably gets up and running faster but with a suboptimal solution on 
standard off-the-shelf software.

-- 
Brad Knowles <brad@shub-internet.org> <http://www.shub-internet.org/brad/>

Are you a news server administrator outside of North America and Western
Europe?  If so, and you're interested in getting a newsfeed from a server
in the Freenix Top 50, please send me private e-mail for details.

Re: Encoding binary data
#46488
Author: Groda
Date: Thu, 18 May 2000 00:00
28 lines
1643 bytes
Why would coding binary data increase the size so much?  Is this encryption
she's talking about?  Sorry for the stupid questions, I'm a complete newbie.

--
|*/ |\  |\  /|\  |
|/  |/  | \  *   |/
|   |\  | |  |  /|
|   | \ | |  |   |

Hi again!   and more questions about transmission of binary data:
When using NNTP my understanding is that lines can't be greater than 1000
chars, is that right?  Why is there a line limit at all?  And, assuming
there is a line limit, is 8 bit encoding ok, or must it be some other
encoding?
In transferring our binary data, we don't want to spend lots of time
encoding the data.  Also, we go to some trouble to compress the data for
faster transmission, but I'm afraid the subsequent encoding will mitigate
that gain.  On a very simple test of a very large binary, mimencode took
several minutes and increased the size of a binary product by 35%.   That's
depressing!

Any information would be appreciated.  Thank you!
Anne




Re: Encoding binary data
#46491
Author: Russ Allbery
Date: Thu, 18 May 2000 00:00
33 lines
2028 bytes
Anne Wilson <anne@unidata.ucar.edu> writes:
> Andrew Gierth wrote:

>> 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)

> Sorry - I don't follow the "only as a line terminator" part.  If CRLF
> should occur in my binary file, is that a problem?

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), and if you want to use stock INN, you'll need to avoid lone CRs,
lone LFs, and any NUL characters.  But you could design a fairly
low-overhead encoding algorithm that just replaces those particular
characters with some sort of string in a reversible way rather than doing
the full-blown encoding that base64 does.

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

> Why is this?

Because NNTP commands to transit articles are terminated by CRLF.CRLF.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

Re: Encoding binary data
#46492
Author: Russ Allbery
Date: Thu, 18 May 2000 00:00
21 lines
1401 bytes
Anne Wilson <anne@unidata.ucar.edu> writes:

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

It may be part of the protocol, but I believe most existing servers can
handle arbitrarily long lines in the body.  However, many existing servers
can't handle nuls.

> In transferring our binary data, we don't want to spend lots of time
> encoding the data.  Also, we go to some trouble to compress the data for
> faster transmission, but I'm afraid the subsequent encoding will
> mitigate that gain.

This will unfortunately pose problems if using stock news software to do
your data transmission.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

Re: Encoding binary data
#46494
Author: Process Pasteurized Fluffy Produ...
Date: Thu, 18 May 2000 00:00
14 lines
1440 bytes
Groda <groda@my-deja.com> wrote:

> Why would coding binary data increase the size so much?

After encoding, you are only using about 6 bits of each 8-bit byte.
The whole idea of the encoding is to avoid using bit patterns that are
ignored or treated as control characters by some systems, so
inefficiency is inevitable.

> Is this encryption she's talking about?

Nope.  It's all about stuffing ten pounds of shit into a five pound bag.

Re: Encoding binary data
#46501
Author: Brad Knowles
Date: Thu, 18 May 2000 00:00
19 lines
1608 bytes
In article <87bt2511sn.fsf@erlenstar.demon.co.uk>, Andrew Gierth 
<andrew@erlenstar.demon.co.uk> wrote:

> The NNTP standards don't specify a limit. Neither does the old news
> article format standard, as far as I can tell.

    However, what the NNTP standards *do* say is that messages will be 
formatted according to the Internet mail standards (with some further 
restrictions), and those standards *do* specify maximum line length 
limitations.

-- 
Brad Knowles <brad@shub-internet.org> <http://www.shub-internet.org/brad/>

Are you a news server administrator outside of North America and Western
Europe?  If so, and you're interested in getting a newsfeed from a server
in the Freenix Top 50, please send me private e-mail for details.

Re: Encoding binary data
#46507
Author: Anne Wilson
Date: Fri, 19 May 2000 00:00
37 lines
1664 bytes
Paul Martin wrote:

> ASCII85 encoding is tempting, but you'd have to ensure that a "."
> doesn't fall on the first character of a line. (Spaces are ignored...
> or you can use the normal dot escape mechanism built into the news
> software.)

...

>
>
> Some tips for doing the mod85 stuff are on:
>
> http://www.machtech.com/articles/Vol.09/09.12/Dec93Challenge/
>
> --
> Paul Martin <pm@zetnet.net>
> at home, swap dash to dot to email.

Thanks, Paul!  I will look into this one.  (Although the above URL is
broken.)

Anne

--
***************************************************
Anne Wilson                     UCAR Unidata Program
anne@unidata.ucar.edu                  P.O. Box 3000
                                  Boulder, CO  80307
----------------------------------------------------
Unidata WWW server       http://www.unidata.ucar.edu/
****************************************************




Re: Encoding binary data
#46510
Author: Russ Allbery
Date: Fri, 19 May 2000 00:00
48 lines
2931 bytes
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.

Not necessarily.  It depends on what else the server does with the
article.  INN will reject articles with bare CRs for a variety of reasons;
there were a number of different problems we were running into with
corrupted messages, corrupted line counts for the overview, and similar
sorts of things.

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.

>> 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.

> On Usenet, you will always have to assume that some servers out there
> won't deal with NULLs, or lone CR, or lone LFs, in the articles.  And
> you should also assume that some servers will have problems with "long
> lines" -- i.e. many thousands of bytes between pairs of CR LFs.

I've yet to encounter one, apart from news to mail gateways.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

Re: Encoding binary data
#46513
Author: Curt Welch
Date: Fri, 19 May 2000 00:00
47 lines
2847 bytes
Anne Wilson <anne@unidata.ucar.edu> wrote:

> So, this is all great!  and pretty darn close to optimal.  I built a
> prototype and was able to transfer thousands of products with a
> relatively small effort.  However, the devil is in the details.   The
> prototype I set up is clunky and slow so now I'm working on improving the
> performance, which is how I arrived at this encoding issue.

I think the issue you face is simply a small amount of software written
"correctly".  There is no reason for this stuff to be slow.

I think you mentioned mime encoding taking minutes?  So I assume you are
talking about something which firsts conversts a very large file to
a mime-encoded file, and then posts the mime-encoded file.

If so, that's simply the wrong way to do it if speed is important
to you.  Convert it to mime (or whatever format you need) on the
fly as you post it.

> If the
> protocol had specified that the end of the article would be determined by
> a by a byte count instead of a CR/LF/'.' sequence I'd be walking on air!

I don't understand why.

If you write the code correctly, that makes no difference.  You can read
a file and write it the NNTP socket, doing the DOT processing, as fast
as you can copy it.

> I'm going to try to evaluate whether solving the encoding problem is too
> high a price to pay.

I don't know what type of programming resources you are working with, but
the job of writing a program to post files is something that only takes
a few days (if that).  We aren't talking weeks of development unless you
want a large and complex system with lots of options.

> THANK YOU! to everyone who has contributed to this discussion.  It has
> been very valuable for me.
>
> Anne

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

Re: Encoding binary data
#46517
Author: Kjetil Torgrim Homme
Date: Fri, 19 May 2000 00:00
15 lines
1288 bytes
[Andrew Gierth]

>   why bother? base 128 would be even easier (use octets 128-255 to
>   encode 7 bits each, that avoids all the dangerous characters, have
>   the decoder ignore all octets <128 and insert line breaks at fixed
>   intervals).

Base 128 is very nice (you can even do inline binaries ;-), but she
won't be able to use existing news clients without adding support for
the new encoding.


Kjetil T.

Re: Encoding binary data
#46525
Author: Curt Welch
Date: Fri, 19 May 2000 00:00
71 lines
4082 bytes
Russ Allbery <rra@stanford.edu> wrote:
> Anne Wilson <anne@unidata.ucar.edu> writes:
> > Andrew Gierth wrote:
>
> >> 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)

That's not a real technical NNTP limit.  That's a practical USENET limit.
The only real NNTP limit is that the last two bytes of the article must be
CR LF.

> > Sorry - I don't follow the "only as a line terminator" part.  If CRLF
> > should occur in my binary file, is that a problem?

On some systems it's a problem but not on NNTP.  The problem is that some
systems see that CR LF, and then convert it to the local "END OF LINE"
format.  On a Unix system that converts the article to local text file
format, the CR LF would be changed to a LF.  And then, a local program
on _that_ system might try to read the "text file" version of the article.
To it, the binary would be corrupted.

But if you only use NNTP news readers to read the article (which for sure
is the most common today), that same server would translate the LF back
to a CR LF before sending it out, and it would look fine.

But, then the problem becomes a lone LF in your binary.  When that gets
stored and re-transmitted, it gets turned into a CR LF, and once again,
your binary is corrupted.

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.

> 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_.

When the article is sent with NNTP, the end of the article is marked
with a line that contains a single dot.  i.e. the 5 byte sequence:

  CR LF DOT CR LF.

So, to prevent a line like that in an article (or hidden in a binary)
from fasely marking the end of the article, all "CR LF DOT" sequencies
must be converted to "CR LF DOT DOT" when the article is transmitted
over NNTP (execpt if course the trailing dot which is sent as the marker
for the end of the article).

On many of the new news servers, you can send raw binary (with the correct
dot stuffing) and it works fine.

On Usenet, you will always have to assume that some servers out there
won't deal with NULLs, or lone CR, or lone LFs, in the articles.  And
you should also assume that some servers will have problems with "long
lines" -- i.e. many thousands of bytes between pairs of CR LFs.

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

Re: Encoding binary data
#46530
Author: 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/

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads