diff --git a/ChangeLog b/ChangeLog index b8daa92..c8db122 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,11 @@ yapfaq 1.1.0 (unreleased) * --test: Set Supersedes and don't modify Message-ID if -o is set. * --test: Force -o if -n is not set. * Add conversion script for old status files. + * Accept a posting-frequency of "never", too. + * Check for illegal headers and stop posting, if found. + * Disabled projects must be posted, if forced. + * Warn of unencoded 8bit characters in header or body if -d is set. + * Update POD. yapfaq 1.0.1 (2025-01-24) * Add %t placeholder for Message-ID (feature parity with 0.9). diff --git a/bin/yapfaq.pl b/bin/yapfaq.pl index be517c0..3c018d1 100755 --- a/bin/yapfaq.pl +++ b/bin/yapfaq.pl @@ -412,6 +412,17 @@ sub BuildPosting { return ''; } + # check for illegal headers + my $FoundIllegalHeader = 0; + foreach (qw/Date User-Agent X-Newsreader X-Mailer Injection-Date + Injection-Info NNTP-Posting-Date NNTP-Posting-Host X-Trace/) { + if ($Header{lc($_)}) { + warn "W: $_ header may not be set in '$HeaderFile'.\n"; + $FoundIllegalHeader = 1; + } + } + return '' if $FoundIllegalHeader; + # add Date: push @Headers, 'Date: ' . $TD->strftime('%a, %d %b %Y %H:%M:%S %z') . "\n"; # add missing Message-ID: @@ -419,6 +430,16 @@ sub BuildPosting { # add User-Agent push @Headers, "User-Agent: $NAME/$VERSION\n"; + # check for unencoded 8bit characters in header or body in --debug mode + # taken from tinews.pl + if ($Config{'debug'}) { + print "- Raw 8-bit data in headers.\n" if (grep {/[\x80-\xff]/} @Headers); + # check for MIME headers and warn for 8bit characters in body if missing + if (!defined($Header{'mime-version'}) || !defined($Header{'content-type'})) { + print "- 8bit data in body without MIME-headers.\n" if (grep {/[\x80-\xff]/} @Body); + } + } + # parse pseudo headers from body my ($InRealBody,$LastModified,$PostingFrequency); foreach (@Body) { @@ -515,8 +536,8 @@ sub BuildPosting { } } - # not due if Posting-Freqency is "none" - if ($PostingFrequency =~ /none/) { + # not due if Posting-Freqency is "none" or never + if ($PostingFrequency =~ /none|never/ && !$OptForce) { print "... is disabled.\n" if $Config{'verbose'} or $Config{'debug'}; return ''; } @@ -740,7 +761,14 @@ files need to be in B. Needs to have at least I, I and I and can contain all other headers that the posting should have. Headers must conform to RFC 5536 and RFC 5322 and use MIME encoded words for -8bit characters. B won't convert headers. +8bit characters. B won't convert headers, but will warn of +unencoded 8bit characters in B<--debug> mode. Longer headers should +be folded; B won't fold headers. + +The headers file must not contain any of the following headers: +I, I, I, I, +I, I, I, +I or I. I may contain a I<%LM> placeholder that will be replaced with the I pseudo-header from the text file @@ -802,7 +830,8 @@ I and I will be evaluated by B. If your content contains 8bit characters, you'll need suitable MIME -headers in your headers file. +headers in your headers file. B will warn of unencoded 8bit +characters with missung MIME headers in B<--debug> mode. B