Author: sparky
Date: Mon Jun 28 00:03:18 2010
New Revision: 11609

Modified:
   toys/rsget.pl/Direct/HTTP
Log:
- resolve Refresh-based redirections


Modified: toys/rsget.pl/Direct/HTTP
==============================================================================
--- toys/rsget.pl/Direct/HTTP   (original)
+++ toys/rsget.pl/Direct/HTTP   Mon Jun 28 00:03:18 2010
@@ -25,7 +25,13 @@
                LINK( $-{_referer} );
        }
        ERROR( "file not found" ) unless m{^HTTP/1\.\d 200}m;
-       ERROR( "file is text ($type)" ) if $type =~ m#^text/#;
+       if ( $type =~ m#^text/# ) {
+               if ( /^Refresh:\s*.*?url=("|'|)(.*?)\1\s*\r$/mi ) {
+                       require URI;
+                       LINK( URI->new( $2 )->abs( $-{_referer} )->as_string );
+               }
+               ERROR( "file is text ($type)" );
+       }
        ERROR( "file is a small image ($type, $len)" )
                if $type =~ m#^image/# and $len < 100 * 1024;
 
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to