🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #63819

Re: xBin Message-ID convention

#63819
From: Curt Welch
Date: Mon, 03 Feb 2003 08:31
350 lines
16364 bytes
Kjetil Torgrim Homme <kjetilho@haey.ifi.uio.no> wrote:
> alright.  here's my write-up of xBin.  it's not perfect, I'm sure
> there are lots of details missing, and I'm pretty tired so the
> explanations are probably not perfectly enlightening.  anyhow:
>
> xBin is a method for distributing large files over Usenet.  here,
> "large" means more than approx. 200 kB.

I think it would be wrong to imply it should only be used for "large"
files.  It can be used for any size file and I think it's the start of what
could end up morphing into a general purpose file-transport system inside
of Usenet (separte from the power to "hide" files inside text articles like
we do now).

> an xBin msgid is identified by a LHS (Left Hand Side of the @-sign)
> containing the magic string "~XB~".

We had talked about ~, but then I ended up changing it to $ most for
personal estheic bias in my posting program.  I think I could get used to
~.  I think $ makes it look more like a Message-ID, but ~, for the same
reason, makes it stand out as "something special" which might be better.
And it reduces the odds of an accidential collsion even further.

But, one thing that would be nice is if the xBin-ID (~XB~....~~) could be
used as an argument on DOS and Unix command line programs without having to
put them in quotes.  $ is seen as a shell variable on Unix.  An argument
starting with ~ is seen as a user home directory path substitution on Unix.
(i.e. cd ~curt).

Also, for MIME Base 64 we get / and + where / causes problems on DOS
(doesn't it? or is that up to the program?).  Any ideas about what to use
to make the xBin-ID "cleaner"?

What about dot instead of ~?   .XB.HSuFjge8.S2Kj..
Does normal LHS semantics make .. (double dot) invalid?
Are the odds of a false match on a non xBin Message-ID too high with dot?

> the magic string is followed by
> the first 72 bits[TBD] of the root hash, a number of other parameters,
> and terminated by the string "~~".

I used ~H to mark the hash so it started with ~XB~H followed by the hash.
Did you leave that out on purpose or by accident?

Oh, after reading futher below, I see you just did it a bit differently.
Not sure if that's wise.  See comments further down on ~H.

> each parameter is specified on the form "~C" followed by an integer
> value,

We shouldn't say they are integers which I belive will tend to leaves one
think the data is limited to something small like 32 bits max in size.  To
allow for maximum future expansion flexibility, we should define the value
of the parameter as zero or more BASE64 charaters.  We might want to encode
a short string in there at some point in the future.

We can then define how an "integer" is encoded for paramaters which are
normally thought of as a single numeric value.

> where C is some character identifying the parameter.  the
> parameters are:

> S   total size.  the complete size of the file in octets.  mandatory.

The hash and the total size combined is the real xBin-ID for the file, not
just the hash.  So I think it's important that this is not only mandatory,
but that it comes right after the Hash.  This way, the first part of the
xBin-ID is always the "file ID":

    <~XB~H53F8b3f9C0/1~SVLIw~sBX5A~oBX5A~~pI+@example.com>
     --------+--------------
             |
             +-- This is the "file ID" part of the xBin-ID.
                 This is what you can cut-and past, or pass to someone
                 to specify what "xBin file" you want to get from Usenet.
                 A full xBin File-ID would be ~XB~H...~S...~~

     ------------------+------------------
                       + This is what I call the xBin-ID (~XB~ to ~~)

    ---------------------------+--------------------------
                               + The Message-ID (< to > of course)

>   o   offset.  the first octet of this fragment is the octet at OFFSET
>       of the complete file.  defaults to 0.
>
>   s   part size.  the size of this fragment in octets.  defaults to
>       total size minus offset.

I had switched to using hash-block numbers here instead of bytes.  Did you
switch back to bytes for a reason?

>   H   hashing method.  defaults to 0, which is 72-bits
>       Content-SHA1-Tree.

Oh, I see, you did it a little differently.

I think that's dangerous.  Most programs I'm afraid are likely to not look
for the ~H paramater if you do that way.  With your way, adding ~H1 should
cause all old systems to ignore the hash value. Instead, many will probably
just ignore the ~H paramater and continue assuming the hash is the same.

I think it needs to be ~H<hash-value> so if you change it, and produce new
IDs that are ~XB~I<newhash> it will have a better chance of the old systems
"knowing" something is _very_ different.

> the integer values are coded as big-endians in BASE64.  examples:
>
>     0 is encoded as "A"
>  4711 is encoded as "BJn"
>       ("B" == 1, "J" == 9, "n" == 39, and 1*64*64 + 9*64 + 39 == 4711)
>
> an xBin implementation MUST be able to encode or decode 63 bit integer
> values.

I'm not sure if that's the correct way to say that.  What you might really
want to say is that there is no limit to the size of integers.  Saying 63
bits might lead programms to make the false assumption that the field could
never be larger than 11 characters.  We don't want any limit (even if 63
characters will last more than 1000 years).  Any xBin-ID parser needs to
parse it correctly for unlimited lengths.  If the newsreader on the other
hand is unable to deal with files larger than 32 bits, then that's fine -
thats a limit of the tool.  But the tool needs to deal with xBin ids of any
length and be good about saying "that's too big - I can't deal with that",
instead of mis-parsing it and comming up with an invalid 63 bit number when
25 base-64 characters are used and the programmer assumed it would never be
more than 63 bits.

> file sets
> =========
>
> file sets introduce two new parameters:
>
>   M   multi-file.  the number of files included in this set.  defaults
>       to 1.
>
>   F   file number.  which file this article is a part of.  if there is
>       more than one file represented in the article, choose the highest
>       number.  defaults to 1.
>
> the presence of an M parameter changes the meaning of the other
> parameters, and the root hash is calculated slightly differently.
>
> the news posting software ("poster") takes all the files in the set
> and calculates the root hash for each.  it then takes these 160 bit
> root hashes, concatenates them in order, and calculates the SHA1 hash
> of that data.  the resulting hash is the root hash for the set.

After readig thouth all the old messages here I had fallen behind on, I
don't think we should go there that way.

I think we should instead define a file format for holding the information
(including the xBin-IDs) and they should just post that file to describe
the file set.  Because we hash the contents of all files posted, the
xBin-ID of the "set file" becomes a secure hash of the entire set.

If two people post the similar but different sets, which happen to share
same of the same files (like jpg collections), then using a separte file to
define the file-set allows the two file sets to share the same file without
any "set confusion".

If you posted your set first, and then I tried to post my set, my posting
tool could "see" that one of the files was already posted to the same group
and automatically not repost it.  This is very clean if you don't try to
put file-set info into the Message-ID.

Also, with the separate file to define the set, you can have set files
included in other sets and end up creating an unlimited depth hierarch of
sets as parts of sets.  Putting the info in the Message-ID you limit
yourself to single level hierarchies.

With set files working like that, people could post daily summaries of
everything posted to the group in the past 24 hours.  The set file could
list all sets, and all individual files not mentioned in other set files.
Not sure if that would be useful, but it's something that just popped into
my head.

What would be useful in the Message-ID for this set file idea is a single
paramater to define the type of the file (a very simple content-type idea).

Maybe ~T for type where it defaulted to 0 for "data file", and a value of 1
means it is an xBin set file[Format TBD].  We would not attempt to let this
exapand into a mini mine Content-Type by creating values for text/plan,
etc. The idea is to limit this to ONLY the basic types the download tools
need to know about for getting their job done.  It it "knows" it's a set
file, then it knows to parse it as such and then fetch (for a recurse/set
download request) all the files in it as well.


> other headers
> =============
>
> xBin posters should put all meta-data about the files in suitable
> headers.
>
> filename (mandatory):
>   Content-Disposition: attachment; filename="somefile.mp3"
>
> filetype (optional for single files):
>   Content-Type: audio/mpeg
>
> fragment information (mandatory for file sets):
>   Content-Type: message/fragment; offset=OCTETS; total-size=OCTETS
>
> these are MIME headers, but the article should not declare
> "MIME-Version: 1.0" unless it is a well formed MIME document.

I'm not sure about all this.

You can't put this stuff in the article header if you have a mime
multipart/mixed article with the data in the second part.  The file info
headers in that case must be in the article body with the other headers for
that second of the MIME article.

The more I think about this stuff, the less I like the idea of using MIME
to transport xBin files (it's fine to use MIME for now, but I don't think
it's right to try and define how it should work like this).  I think xBin
may end up taking us on a different path.  It will beome a "file system"
which will hold MIME articles (as files) intead of the other way around (a
mime article holding a xBin file fragment).

> size of parts
> =============
>
> to ensure smooth propagation of all the parts of a file, the parts
> should be as similar as possible in size.
>
> many servers will transmit small articles faster than large articles,
> and this can cause the last article to arrive much earlier (perhaps an
> hour) than the first article.  on a server with limited retention,
> this may cause the last part to expire an hour or two before the
> second-to-last part of the file, which is confusing to users.
>
> even worse, some servers will drop articles larger than some size.  if
> the last article is much smaller than the others, it may be let
> through, while all the large articles are ignored.  the user will see
> a newsgroup with only one part from each file: the last one.  again
> very confusing to users who may ask the other users of the newsgroup
> for reposts to no avail.
>
> how should the part size be calculated?  the user should be allowed to
> set an upper bound for the part size.  this upper bound is measured
> against the encoded size of the part.  subtract a couple of KB for
> miscellaneous headers, and use an appropriate estimate of encoding
> overhead (40% for uuencode, 25% for BASE64, 3% for yEnc).
>
> Content-SHA1-Tree requires the size of each fragment to be a complete
> number of blocks (22500 octets[TBD]).  only the last fragment can
> contain an incomplete block.
>
> here's some simple pseudo code to find a suitable size for each part:
>
>     file_size = <size of file>
>
>     block_size = 22500
>     max_part_size = 500000
>     raw_max_part_size = (max_part_size - 2000) * 0.75
>     part_size = trunc(raw_max_part_size / block_size) * block_size
>
>     # set it up so the loop condition is always true
>     too_much = 1
>     number_of_parts = 0
>     part_size = part_size + block_size
>
>     while (too_much > number_of_parts * block_size)
>     {
>         part_size = part_size - block_size
>         number_of_parts = trunc((file_size - 1) / part_size) + 1;
>         too_much = number_of_parts*part_size - $file_size;
>     }
>
>     # we now know how large the largest part will be.  the last part
>     # will have the same number of blocks, but the last block is
>     # incomplete.  the remainder surplus will be distributed among the
>     # next to last parts.
>
>     surplus_blocks = trunc((too_much-1) / block_size)
>     last_block = too_much - surplus_blocks*block_size
>
>     for i = 1 to (number_of_parts - surplus_blocks - 1)
>         print "part", i, "contains", part_size, "bytes"
>
>     for i = (number_of_parts - surplus_blocks) to (number_of_parts - 1)
>         print "part", i, "contains", part_size - block_size, "bytes"
>
>     print "part", number_of_parts, "contains", last_block, "bytes"
>
> interaction with uuencode
> =========================
>
> existing decoders will depend on meta-information in Subject, and
> therefore an xBin aware poster SHOULD follow existing conventions for
> tagging multipart files in Subject.  an xBin aware reader MUST NOT
> rely on data in Subject.

We should add a little bit of the basics here about standard Subject
conventions.  Such as documenting "(XX/YY)" and point out the the number of
digits in both should be the same to make it sort correctly and that the
"real" XX/YY must be the rightmost XX/YY on the line.  The wording should
just document common practice to gude people and not attempt to create a
standard.

> the filename MUST be specified using Content-Disposition in the first
> part.  Content-Disposition MAY be included in other parts as well.
> the filename SHOULD be the same as the filename specified in the
> uuencode "begin" line.
>
> single file
> -----------
>
> xBin requires the size of each part to be a multiple of 22500 bytes.
> following the above algorithm will satisfy this requirement.
>
> multiple files
> --------------
>
> each part MUST only contain blocks from a single file.  the part size
> algorithm should thus be run on each file individually.  each part
> must contain Content-SHA1-Tree corresponding to the fragment of the
> file, and fragment information in Content-Type.
>
> interaction with yEnc
> =====================
>
> same issues as uuencode.  an xBin reader MUST NOT rely on information
> from the =ybegin line.  an xBin poster MUST include valid information
> in =ybegin.

It needs to get the file name from there hecause I don't think your
Content-Dispostion idea is going to fly.

> interaction with MIME
> =====================

> message/fragment
> ----------------

> there is no backwards compatibility

More stuff that doesn't feel like it's going to work.

If you post a multipart file in a MIME format, it's got to be readable by
mime-aware newsreaders.  If we can not post it in this format today, I
don't see how we could ever justify posting it in that format (or why we
would even bother trying to convert to it in the future).

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/
Technical Details
Message-ID: <20030203033140.853$4N@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!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.maxwell.syr.edu!feed1.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
References: <1rvg0ehvar.fsf@vingodur.ifi.uio.no>

Show Full Headers
Complete Article Headers
Message-ID: <20030203033140.853$4N@newsreader.com>
Subject: Re: xBin Message-ID convention
Date: Mon, 03 Feb 2003 08:31:40 +0000
From: curt@kcwc.com (Curt Welch)
References: <1rvg0ehvar.fsf@vingodur.ifi.uio.no>
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!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.maxwell.syr.edu!feed1.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
Organization: NewsReader.Com
Newsgroups: news.software.nntp
X-Trace: NewsReader.Com LzdSyiwvuPLzR3BB9L03GOgD8iVVxxHKLw_XO5DCFCht3anFa
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
X-Url: http://CurtWelch.Com/
User-Agent: NewsReader.Com
Lines: 349