--- loncom/lonnet/perl/lonnet.pm 2008/12/09 11:32:03 1.977 +++ loncom/lonnet/perl/lonnet.pm 2008/12/19 17:04:57 1.979 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.977 2008/12/09 11:32:03 amueller Exp $ +# $Id: lonnet.pm,v 1.979 2008/12/19 17:04:57 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -4406,7 +4406,7 @@ sub is_portfolio_file { } sub usertools_access { - my ($uname,$udom,$tool) = @_; + my ($uname,$udom,$tool,$action) = @_; my $access; my %tools = ( aboutme => 1, @@ -4420,10 +4420,10 @@ sub usertools_access { $uname = $env{'user.name'}; } - my $hashid=$uname.':'.$udom; - my ($result,$cached) = &is_cached_new('usertools.'.$tool,$hashid); - if (defined($cached)) { - return $result; + if (($udom eq $env{'user.domain'}) && ($uname eq $env{'user.name'})) { + if ($action ne 'reload') { + return $env{'environment.availabletools.'.$tool}; + } } my ($toolstatus,$inststatus); @@ -4443,7 +4443,6 @@ sub usertools_access { } else { $access = 0; } - &do_cache_new('usertools.'.$tool,$hashid,$access,600); return $access; } @@ -4457,7 +4456,6 @@ sub usertools_access { } else { $access = 0; } - &do_cache_new('usertools.'.$tool,$hashid,$access,600); return $access; } } @@ -4478,7 +4476,6 @@ sub usertools_access { } elsif ($hasnoaccess) { $access = 0; } - &do_cache_new('usertools.'.$tool,$hashid,$access,600); return $access; } } else { @@ -4488,13 +4485,11 @@ sub usertools_access { } elsif ($domdef{$tool}{'default'} == 0) { $access = 0; } - &do_cache_new('usertools.'.$tool,$hashid,$access,600); return $access; } } } else { $access = 1; - &do_cache_new('usertools.'.$tool,$hashid,$access,600); return $access; } } @@ -8653,14 +8648,19 @@ sub get_dns { open(my $config,"<$perlvar{'lonTabDir'}/hosts.tab"); foreach my $dns (<$config>) { next if ($dns !~ /^\^(\S*)/x); - $alldns{$1} = 1; + my $line = $1; + my ($host,$protocol) = split(/:/,$line); + if ($protocol ne 'https') { + $protocol = 'http'; + } + $alldns{$host} = $protocol; } while (%alldns) { my ($dns) = keys(%alldns); - delete($alldns{$dns}); my $ua=new LWP::UserAgent; - my $request=new HTTP::Request('GET',"http://$dns$url"); + my $request=new HTTP::Request('GET',"$alldns{$dns}://$dns$url"); my $response=$ua->request($request); + delete($alldns{$dns}); next if ($response->is_error()); my @content = split("\n",$response->content); &Apache::lonnet::do_cache_new('dns',$url,\@content,30*24*60*60);