[LON-CAPA-cvs] cvs: loncom(version_2_6_X) /lonnet/perl lonnet.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Fri, 04 Apr 2008 16:58:44 -0000


raeburn		Fri Apr  4 12:58:44 2008 EDT

  Modified files:              (Branch: version_2_6_X)
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - backport 1.953, 1.954
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.941.2.1 loncom/lonnet/perl/lonnet.pm:1.941.2.2
--- loncom/lonnet/perl/lonnet.pm:1.941.2.1	Thu Mar 27 08:51:56 2008
+++ loncom/lonnet/perl/lonnet.pm	Fri Apr  4 12:58:44 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.941.2.1 2008/03/27 12:51:56 raeburn Exp $
+# $Id: lonnet.pm,v 1.941.2.2 2008/04/04 16:58:44 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1631,12 +1631,21 @@
     if (! exists($form{'LONCAPA_INTERNAL_no_discussion'})) {
         $form{'LONCAPA_INTERNAL_no_discussion'}='true';
     }
-    my $output=($filelink=~/^http\:/?&externalssi($filelink):
-                                     &ssi($filelink,%form));
+    my $output='';
+    my $response;
+    if ($filelink=~/^http\:/) {
+        ($output,$response)=&externalssi($filelink);
+    } else {
+        ($output,$response)=&ssi($filelink,%form);
+    }
     $output=~s|//(\s*<!--)? BEGIN LON-CAPA Internal.+?// END LON-CAPA Internal\s*(-->)?\s||gs;
     $output=~s/^.*?\<body[^\>]*\>//si;
     $output=~s/\<\/body\s*\>.*?$//si;
-    return $output;
+    if (wantarray) {
+        return ($output, $response);
+    } else {
+        return $output;
+    }
 }
 
 # --------------------------------------------------------- Server Side Include
@@ -1690,7 +1699,11 @@
     my $ua=new LWP::UserAgent;
     my $request=new HTTP::Request('GET',$url);
     my $response=$ua->request($request);
-    return $response->content;
+    if (wantarray) {
+        return ($response->content, $response);
+    } else {
+        return $response->content;
+    }
 }
 
 # -------------------------------- Allow a /uploaded/ URI to be vouched for