Lines: 2
Message-ID: ‹[email protected]›
NNTP-Posting-Host: localhost
X-Server-Date: 27 Apr 1999 21:51:50 GMT
Body:
Xref: news.vbrew.com junk:2
.
Retrieving an Article Body Only
If, on the other hand, the user decides she does want to read the article, her newsreader needs a way of requesting that the message body be transmitted. The
body 2
222 2 ‹[email protected]› body
This is another test message, please feel free to ignore it too.
.
Reading an Article from a Group
While it is normally most efficient to separately transfer the headers and bodies of selected articles, there are occasions when we are better off transferring the complete article. A good example of this is in applications through which we want to transfer all of the artices in a group without any sort of preselection, such as when we are using an NNTP cache program like leafnode.[134]
Naturally, NNTP provides a means of doing this, and not surprisingly, it operates almost identically to the
article 1
220 1 ‹[email protected]› article
Path: news.vbrew.com!not-for-mail
From: [email protected]
Newsgroups: junk
Subject: test message number 1
Date: 26 Apr 1999 22:08:59 GMT
Organization: The Virtual brewery
Lines: 2
Message-ID: ‹[email protected]›
NNTP-Posting-Host: localhost
X-Server-Date: 26 Apr 1999 22:08:59 GMT
Body:
Xref: news.vbrew.com junk:1
This is a test message, please feel free to ignore it.
.
If you attempt to retrieve an unknown article, the server will return a message with an appropriately coded response code and perhaps a readable text message:
article 4
423 Bad article number
We've described how the most important NNTP commands are used in this section. If you're interested in developing software that implements the NNTP protocol, you should refer to the relevant RFC documents; they provide a great deal of detail that we couldn't include here.
Let's now look at NNTP in action through the nntpd server.
Installing the NNTP Server
The NNTP server (nntpd) may be compiled in two ways, depending on the expected load on the news system. There are no compiled versions available, because of some site-specific defaults that are hardcoded into the executable. All configuration is done through macros defined in
nntpd may be configured as either a standalone server that is started at system boot time from an rc file, or a daemon managed by inetd. In the latter case, you have to have the following entry in
nntp stream tcp nowait news /usr/etc/in.nntpd nntpd
The
nntp 119/tcp readnews untp # Network News Transfer Protocol
To temporarily store any incoming articles, nntpd also needs a
# mkdir /var/spool/news/.tmp
# chown news.news /var/spool/news/.tmp
Restricting NNTP Access
Access to NNTP resources is governed by the file
If a client connects to the NNTP port, nntpd attempts to obtain the host's fully qualified domain name from its IP address using reverse lookup. The client's hostname and IP address are checked against the
Hostname
This is a fully qualified domain name of a host. If this matches the client's canonical hostname literally, the entry applies, and all following entries are ignored.
IP address
This is an IP address in dotted quad notation. If the client's IP address matches this, the entry applies, and