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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Thu, 27 Mar 2008 12:51:59 -0000


raeburn		Thu Mar 27 08:51:59 2008 EDT

  Modified files:              (Branch: version_2_6_X)
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - backport parts of 1.942, 1.944 and 1.950
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.941 loncom/lonnet/perl/lonnet.pm:1.941.2.1
--- loncom/lonnet/perl/lonnet.pm:1.941	Sun Feb  3 00:08:05 2008
+++ loncom/lonnet/perl/lonnet.pm	Thu Mar 27 08:51:56 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.941 2008/02/03 05:08:05 raeburn Exp $
+# $Id: lonnet.pm,v 1.941.2.1 2008/03/27 12:51:56 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1650,12 +1650,20 @@
     return $protocol.$host_name;
 }
 
+#
+#   Server side include.
+# Parameters:
+#  fn     Possibly encrypted resource name/id.
+#  form   Hash that describes how the rendering should be done
+#         and other things.
+# Returns:
+#   Scalar context: The content of the response.
+#   Array context:  2 element list of the content and the full response object.
+#     
 sub ssi {
 
     my ($fn,%form)=@_;
-
     my $ua=new LWP::UserAgent;
-    
     my $request;
 
     $form{'no_update_last_known'}=1;
@@ -1670,7 +1678,11 @@
     $request->header(Cookie => $ENV{'HTTP_COOKIE'});
     my $response=$ua->request($request);
 
-    return $response->content;
+    if (wantarray) {
+	return ($response->content, $response);
+    } else {
+	return $response->content;
+    }
 }
 
 sub externalssi {