SVN: toys/rsget.pl/RSGet: FileList.pm ListAdder.pm

sparky sparky at pld-linux.org
Wed Jul 14 16:30:21 CEST 2010


Author: sparky
Date: Wed Jul 14 16:30:20 2010
New Revision: 11670

Modified:
   toys/rsget.pl/RSGet/FileList.pm
   toys/rsget.pl/RSGet/ListAdder.pm
Log:
- allow uris which don't seem complite (no file or even slash after domain),
  required for LinkProtector


Modified: toys/rsget.pl/RSGet/FileList.pm
==============================================================================
--- toys/rsget.pl/RSGet/FileList.pm	(original)
+++ toys/rsget.pl/RSGet/FileList.pm	Wed Jul 14 16:30:20 2010
@@ -257,11 +257,12 @@
 
 		my %decoded;
 		my @invalid;
+		my $protos = qr{(?:http|https|ftp|rtmp|rtmpt?(?:|e|s)|rtspu?)://}o;
 		foreach ( @words ) {
 			if ( /^([a-z0-9_]+)=(.*)$/ ) {
 				$options->{$1} = uri_unescape( $2 );
 				next;
-			} elsif ( m{^((?:http|https|ftp|rtmp|rtmpt?(?:|e|s)|rtspu?)://)?(.*?\..*?/.*)$} ) {
+			} elsif ( m{^($protos)?(.*?\..*?/.*)$}o or m{^($protos)(\S+?\.\S+)$}o ) {
 				my $proto = $1 || "http://";
 				my $uri = $proto . $2;
 				$options = {};

Modified: toys/rsget.pl/RSGet/ListAdder.pm
==============================================================================
--- toys/rsget.pl/RSGet/ListAdder.pm	(original)
+++ toys/rsget.pl/RSGet/ListAdder.pm	Wed Jul 14 16:30:20 2010
@@ -53,10 +53,12 @@
 		}
 	}
 
-	my $u = qr/[a-z0-9_-]+/;
-	my $tld = qr/[a-z]{2,8}/;
+	my $u = qr/[a-z0-9_-]+/o;
+	my $tld = qr/[a-z]{2,8}/o;
+	my $protos = qr{(?:http|https|ftp|rtmp|rtmpt?(?:|e|s)|rtspu?)://}o;
 	foreach ( split /\s+/s, $text ) {
-		next unless m{^(.*?)(https?://||ftp://)?((?:$u\.)*$u\.$tld/.+)$};
+		next unless m{^(.*?)($protos)?((?:$u\.)*$u\.$tld/.+)$}o
+			or m{^(.*?)($protos)((?:$u\.)*$u\.$tld)$}o;
 		my $pre = $1;
 		my $proto = $2 || "http://";
 		my $uri = $proto . $3;


More information about the pld-cvs-commit mailing list