🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #82556

Re: Injection-Info questions

#82556
From: Steve Crook
Date: Tue, 12 Jan 2010 10:47
50 lines
3511 bytes
On Mon, 11 Jan 2010 13:38:15 -0800, D. Stussy wrote in
Message-Id: <hig5ra$9lr$1@snarked.org>:

> What if a quoted string inside the data is quoted because it contains a
> semicolon?  split() won't parse that properly - but will separate the two
> quoted-string halves.  One needs to allow for malformed headers as well as
> the properly-formed.
Yes, I hadn't considered the presence of a semi-colon in a
quoted-string.  It's an invalid atom character but for quoted-strings,
any printable ASCII is valid, excluding \ and ".  I'll need to think
about how to handle that one.

In terms of malformed headers, there is plenty of scope for problems.
Clients of older servers are free to insert anything they like into an
Injection-Info header.  I plan to include some syntax checking but
correctly formatted false data is hard to trap.

> unfold():  I also don't like this:
>         $body =~ s/^"//;
>         $body =~ s/"$//;
> Because it doesn't BALANCE opening and closing quotes.  Maybe you want:
>         $body =~ s/^".*"$/&/;
> I don't recall if perl allows the ampersand to be assigned the matching
> value (like in "vi").  If not, maybe this works:
>         $body =~ s/^"(.*)"$/%1/;   (or should that be $1?)
I agree, that is nicer.  I've now made it s/^"(.*)"$/$1/;

>         $body =~ s/\\[^\x0D\x0A]//;
> If this is to eliminate folding whitespace, don't we need a whitespace
> character to follow?  For EOL, we need "$".  Therefore, might this be what
> you want?
>         $body =~ s/\\[^\x0D\x0A]([ \t]|$)/%1/;
The folded whitespace is handled further up with s/\x0D?\x0A\s*//g;. The
regex you're referring to was cleaning up after splitting the header but
I don't think it's actually required at all now.  I'll do some further
tests.


>     $struct_head{hostname} = shift @fields;
> Is "hostname" the best name for this value?  How about "posting-server" -
> as it's the posting server's name (and in contrast to "posting-host" which
> is derrived from the data).  You might not be confused, but I'm thinking
> about people who may write additional checks for the header.
How about 'injection-server'?

> I don't even follow or understand your comment_regex() function beyond its
> purpose to generate a regex used elsewhere, so my silence on it shouldn't
> mean that there's nothing wrong.  I merely accept that it achieves your
> goal of stripping all CWFS comments up to 5 levels deep.
I take no credit for that one, it's taken from a Cpan package.  :)
Technical Details
Message-ID: <slrnhkokqq.mgt.steve@news.mixmin.net>
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.ams.giganews.com!nntp.giganews.com!xlned.com!feeder1.xlned.com!news.netcologne.de!newsfeed-fusi2.netcologne.de!news.mixmin.net!not-for-mail
References: <slrnhjcc9b.u40.steve@news.mixmin.net> <hicoat$fun$1@news.trigofacile.com> <slrnhkm0mt.lhj.steve@news.mixmin.net> <hig5ra$9lr$1@snarked.org>

Show Full Headers
Complete Article Headers
Message-ID: <slrnhkokqq.mgt.steve@news.mixmin.net>
Subject: Re: Injection-Info questions
Date: Tue, 12 Jan 2010 10:47:54 +0000
From: Steve Crook <steve@mixmin.net>
References: <slrnhjcc9b.u40.steve@news.mixmin.net> <hicoat$fun$1@news.trigofacile.com> <slrnhkm0mt.lhj.steve@news.mixmin.net> <hig5ra$9lr$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.ams.giganews.com!nntp.giganews.com!xlned.com!feeder1.xlned.com!news.netcologne.de!newsfeed-fusi2.netcologne.de!news.mixmin.net!not-for-mail
Newsgroups: news.software.nntp
Organization: Mixmin
Injection-Date: Tue, 12 Jan 2010 10:47:54 +0000 (UTC)
Injection-Info: news.mixmin.net; posting-host="ip6-localhost:::1";
 logging-data="3179"; mail-complaints-to="abuse@mixmin.net"
User-Agent: slrn/pre1.0.0-18 (Linux)
Lines: 49