Article View: news.software.nntp
Article #18158Re: "NNTP-Posting-Date" with patch
From: Brian Tao
Date: Mon, 02 Jun 1997 00:00
Date: Mon, 02 Jun 1997 00:00
75 lines
3172 bytes
3172 bytes
In article <5mukc1$q3n@tor-nn1-hb0.netcom.ca>, Brian Tao <taob@nbc.netcom.ca> wrote:
>
> I must be overlooking something rather obvious, since the code to
> generate the header itself is trivial.
Yep, it was something obvious. ;-) The HEADER_DELTA value in
nnrpd/post.c is off by one in the INN 1.5.1 distribution. It is an
offset value that should point to the next available array entry after
the predefined set of headers. There are 21 headers defined, but
HEADER_DELTA is set to 20. I haven't checked to see if an existing
patch to 1.5.1 fixes this.
Anyhow, the rest is easy. strftime() is used to allow for easy
customization of the date string, although the format I use in the
patch follows the convention set by the Date header. As a side
effect, the patch makes use of a declared, but previously unused
variable. ;-) Would this be useful/proper enough to be included in
future releases of INN?
[cc'd to inn-bugs@isc.org]
----- cut here -----
*** post.c.orig Sun Jun 1 19:54:18 1997
--- post.c Mon Jun 2 10:40:04 1997
***************
*** 15,21 ****
#include "post.h"
#define FLUSH_ERROR(F) (fflush((F)) == EOF || ferror((F)))
! #define HEADER_DELTA 20
STATIC char Error[SMBUF];
STATIC char NGSEPS[] = NG_SEPARATOR;
--- 15,21 ----
#include "post.h"
#define FLUSH_ERROR(F) (fflush((F)) == EOF || ferror((F)))
! #define HEADER_DELTA 22
STATIC char Error[SMBUF];
STATIC char NGSEPS[] = NG_SEPARATOR;
***************
*** 71,76 ****
--- 71,78 ----
#define _contenttype 19
{ "Content-Transfer-Encoding", TRUE, HTstd },
#define _contenttransferencoding 20
+ { "NNTP-Posting-Date", FALSE, HTstd },
+ #define _nntppostdate 21
{ "Xref", FALSE, HTstd },
{ "Summary", TRUE, HTstd },
{ "Keywords", TRUE, HTstd },
***************
*** 429,434 ****
--- 431,441 ----
/* NNTP-Posting host; set. */
HDR(_nntpposthost) = ClientHost;
+ /* NNTP-Posting date; set. */
+ t = time((time_t *)NULL);
+ (void)strftime(datebuff, 40, "%d %b %Y %T %Z", localtime(&t));
+ HDR(_nntppostdate) = datebuff;
+
/* Now make sure everything is there. */
for (hp = Table; hp < ENDOF(Table); hp++)
if (hp->Type == HTreq && hp->Value == NULL) {
----- cut here -----
--
Brian Tao (BT300, taob@netcom.ca)
"Though this be madness, yet there is method in't"
Technical Details
Message-ID:
<5muoor$18v@tor-nn1-hb0.netcom.ca>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailReferences:
<5mtl3h$2fo@tor-nn1-hb0.netcom.ca> <5mtmrn$sm5$1@news.cmc.net> <5mukc1$q3n@tor-nn1-hb0.netcom.ca>Show Full Headers
Complete Article Headers
Message-ID: <5muoor$18v@tor-nn1-hb0.netcom.ca> Subject: Re: "NNTP-Posting-Date" with patch Date: Mon, 02 Jun 1997 00:00:00 +0000 From: taob@nbc.netcom.ca (Brian Tao) References: <5mtl3h$2fo@tor-nn1-hb0.netcom.ca> <5mtmrn$sm5$1@news.cmc.net> <5mukc1$q3n@tor-nn1-hb0.netcom.ca> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 245642487 Distribution: inet Organization: NETCOM Canada, Toronto, Ontario, Canada X-NETCOM-Date: Mon Jun 02 11:27:23 AM EDT 1997 Newsgroups: news.software.nntp X-Newsposter: Pnews 4.0-test52 (20 Jan 97)