spf-discuss
[Top] [All Lists]

Re: SRS: encoding with lengths instead of delimiters

2004-03-29 01:42:26
On Sun, 28 Mar 2004, alan reider wrote:

I run a forwarding MTA and after looking at SRS for a while, I became
interested in the general problem of how to encode a field of arbitrary
characters with transparency without having to escape anything.

My idea is to prefix fields with a length instead of using delimiters. For
example, ajr(_at_)example(_dot_)com could be encoded with a 2 byte length as 
follows:

03ajr11example.com

This is a popular encoding and is used in various forms by hundreds of
systems I can name.

However this isn't transparent for fields starting with a number. Adding
a length delimiter eg, 3.ajr11.example.com would cure that (and allow
fields sizes > 99 in length) but adds too many characters.

If you have a type field before the length field, then numbers are every 
valid digit up to the next valid type character (which must not be a 
digit). There are alternative approaches.

The only thing I dont like about it for SRS is that it's somewhat less
readable for the user. OTOH it is transparent for any data in any order.

Any thoughts?

Not only is it less readable for the user, but it is harder (impossible?)
to parse using simple regular expressions. While not a requirement, most 
simple mail filtering programs are regular-expression based. Therefore the 
current encoding has a slight advantage.

S.

-- 
Shevek                                    http://www.anarres.org/
I am the Borg.                         http://www.gothnicity.org/