You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by fe...@apache.org on 2005/05/13 19:53:32 UTC
svn commit: r170062 - in /spamassassin/trunk: lib/Mail/SpamAssassin/Util.pm
t/uri.t
Author: felicity
Date: Fri May 13 10:53:31 2005
New Revision: 170062
URL: http://svn.apache.org/viewcvs?rev=170062&view=rev
Log:
do more aggressive attack on the CR in the URI issue, http:/\r/ has been appearing which wasn't being canonified correctly before. add a test for this specifically. also note that Util.pm is considered fully private in terms of API, etc.
Modified:
spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm
spamassassin/trunk/t/uri.t
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm?rev=170062&r1=170061&r2=170062&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm Fri May 13 10:53:31 2005
@@ -1,6 +1,10 @@
# A general class for utility functions. Please use this for
# functions that stand alone, without requiring a $self object,
# Portability functions especially.
+#
+# NOTE: The functions in this module are all considered private. Their API
+# may change at any point, and it's expected that they'll only be used by
+# other Mail::SpamAssassin modules.
# <@LICENSE>
# Copyright 2004 Apache Software Foundation
@@ -936,6 +940,9 @@
$uri =~ s/^\s+//;
$uri =~ s/\s+$//;
+ # CRs just confuse things down below, so trash them now
+ $uri =~ s/\r//g;
+
# Make a copy so we don't trash the original in the array
my $nuri = $uri;
@@ -953,10 +960,10 @@
# unschemed URIs: assume default of "http://" as most MUAs do
if ($nuri !~ /^[-_a-z0-9]+:/i) {
if ($nuri =~ /^ftp\./) {
- $nuri =~ s/^/ftp:\/\//g;
+ $nuri =~ s@^@ftp://@g;
}
else {
- $nuri =~ s/^/http:\/\//g;
+ $nuri =~ s@^@http://@g;
}
}
Modified: spamassassin/trunk/t/uri.t
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/t/uri.t?rev=170062&r1=170061&r2=170062&view=diff
==============================================================================
--- spamassassin/trunk/t/uri.t (original)
+++ spamassassin/trunk/t/uri.t Fri May 13 10:53:31 2005
@@ -124,10 +124,12 @@
ok(try_canon([
'http:www.spamassassin.org',
'http:/www.spamassassin.org',
+ "ht\rtp:/\r/www.exa\rmple.com",
], [
'http://www.spamassassin.org',
'http:www.spamassassin.org',
'http:/www.spamassassin.org',
+ 'http://www.example.com',
]));
# Try a simple redirector. Should return the redirector and the URI