[LON-CAPA-cvs] cvs: rat / lonambiguous.pm lonpageflip.pm loncom/auth lonlogin.pm loncom/interface loncommon.pm loncom/lonnet/perl lonnet.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 19 Sep 2006 19:03:28 -0000


albertel		Tue Sep 19 15:03:28 2006 EDT

  Modified files:              
    /loncom/auth	lonlogin.pm 
    /loncom/interface	loncommon.pm 
    /loncom/lonnet/perl	lonnet.pm 
    /rat	lonambiguous.pm lonpageflip.pm 
  Log:
  - move absoltue_url to lonnet,
  - use absolute_url in lonnet::ssi 
  
  
Index: loncom/auth/lonlogin.pm
diff -u loncom/auth/lonlogin.pm:1.79 loncom/auth/lonlogin.pm:1.80
--- loncom/auth/lonlogin.pm:1.79	Tue Aug 29 16:12:43 2006
+++ loncom/auth/lonlogin.pm	Tue Sep 19 15:03:08 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Login Screen
 #
-# $Id: lonlogin.pm,v 1.79 2006/08/29 20:12:43 albertel Exp $
+# $Id: lonlogin.pm,v 1.80 2006/09/19 19:03:08 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -164,7 +164,7 @@
     my $userloadpercent=&Apache::lonnet::userload();
 
 # ------------------------------------------------------- Do the load balancing
-    my $otherserver= &Apache::loncommon::absolute_url($host_name);
+    my $otherserver= &Apache::lonnet::absolute_url($host_name);
     my $firsturl=
     ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});
 # ---------------------------------------- Are we access server and overloaded?
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.455 loncom/interface/loncommon.pm:1.456
--- loncom/interface/loncommon.pm:1.455	Wed Sep 13 17:43:25 2006
+++ loncom/interface/loncommon.pm	Tue Sep 19 15:03:22 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.455 2006/09/13 21:43:25 albertel Exp $
+# $Id: loncommon.pm,v 1.456 2006/09/19 19:03:22 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5951,15 +5951,6 @@
     return 'http://'.$ENV{'SERVER_NAME'}.':'.$lonhttpd_port.$url;
 }
 
-sub absolute_url {
-    my ($host_name) = @_;
-    my $protocol = ($ENV{'SERVER_PORT'} == 443?'https://':'http://');
-    if ($host_name eq '') {
-	$host_name = $ENV{'SERVER_NAME'};
-    }
-    return $protocol.$host_name;
-}
-
 sub connection_aborted {
     my ($r)=@_;
     $r->print(" ");$r->rflush();
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.781 loncom/lonnet/perl/lonnet.pm:1.782
--- loncom/lonnet/perl/lonnet.pm:1.781	Fri Sep 15 16:49:29 2006
+++ loncom/lonnet/perl/lonnet.pm	Tue Sep 19 15:03:24 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.781 2006/09/15 20:49:29 raeburn Exp $
+# $Id: lonnet.pm,v 1.782 2006/09/19 19:03:24 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1191,6 +1191,15 @@
 
 # --------------------------------------------------------- Server Side Include
 
+sub absolute_url {
+    my ($host_name) = @_;
+    my $protocol = ($ENV{'SERVER_PORT'} == 443?'https://':'http://');
+    if ($host_name eq '') {
+	$host_name = $ENV{'SERVER_NAME'};
+    }
+    return $protocol.$host_name;
+}
+
 sub ssi {
 
     my ($fn,%form)=@_;
@@ -1202,10 +1211,10 @@
     $form{'no_update_last_known'}=1;
 
     if (%form) {
-      $request=new HTTP::Request('POST',"http://".$ENV{'HTTP_HOST'}.$fn);
+      $request=new HTTP::Request('POST',&absolute_url().$fn);
       $request->content(join('&',map { &escape($_).'='.&escape($form{$_}) } keys %form));
     } else {
-      $request=new HTTP::Request('GET',"http://".$ENV{'HTTP_HOST'}.$fn);
+      $request=new HTTP::Request('GET',&absolute_url().$fn);
     }
 
     $request->header(Cookie => $ENV{'HTTP_COOKIE'});
Index: rat/lonambiguous.pm
diff -u rat/lonambiguous.pm:1.20 rat/lonambiguous.pm:1.21
--- rat/lonambiguous.pm:1.20	Fri Aug 18 16:24:53 2006
+++ rat/lonambiguous.pm	Tue Sep 19 15:03:27 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to resolve ambiguous file locations
 #
-# $Id: lonambiguous.pm,v 1.20 2006/08/18 20:24:53 albertel Exp $
+# $Id: lonambiguous.pm,v 1.21 2006/09/19 19:03:27 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -95,7 +95,7 @@
 				           $resurl => [$resurl,$resid]);
                  untie(%bighash);
                  $r->header_out(Location => 
-				&Apache::loncommon::absolute_url().$resurl);
+				&Apache::lonnet::absolute_url().$resurl);
                  return REDIRECT;
              }
 	  }
@@ -134,7 +134,7 @@
 # ----------------------------------- Okay, this should have appeared on a page
 	   &Apache::loncommon::content_type($r,'text/html');
            $r->header_out(Location => 
-			  &Apache::loncommon::absolute_url().
+			  &Apache::lonnet::absolute_url().
 			  &Apache::lonnet::clutter($page));
            return REDIRECT;
        } else {
@@ -147,7 +147,7 @@
    if ($env{'request.enc'}) {
        &Apache::loncommon::content_type($r,'text/html');
        $r->header_out(Location => 
-		      &Apache::loncommon::absolute_url().'/adm/navmaps');
+		      &Apache::lonnet::absolute_url().'/adm/navmaps');
        return REDIRECT;
    }
 # ------------------------------------------------ Would be standalone resource
@@ -180,7 +180,7 @@
 		my $symb=&make_symb($id);
 		&Apache::loncommon::content_type($r,'text/html');
 		$r->header_out(Location => 
-			       &Apache::loncommon::absolute_url().
+			       &Apache::lonnet::absolute_url().
 			       $resurl.'?symb='.$symb);
 		return REDIRECT;
 	    }
Index: rat/lonpageflip.pm
diff -u rat/lonpageflip.pm:1.70 rat/lonpageflip.pm:1.71
--- rat/lonpageflip.pm:1.70	Fri Aug 18 16:24:53 2006
+++ rat/lonpageflip.pm	Tue Sep 19 15:03:27 2006
@@ -2,7 +2,7 @@
 #
 # Page flip handler
 #
-# $Id: lonpageflip.pm,v 1.70 2006/08/18 20:24:53 albertel Exp $
+# $Id: lonpageflip.pm,v 1.71 2006/09/19 19:03:27 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -257,7 +257,7 @@
 	  my $furl=&first_accessible_resource();
 	  &Apache::loncommon::content_type($r,'text/html');
 	  $r->header_out(Location => 
-			 &Apache::loncommon::absolute_url().$furl);
+			 &Apache::lonnet::absolute_url().$furl);
 	     
 	  return REDIRECT;
       }
@@ -291,7 +291,7 @@
 	 } else {
 	     &Apache::loncommon::content_type($r,'text/html');
 	     $r->header_out(Location => 
-			    &Apache::loncommon::absolute_url().$newloc);
+			    &Apache::lonnet::absolute_url().$newloc);
 	     
 	     return REDIRECT;
 	 }
@@ -314,7 +314,7 @@
 	     if ($direction eq 'return') {
 		 &Apache::loncommon::content_type($r,'text/html');
 		 $r->header_out(Location => 
-				&Apache::loncommon::absolute_url().
+				&Apache::lonnet::absolute_url().
 				'/adm/noidea.html');
 		 return REDIRECT;
 	     } else {
@@ -417,7 +417,7 @@
 		  }
 
 		  &Apache::loncommon::content_type($r,'text/html');
-		  my $url=&Apache::loncommon::absolute_url().$redirecturl;
+		  my $url=&Apache::lonnet::absolute_url().$redirecturl;
 		  $url = &add_get_param($url, { 'symb' => $redirectsymb});
                   $r->header_out(Location => $url);
                   return REDIRECT;