version 1.823, 2007/01/12 22:14:28
|
version 1.826, 2007/01/18 15:58:29
|
Line 7143 sub repcopy_userfile {
|
Line 7143 sub repcopy_userfile {
|
if ($lwpresp ne 'ok') { |
if ($lwpresp ne 'ok') { |
my $ua=new LWP::UserAgent; |
my $ua=new LWP::UserAgent; |
my $request=new HTTP::Request('GET',&tokenwrapper($uri)); |
my $request=new HTTP::Request('GET',&tokenwrapper($uri)); |
|
# FIXME, right reads everything into memory then writes it out |
|
# doing something like |
|
# my $response=$ua->request($request,$file); |
|
# would make this write directly to disk |
my $response=$ua->request($request); |
my $response=$ua->request($request); |
if ($response->is_success()) { |
if ($response->is_success()) { |
$info=$response->content; |
$info=$response->content; |
Line 7302 sub current_machine_ids {
|
Line 7306 sub current_machine_ids {
|
return @ids; |
return @ids; |
} |
} |
|
|
|
sub additional_machine_domains { |
|
my @domains; |
|
open(my $fh,"<$perlvar{'lonTabDir'}/expected_domains.tab"); |
|
while( my $line = <$fh>) { |
|
$line =~ s/\s//g; |
|
push(@domains,$line); |
|
} |
|
return @domains; |
|
} |
|
|
|
sub default_login_domain { |
|
my $domain = $perlvar{'lonDefDomain'}; |
|
my $testdomain=(split(/\./,$ENV{'HTTP_HOST'}))[0]; |
|
foreach my $posdom (¤t_machine_domains(), |
|
&additional_machine_domains()) { |
|
if (lc($posdom) eq lc($testdomain)) { |
|
$domain=$posdom; |
|
last; |
|
} |
|
} |
|
return $domain; |
|
} |
|
|
# ------------------------------------------------------------- Declutters URLs |
# ------------------------------------------------------------- Declutters URLs |
|
|
sub declutter { |
sub declutter { |
Line 7474 sub get_iphost {
|
Line 7501 sub get_iphost {
|
if (!exists($name_to_ip{$name})) { |
if (!exists($name_to_ip{$name})) { |
$ip = gethostbyname($name); |
$ip = gethostbyname($name); |
if (!$ip || length($ip) ne 4) { |
if (!$ip || length($ip) ne 4) { |
&logthis("Skipping host $id name $name no IP found\n"); |
&logthis("Skipping host $id name $name no IP found"); |
next; |
next; |
} |
} |
$ip=inet_ntoa($ip); |
$ip=inet_ntoa($ip); |