[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /lonnet/perl lonnet.pm
raeburn
raeburn at source.lon-capa.org
Thu Sep 20 23:58:54 EDT 2018
raeburn Fri Sep 21 03:58:54 2018 EDT
Modified files: (Branch: version_2_11_X)
/loncom/lonnet/perl lonnet.pm
Log:
- For 2.11
Backport 1.1385 (modified).
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1172.2.99 loncom/lonnet/perl/lonnet.pm:1.1172.2.100
--- loncom/lonnet/perl/lonnet.pm:1.1172.2.99 Tue Sep 11 17:21:07 2018
+++ loncom/lonnet/perl/lonnet.pm Fri Sep 21 03:58:53 2018
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.1172.2.99 2018/09/11 17:21:07 raeburn Exp $
+# $Id: lonnet.pm,v 1.1172.2.100 2018/09/21 03:58:53 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2840,8 +2840,7 @@
sub ssi {
my ($fn,%form)=@_;
- my $ua=new LWP::UserAgent;
- my $request;
+ my ($request,$response);
$form{'no_update_last_known'}=1;
&Apache::lonenc::check_encrypt(\$fn);
@@ -2858,7 +2857,25 @@
}
$request->header(Cookie => $ENV{'HTTP_COOKIE'});
- my $response= $ua->request($request);
+
+ if ($islocal) {
+ if (LWP::UserAgent->VERSION >= 5.834) {
+ my $ua=new LWP::UserAgent;
+ $ua->local_address('127.0.0.1');
+ $response = $ua->request($request);
+ } else {
+ {
+ require LWP::Protocol::http;
+ local @LWP::Protocol::http::EXTRA_SOCK_OPTS = (LocalAddr => '127.0.0.1');
+ my $ua=new LWP::UserAgent;
+ $response = $ua->request($request);
+ @LWP::Protocol::http::EXTRA_SOCK_OPTS = ();
+ }
+ }
+ } else {
+ my $ua=new LWP::UserAgent;
+ $response = $ua->request($request);
+ }
if (wantarray) {
return ($response->content, $response);
} else {
More information about the LON-CAPA-cvs
mailing list