🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #82548

Re: Injection-Info questions

#82548
From: D. Stussy
Date: Mon, 11 Jan 2010 21:38
41 lines
2970 bytes
"Steve Crook" <steve@mixmin.net> wrote in message
news:slrnhkm0mt.lhj.steve@news.mixmin.net...
> ...
> Here is my sample code.  If anyone has suggestions for improving it, I'd
> be very happy to hear about them.
> http://www.mixmin.net/cleanfeed/injectinfo

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.

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?)

        $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/;

    $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.

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.

Note:  You may know your way around perl regex's better than I do.

Technical Details
Message-ID: <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!news.le-studio75.com!aioe.org!gegeweb.org!news.snarked.org!not-for-mail
References: <slrnhjcc9b.u40.steve@news.mixmin.net> <hicoat$fun$1@news.trigofacile.com> <slrnhkm0mt.lhj.steve@news.mixmin.net>

Show Full Headers
Complete Article Headers
Message-ID: <hig5ra$9lr$1@snarked.org>
Subject: Re: Injection-Info questions
Date: Mon, 11 Jan 2010 13:38:15 -0800
From: "D. Stussy" <spam+newsgroups@bde-arc.ampr.org>
References: <slrnhjcc9b.u40.steve@news.mixmin.net> <hicoat$fun$1@news.trigofacile.com> <slrnhkm0mt.lhj.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!news.le-studio75.com!aioe.org!gegeweb.org!news.snarked.org!not-for-mail
Newsgroups: news.software.nntp
Lines: 41
Reply-To: "D. Stussy" <replies@newsgroups.kd6lvw.ampr.org>
NNTP-Posting-Host: pool-71-118-48-161.lsanca.dsl-w.verizon.net
X-Trace: snarked.org 1263245994 9915 71.118.48.161 (11 Jan 2010 21:39:54 GMT)
X-Complaints-To: newsmaster+complaints@snarked.org
NNTP-Posting-Date: Mon, 11 Jan 2010 21:39:54 +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