[LON-CAPA-cvs] cvs: loncom /auth lonshibauth.pm
raeburn
raeburn at source.lon-capa.org
Sun May 17 13:34:44 EDT 2015
raeburn Sun May 17 17:34:44 2015 EDT
Modified files:
/loncom/auth lonshibauth.pm
Log:
- Too early in request for $ENV{'SERVER_PORT'} to be set, so determine if
this server needs https or http from configuration in hosts.tab
Index: loncom/auth/lonshibauth.pm
diff -u loncom/auth/lonshibauth.pm:1.2 loncom/auth/lonshibauth.pm:1.3
--- loncom/auth/lonshibauth.pm:1.2 Fri Jan 4 01:37:02 2013
+++ loncom/auth/lonshibauth.pm Sun May 17 17:34:43 2015
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Redirect Shibboleth authentication to designated URL (/adm/sso).
#
-# $Id: lonshibauth.pm,v 1.2 2013/01/04 01:37:02 raeburn Exp $
+# $Id: lonshibauth.pm,v 1.3 2015/05/17 17:34:43 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -67,6 +67,7 @@
use strict;
use lib '/home/httpd/lib/perl/';
+use Apache::lonnet;
use Apache::Constants qw(:common REDIRECT);
use LONCAPA qw(:DEFAULT);
@@ -74,7 +75,12 @@
my $r = shift;
my $target = '/adm/sso';
if (($r->user eq '') && ($r->uri() ne $target)) {
- my $dest = &Apache::lonnet::absolute_url($r->hostname()).$target;
+ my $lonhost = $Apache::lonnet::perlvar{'lonHostID'};
+ my $hostname = &Apache::lonnet::hostname($lonhost);
+ if (!$hostname) { $hostname = $r->hostname(); }
+ my $protocol = $Apache::lonnet::protocol{$lonhost};
+ unless ($protocol eq 'https') { $protocol = 'http'; }
+ my $dest = $protocol.'://'.$hostname.$target;
$r->subprocess_env;
if ($ENV{'QUERY_STRING'} ne '') {
$dest .= '?'.$ENV{'QUERY_STRING'};
More information about the LON-CAPA-cvs
mailing list