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

foxr lon-capa-cvs-allow@mail.lon-capa.org
Thu, 21 Feb 2008 10:04:36 -0000


foxr		Thu Feb 21 05:04:36 2008 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  BZ5631:
  
  Make lonnet::ssi capable of returning the entire request object.
  The idea is to allow the caller to analyze it to do
  error detection,
  error recovery,
  implement retry policies.
  
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.941 loncom/lonnet/perl/lonnet.pm:1.942
--- loncom/lonnet/perl/lonnet.pm:1.941	Sun Feb  3 00:08:05 2008
+++ loncom/lonnet/perl/lonnet.pm	Thu Feb 21 05:04:35 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.942 2008/02/21 10:04:35 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1650,9 +1650,21 @@
     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.
+#  r      Optional reference that will be given the response.
+#         This is mostly provided so that the caller can implement
+#         error detection, recovery and retry policies.
+#     
+# Returns:
+#    The content of the response.
 sub ssi {
 
-    my ($fn,%form)=@_;
+    my ($fn,%form, $r)=@_;
 
     my $ua=new LWP::UserAgent;
     
@@ -1670,6 +1682,10 @@
     $request->header(Cookie => $ENV{'HTTP_COOKIE'});
     my $response=$ua->request($request);
 
+    if ($r) {
+	$$r = $response;
+    }
+
     return $response->content;
 }