svn commit: r1929170 - spamassassin/trunk/lib/Mail/SpamAssassin/Plugin

[email protected]
Newsgroups gmane.mail.spam.spamassassin.cvs
Message-ID <176060847996.2445142.7125179654799339683@svn02-us-east.apache.org>
Author: gbechis
Date: Thu Oct 16 09:54:39 2025
New Revision: 1929170

Log:
remove duplicated parameters in order to better catch loops

Modified:
   spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Redirectors.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Redirectors.pm
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Redirectors.pm	Thu Oct 16 08:30:17 2025	(r1929169)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/Redirectors.pm	Thu Oct 16 09:54:39 2025	(r1929170)
@@ -999,6 +999,18 @@ sub recursive_lookup {
     dbg("looks like a redirection to a relative URI: $orig_redir_url => $location ($orig_location)");
   }
 
+  # remove duplicated parameters in order to better catch loops
+  my %paramseen;
+  my $denorm_location = $location;
+  my ($hostpart, $querystring) = split /\?/, $location, 2;
+  my @params = split /&|%26/, $querystring;
+  my @unique_params = grep { !$paramseen{$_}++ } @params;
+  my $nquerystring = join '&', @unique_params;
+  $location = $hostpart . '?' . $nquerystring;
+  if($denorm_location ne $location) {
+    dbg("Normalizing redirector parameters from $denorm_location to $location"); 
+  }
+
   my ($domain, $host) = $self->{main}->{registryboundaries}->uri_to_domain($location);
   if (exists $been_here{$host}) {
     dbg("Chained redirector that uses the same hostname $host found for location $location");
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.