Forum général.hors-sujets www.apple.fr nous donne un script perl !

Posté par  (site web personnel) .
Étiquettes : aucune
0
3
août
2010
http://www.apple.fr/ nous donne :

#!/usr/local/bin/perl
# version 1.1
# If the host+path are in matrix then the redirect is to a single location
# if just the host is in matrix then the redirect is to host+the request URI
require "./init";
$path = $ENV{'REQUEST_URI'};
$host = $ENV{'HTTP_HOST'};
$test = join('/', $host, $path);
$test =~ s/\/\//\//g;
$test =~ s/\/$//;
$| = 1;
$0 = "itured";
unless (@matrix{$test}){
$destURI = @matrix{$host};
$location = join("",$destURI,$path);
}

if (@matrix{$test}){
$destURI = "1";
$location = @matrix{$test};
}
$location = "http://www.apple.com/" if ($destURI eq "");
$location =~ s/\?\/\?/\?/;
$location =~ s/\?+/\?/;

$htm = "Found\nFound This document has moved to a new <a href=\"$location\"> location.\nPlease update your documents and hotlists accordingly. ";
$end = "\n<!--httphost $ENV{'HTTP_HOST'}\nURI $ENV{'REQUEST_URI'}\n qs $QS\nenv $ENV{'QUERY_STRING'}-->\n";
print <<"EOF"
HTTP/1.0 301 Found
Server: Apache/1.3.26 (Darwin)
Date: Tue Jun 1 12:48:03 PDT 1999 PDT
Location: $location
Content-type: text/html
EOF
;

$html = join("",$htm,$location,$end);
print 'Content-length: ' . length($html) . "\n\n";
print $html;
exit(0);


Combien de temps cela durera t-il ? ;-)

Suivre le flux des commentaires

Note : les commentaires appartiennent à celles et ceux qui les ont postés. Nous n’en sommes pas responsables.