Article View: news.software.nntp
Article #82678Re: unrelated possible bug with C flag?
From: D. Stussy
Date: Thu, 28 Jan 2010 01:28
Date: Thu, 28 Jan 2010 01:28
122 lines
5453 bytes
5453 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message
news:hjq8r4$s5h$1@news.trigofacile.com...
> Answering to myself:
>
> > --- art.c (révision 8911)
> > +++ art.c (copie de travail)
> > @@ -2159,13 +2159,24 @@
> > }
> >
> > if (HDR_FOUND(HDR__FOLLOWUPTO)) {
> > - for (i = 0, p = HDR(HDR__FOLLOWUPTO) ; (p = strchr(p, ',')) !=
NULL ;
> > - i++, p++)
> > - continue;
> > + for (i = 0, p = HDR(HDR__FOLLOWUPTO) ; p != NULL && *p != '\0';
p++) {
> > + /* Skip leading whitespaces. */
> > + for (; *p && ISWHITE(*p) ; p++)
> > + continue;
I agree with changing the [outer] for-loop conditional to just "p != NULL",
but it's the internals of the loop I think are a problem.
I've been busy with work the past 3 days, but thought about this. I would
have replaced the "continue" with "p = strchr( ++p, ',')" and remove the
p++ from the loop-closure. As we're only counting, I don't think we have
to worry about whitespace.
> I've improved the patch to also skip folding whitespaces and take into
> account Russ' remark about "poster" when used in a newsgroup list.
>
> The whole process would be:
>
> if (HDR_FOUND(HDR__FOLLOWUPTO)) {
> PosterGroup = false;
> for (i = 0, p = HDR(HDR__FOLLOWUPTO) ; p != NULL && *p != '\0'; p++)
{
> /* Skip leading whitespaces. */
> p = (char *) skip_fws(p);
>
> if (*p != '\0' && *p != ',')
> i++;
>
> /* Check whether "poster" is in the header field. */
> if (strncasecmp(p, "poster", 6) == 0
> && (p[6] == ',' || p[6] == ' ' || p[6] == '\t'
> || p[6] == '\r' || p[6] == '\n' || p[6] == '\0')) {
> PosterGroup = true;
> }
>
> if ((p = strchr(p, ',')) == NULL)
> break;
> }
>
> /* When "poster" is the only value, then it is not a followup.
> * Otherwise, it is a followup to a newsgroup named "poster". */
> if (PosterGroup && i == 1) {
> data->Followcount = 0;
> } else {
> data->Followcount = i;
> }
> } else {
> data->Followcount = data->Groupcount;
> }
>
>
>
> With this new skip_fws function (designed like the existing skip_cfws):
>
> --- lib/headers.c (révision 8880)
> +++ lib/headers.c (copie de travail)
> @@ -86,3 +86,32 @@
> }
> return p;
> }
> +
> +
> +/*
> +** Skip any amount of FWS (folding whitespace), the RFC 5322 grammar
term
> +** for whitespace and CRLF pairs. We also allow simple newlines since
we don't
> +** always deal with wire-format messages. Note that we do not attempt
to
> +** ensure that CRLF or a newline is followed by whitespace. Returns
the new
> +** position of the pointer.
> +*/
> +const char *
> +skip_fws(const char *p)
> +{
> + for (; *p != '\0'; p++) {
> + switch (*p) {
> + case ' ':
> + case '\t':
> + case '\n':
> + break;
> + case '\r':
> + if (p[1] != '\n')
> + return p;
> + break;
> + default:
> + return p;
> + }
> + }
> + return p;
> +}
I think that RFC 1036 made it clear: "poster", with its special meaning,
may only appear alone. Therefore, we don't have to check to see if it's
specified in the string; only that it IS the string of the "newsgroups:"
header data field. I don't see any change in RFC 5536 to this behavior.
Since different clients had different responses to encountering "poster"
with a group, post + email, post to group "poster", or ignoring "poster",
current client behavior is not controlling. I believe that the RFCs imply
that such an article should not have been accepted in the first place, and
therefore, the varying client responses are [responses] to a condition that
never should have arisen.
Technical Details
Message-ID:
<hjqp78$iis$1@snarked.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.dca.giganews.com!nntp.giganews.com!news-in-01.newsfeed.easynews.com!news-in-02.newsfeed.easynews.com!easynews.com!easynews!news.he.net!news.snarked.org!not-for-mailReferences:
<hic74m$vi8$1@news.trigofacile.com> <hicf9f$ntj$1@snarked.org> <hiclo9$dd4$1@news.trigofacile.com> <hidmvp$vh1$1@snarked.org> <hitipd$rtb$1@news.trigofacile.com> <hiu2ar$707$1@snarked.org> <hiun2p$2mt$1@news.trigofacile.com> <hj0m9c$g98$1@snarked.org> <hj7qh0$ggu$1@news.trigofacile.com> <hj8csn$cok$1@snarked.org> <hjaiid$f7c$1@news.trigofacile.com> <hjar9t$mq$1@snarked.org> <hjnpm4$f5l$1@news.trigofacile.com> <hjq8r4$s5h$1@news.trigofacile.com>Show Full Headers
Complete Article Headers
Message-ID: <hjqp78$iis$1@snarked.org> Subject: Re: unrelated possible bug with C flag? Date: Wed, 27 Jan 2010 17:28:04 -0800 From: "D. Stussy" <spam+newsgroups@bde-arc.ampr.org> References: <hic74m$vi8$1@news.trigofacile.com> <hicf9f$ntj$1@snarked.org> <hiclo9$dd4$1@news.trigofacile.com> <hidmvp$vh1$1@snarked.org> <hitipd$rtb$1@news.trigofacile.com> <hiu2ar$707$1@snarked.org> <hiun2p$2mt$1@news.trigofacile.com> <hj0m9c$g98$1@snarked.org> <hj7qh0$ggu$1@news.trigofacile.com> <hj8csn$cok$1@snarked.org> <hjaiid$f7c$1@news.trigofacile.com> <hjar9t$mq$1@snarked.org> <hjnpm4$f5l$1@news.trigofacile.com> <hjq8r4$s5h$1@news.trigofacile.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.dca.giganews.com!nntp.giganews.com!news-in-01.newsfeed.easynews.com!news-in-02.newsfeed.easynews.com!easynews.com!easynews!news.he.net!news.snarked.org!not-for-mail Newsgroups: news.software.nntp Lines: 122 Reply-To: "D. Stussy" <replies@newsgroups.kd6lvw.ampr.org> NNTP-Posting-Host: 71.118.51.220 X-Trace: snarked.org 1264642088 19036 71.118.51.220 (28 Jan 2010 01:28:08 GMT) X-Complaints-To: newsmaster+complaints@snarked.org NNTP-Posting-Date: Thu, 28 Jan 2010 01:28:08 +0000 (UTC) X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1478 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478