Trevor Berg: The Blog

Avatar

RTFRFC

I’ve been writing a yDecoder for swagr the last couple of days (I’ll release the source once I optimize it a bit) and I ran into a bit of a wall.  Every article I decoded was 99.9% correct, but each had a couple of extra bytes.  I spent several hours working on it and found that it only occurred at the beginning of a couple lines.

After going through a bunch of other yDecoder implementations, I still couldn’t figure out what I was doing wrong.  Then I happened across a bright red message on the yEnc site :

Frequent programming problem (28.03.2003)

I was contacted more than a dozen time by developers who are having problems with the decoding or encoding. They all had the same problem: They did not realize that the NNTP-protocol requires to double a dot in the first colum when a line is sent - and to detect a double dot (and remove one of them) when receiving a line.
So if you are directly posting to or reading from a socket (internet conenction socket), then dont forget this, please

The NNTP protocol repeats the . character if it occurs at the beginning of the line because  the . is used as a terminating character. So the moral of the story is always read your RFC’s.

Continue