Anecdote Nr 1 of implementing a NNTP (reading) server

The first version of my work-in-progress NNTP server I tested with a real newsreader had enough code to handle connections, give the greeting and reject every command except QUIT (whose implementation was fully RFC 3977 conforming).

Here’s an excerpt from my server log when giving tin the Treatment:

2009-05-02T01:05:49 nntpd for 127.0.0.1:55432 terminating
2009-05-02T15:24:31 nntpd listening at 0.0.0.0:5555
2009-05-02T15:24:46 nntpd for 127.0.0.1:34844 starts
2009-05-02T15:24:46 nntpd for 127.0.0.1:34844 ==> 200 posting allowed
2009-05-02T15:24:46 nntpd for 127.0.0.1:34844 <== CAPABILITIES
2009-05-02T15:24:46 nntpd for 127.0.0.1:34844 ==> 500 unrecognized command
2009-05-02T15:24:46 nntpd for 127.0.0.1:34844 <== MODE READER
2009-05-02T15:24:46 nntpd for 127.0.0.1:34844 ==> 500 unrecognized command
2009-05-02T15:24:46 nntpd for 127.0.0.1:34844 <== CAPABILITIES
2009-05-02T15:24:46 nntpd for 127.0.0.1:34844 ==> 500 unrecognized command
2009-05-02T15:24:46 nntpd for 127.0.0.1:34844 <== MODE READER
2009-05-02T15:24:46 nntpd for 127.0.0.1:34844 ==> 500 unrecognized command

This went on and on and on for five seconds, until tin crashed (which I believe is a bug – a NNTP client ought to either give up after getting 500 to CAPABILITIES, or ignore the 500 from MODE READER – I’m sure there are functional NNTP servers predating CAPABILITIES that do not implement MODE READER either). My server promptly crashed as well – my logic for handling socket errors was faulty (fixed).

Next victim was slrn. It was much better behaved:

2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 starts
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 ==> 200 posting allowed
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 <== MODE READER
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 ==> 500 unrecognized command
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 <== XOVER
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 ==> 500 unrecognized command
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 <== XHDR Path
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 ==> 500 unrecognized command
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 <== NEWGROUPS 071115 214035 GMT
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 ==> 500 unrecognized command
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 <== GROUP gmane.comp.shells.dash
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 ==> 500 unrecognized command
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 <== GROUP gmane.comp.version-control.packaging
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 ==> 500 unrecognized command
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 <== GROUP gmane.linux.drivers.ath5k.user
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 ==> 500 unrecognized command
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 <== GROUP gmane.linux.kernel
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 ==> 500 unrecognized command
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 <== GROUP gmane.linux.kernel.announce
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 ==> 500 unrecognized command
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 <== GROUP gmane.comp.compilers.cyclone.general
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 ==> 500 unrecognized command
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 <== GROUP gmane.comp.version-control.git
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 ==> 500 unrecognized command
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 <== GROUP gmane.comp.compilers.pcc
2009-05-02T15:37:07 nntpd for 127.0.0.1:40000 ==> 500 unrecognized command
2009-05-02T15:37:21 nntpd for 127.0.0.1:40000 <== QUIT
2009-05-02T15:37:21 nntpd for 127.0.0.1:40000 ==> 205 bye
2009-05-02T15:37:21 nntpd for 127.0.0.1:40000 terminating

Unfortunately, slrn went and deleted my subscriptions to those groups. The bastard. :)

3 thoughts on “Anecdote Nr 1 of implementing a NNTP (reading) server

  1. True. I wonder why I didn’t use that. Git history shows I switched to 201 after implementing the main READER commands. Turned back to 200 after implementing POST.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>