version 1.169, 2018/01/12 13:33:46
|
version 1.171, 2018/11/24 16:19:04
|
Line 289 sub upload_size_allowed {
|
Line 289 sub upload_size_allowed {
|
sub sso_login { |
sub sso_login { |
my ($r,$handle,$username) = @_; |
my ($r,$handle,$username) = @_; |
|
|
my $lonidsdir=$r->dir_config('lonIDsDir'); |
|
if (($r->user eq '') || ($username ne '') || ($r->user eq 'public:public') || |
if (($r->user eq '') || ($username ne '') || ($r->user eq 'public:public') || |
(defined($env{'user.name'}) && (defined($env{'user.domain'})) |
(defined($env{'user.name'}) && (defined($env{'user.domain'})) |
&& ($handle ne ''))) { |
&& ($handle ne ''))) { |
Line 341 sub sso_login {
|
Line 340 sub sso_login {
|
($is_balancer,$otherserver) = |
($is_balancer,$otherserver) = |
&Apache::lonnet::check_loadbalancing($user,$domain,'login'); |
&Apache::lonnet::check_loadbalancing($user,$domain,'login'); |
if ($is_balancer) { |
if ($is_balancer) { |
if ($otherserver eq '') { |
# Check if browser sent a LON-CAPA load balancer cookie (and this is a balancer) |
|
my ($found_server,$balancer_cookie) = &Apache::lonnet::check_for_balancer_cookie($r); |
|
if (($found_server) && ($balancer_cookie =~ /^\Q$domain\E_\Q$user\E_/)) { |
|
$otherserver = $found_server; |
|
} elsif ($otherserver eq '') { |
my $lowest_load; |
my $lowest_load; |
($otherserver,undef,undef,undef,$lowest_load) = &Apache::lonnet::choose_server($domain); |
($otherserver,undef,undef,undef,$lowest_load) = &Apache::lonnet::choose_server($domain); |
if ($lowest_load > 100) { |
if ($lowest_load > 100) { |
$otherserver = &Apache::lonnet::spareserver($lowest_load,$lowest_load,1,$domain); |
$otherserver = &Apache::lonnet::spareserver($lowest_load,$lowest_load,1,$domain); |
} |
} |
} |
if ($otherserver ne '') { |
if ($otherserver ne '') { |
my @hosts = &Apache::lonnet::current_machine_ids(); |
my @hosts = &Apache::lonnet::current_machine_ids(); |
if (grep(/^\Q$otherserver\E$/,@hosts)) { |
if (grep(/^\Q$otherserver\E$/,@hosts)) { |
$hosthere = $otherserver; |
$hosthere = $otherserver; |
} |
} |
} |
} |
} |
} |
} |
Line 562 sub handler {
|
Line 565 sub handler {
|
my $checkexempt; |
my $checkexempt; |
if ($env{'user.loadbalexempt'} eq $r->dir_config('lonHostID')) { |
if ($env{'user.loadbalexempt'} eq $r->dir_config('lonHostID')) { |
if ($env{'user.loadbalcheck.time'} + 600 > time) { |
if ($env{'user.loadbalcheck.time'} + 600 > time) { |
$checkexempt = 1; |
$checkexempt = 1; |
} |
} |
} |
} |
if ($env{'user.noloadbalance'} eq $r->dir_config('lonHostID')) { |
if ($env{'user.noloadbalance'} eq $r->dir_config('lonHostID')) { |
Line 572 sub handler {
|
Line 575 sub handler {
|
($is_balancer,$otherserver) = |
($is_balancer,$otherserver) = |
&Apache::lonnet::check_loadbalancing($env{'user.name'}, |
&Apache::lonnet::check_loadbalancing($env{'user.name'}, |
$env{'user.domain'}); |
$env{'user.domain'}); |
|
if ($is_balancer) { |
|
unless (($requrl eq '/adm/switchserver') && (!$r->is_initial_req())) { |
|
# Check if browser sent a LON-CAPA load balancer cookie (and this is a balancer) |
|
my ($found_server,$balancer_cookie) = &Apache::lonnet::check_for_balancer_cookie($r); |
|
if (($found_server) && ($balancer_cookie =~ /^\Q$env{'user.domain'}\E_\Q$env{'user.name'}\E_/)) { |
|
$otherserver = $found_server; |
|
} |
|
} |
|
} |
} |
} |
if ($is_balancer) { |
if ($is_balancer) { |
$r->set_handlers('PerlResponseHandler'=> |
unless (($requrl eq '/adm/switchserver') && (!$r->is_initial_req())) { |
[\&Apache::switchserver::handler]); |
$r->set_handlers('PerlResponseHandler'=> |
if ($otherserver ne '') { |
[\&Apache::switchserver::handler]); |
$env{'form.otherserver'} = $otherserver; |
if ($otherserver ne '') { |
|
$env{'form.otherserver'} = $otherserver; |
|
} |
} |
} |
unless (($env{'form.origurl'}) || ($r->uri eq '/adm/roles') || |
unless (($env{'form.origurl'}) || ($r->uri eq '/adm/roles') || |
($r->uri eq '/adm/switchserver') || ($r->uri eq '/adm/sso')) { |
($r->uri eq '/adm/switchserver') || ($r->uri eq '/adm/sso')) { |