--- loncom/lonnet/perl/lonnet.pm 2008/03/27 12:51:56 1.941.2.1 +++ loncom/lonnet/perl/lonnet.pm 2008/02/21 10:04:35 1.942 @@ -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.942 2008/02/21 10:04:35 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1656,14 +1656,18 @@ sub absolute_url { # 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. +# 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; + my $request; $form{'no_update_last_known'}=1; @@ -1678,11 +1682,11 @@ sub ssi { $request->header(Cookie => $ENV{'HTTP_COOKIE'}); my $response=$ua->request($request); - if (wantarray) { - return ($response->content, $response); - } else { - return $response->content; + if ($r) { + $$r = $response; } + + return $response->content; } sub externalssi {