javanntpusenet

NNTP server implementation


I'm trying to implement nntp server. But looks like I have a problem with multi line response. When I sent response client close connection. I'm using Thunderbird and SeaMonkey as clients.

I heed help to understand what wrong with my response. Thanks.

[S] server
[C] client


[S] 200NNTP Service Ready,posting permitted.

[C] MODE READER
[S] 200 Posting allowed

[C] GROUP group1
[S] 221 1 10100 10100

[C] XOVER 10100-10100
[S] 224
[S] 10100
[S] Subject 2104406756
[S] User0 <user0@xxx.com>
[S] Tue Jan 28 11:32:44FET 2014
[S] <10100@xxx.com>
[S] .

[C] HEAD 10100
[S] 221 10100 <10100@xxx.com>
[S] Path: news.foo.bar!not-for-mail
[S] From: User0<user0@xxx.com>
[S] Newsgroups: group1
[S] Subject: Subject 2104406756
[S] Date: Tue Jan 28 11:32:44FET 2014
[S] Message-ID: <10100@xxx.com>
[S] .

upd1:

I installed plugin in Thunderbird for debugging traffic on client side (TBTracer) and looks like client can't understand my multi line response. Client received only first part of response. For example response for XOVER is multi line.

[NNTP] [13:54:29] 200 NNTP Service Ready, posting permitted.

[NNTP] [13:54:29] MODE READER

[NNTP] [13:54:30] 200 Posting allowed

[NNTP] [13:54:30] GROUP group1

[NNTP] [13:54:31] 221 1 10100 10100

[NNTP] [13:54:31] XOVER 10100-10100

[NNTP] [13:55:15] 224

[NNTP] [13:55:15] QUIT

According to RFC 3977:

3.1.1. Multi-line Data Blocks

  1. The block consists of a sequence of zero or more "lines", each being a stream of octets ending with a CRLF pair. Apart from those line endings, the stream MUST NOT include the octets NUL, LF, or CR.

I tried sent different type of lines but without any success. For example:

String r = "224\r\n10100\r\n6 Oct 2000 04:38:40\r\n<10100@xxx.com>\r\n.\r\n";

Solution

  • The answer is simple. RFC 2980:

    Each line of output will be formatted with the article number,
    followed by each of the headers in the overview database or the
    article itself (when the data is not available in the overview
    database) for that article separated by a tab character.

    Where no data exists, a null field must be provided (i.e. the output will have two tab characters adjacent to each other).

    Example: 111\tSubject\tUser\tDate\t111\t\t