unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Andrey Melnikov <temnota.am@gmail.com>
To: Eric Wong <e@80x24.org>
Cc: meta@public-inbox.org
Subject: Re: [PATCH] nntp: delimit Newsgroup: header with commas
Date: Wed, 4 Nov 2020 02:11:03 +0300	[thread overview]
Message-ID: <CA+PODjoKHq1Rh-LOvTQZg3zMWRetPsohEA41YrAy7B0zo03UfA@mail.gmail.com> (raw)
In-Reply-To: <20201103225559.GA5247@dcvr>

ср, 4 нояб. 2020 г. в 01:56, Eric Wong <e@80x24.org>:
>
> Andrey Melnikov <temnota.am@gmail.com> wrote:
> > Hi.
> >
> > nntpd generate wrong "Newsgoups:" header when message cross-posted to
> > multiple groups. Currently, it write multiple groups separated with
> > space, but rfc1036 chapter 2.1.3 says "... Multiple newsgroups may be
> > specified, separated by a comma. ...".
> > and Path: header too - rfc1036 chapter 2.1.6 says " ... The names may
> > be separated by any punctuation character or characters (except "."
> > which is considered part of the hostname). ..."
> > Currently both headers separated as email-style with spaces,
>
> Thanks for the bug report.  Does this break known clients or
> is it just something you happened to notice?

This break filtering on my leafnode.

> I'm using RFC 5536 since it obsoletes 1036.
> Testing the following on news.public-inbox.org:
>
> ----------8<-------
> Subject: [PATCH] nntp: delimit Newsgroup: header with commas
>
> ...instead of spaces.  This is specified in RFC 5536 3.1.4.
>
> Include references to RFC 1036, 5536 and 5537 in our docs while
> we're at it.
>
> Reported-by: Andrey Melnikov <temnota.am@gmail.com>
> Link: https://public-inbox.org/meta/CA+PODjpUN5Q4gBFQhAzUNuMasVEdmp9f=8Uo0Ej0mFumdSwi4w@mail.gmail.com/
> ---
>  Documentation/standards.perl |  3 +++
>  lib/PublicInbox/NNTP.pm      | 11 ++++++++---
>  2 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/standards.perl b/Documentation/standards.perl
> index 0ac6cc52..1c56830e 100755
> --- a/Documentation/standards.perl
> +++ b/Documentation/standards.perl
> @@ -25,6 +25,9 @@ EOF
>  my $rfcs = [
>         3977 => 'NNTP',
>         977 => 'NNTP (old)',
> +       1036 => 'Standard for Interchange of USENET Messages',
> +       5536 => 'Netnews Article Format',
> +       5537 => 'Netnews Architecture and Protocols',
>         6048 => 'NNTP additions to LIST command (TODO)',
>         8054 => 'NNTP compression',
>         4642 => 'NNTP TLS',
> diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
> index 102ef42c..783c0076 100644
> --- a/lib/PublicInbox/NNTP.pm
> +++ b/lib/PublicInbox/NNTP.pm
> @@ -432,12 +432,17 @@ sub set_nntp_headers ($$) {
>                 $hdr->header_set('X-Alt-Message-ID', @alt);
>         }
>
> -       # clobber some
> +       # clobber some existing headers
>         my $ibx = $smsg->{-ibx};
>         my $xref = xref($smsg->{nntp}, $ibx, $smsg->{num}, $mid);
>         $hdr->header_set('Xref', $xref);
> -       $xref =~ s/:[0-9]+//g;
> -       $hdr->header_set('Newsgroups', (split(/ /, $xref, 2))[1]);
> +
> +       # RFC 5536 3.1.4
> +       my $newsgroups = (split(/ /, $xref, 2))[1]; # drop server name
> +       $newsgroups =~ s/:[0-9]+\b//g; # drop NNTP article numbers
> +       $newsgroups =~ tr/ /,/;
> +       $hdr->header_set('Newsgroups', $newsgroups);
> +
>         header_append($hdr, 'List-Post', "<mailto:$ibx->{-primary_address}>");
>         if (my $url = $ibx->base_url) {
>                 $mid = mid_escape($mid);

What about "Path:" header?

  reply	other threads:[~2020-11-03 23:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-03 12:29 nntpd generate wrong headers Andrey Melnikov
2020-11-03 22:55 ` [PATCH] nntp: delimit Newsgroup: header with commas Eric Wong
2020-11-03 23:11   ` Andrey Melnikov [this message]
2020-11-03 23:59     ` Eric Wong
     [not found]       ` <CA+PODjr0NcFBu42mOdFnmf4vvxb3YZ+nUt=GqWEq+agXa8Au0Q@mail.gmail.com>
2020-11-04 10:44         ` Eric Wong
2020-11-04 11:46           ` Andrey Melnikov
2020-11-04 19:47             ` Eric Wong
2020-11-04 21:01               ` Andrey Melnikov
2020-11-05  7:50                 ` Eric Wong
2020-11-06 11:57                   ` Andrey Melnikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+PODjoKHq1Rh-LOvTQZg3zMWRetPsohEA41YrAy7B0zo03UfA@mail.gmail.com \
    --to=temnota.am@gmail.com \
    --cc=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).