--- loncom/lonnet/perl/lonnet.pm 2021/01/28 22:12:54 1.1439 +++ loncom/lonnet/perl/lonnet.pm 2021/02/11 19:54:52 1.1443 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.1439 2021/01/28 22:12:54 raeburn Exp $ +# $Id: lonnet.pm,v 1.1443 2021/02/11 19:54:52 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2164,10 +2164,19 @@ sub get_dom { } if ($udom && $uhome && ($uhome ne 'no_host')) { my $rep; - if ($namespace =~ /^enc/) { - $rep=&reply("encrypt:egetdom:$udom:$namespace:$items",$uhome); + if (grep { $_ eq $uhome } ¤t_machine_ids()) { + # domain information is hosted on this machine + my $cmd = 'getdom'; + if ($namespace =~ /^enc/) { + $cmd = 'egetdom'; + } + $rep = &LONCAPA::Lond::get_dom("$cmd:$udom:$namespace:$items"); } else { - $rep=&reply("getdom:$udom:$namespace:$items",$uhome); + if ($namespace =~ /^enc/) { + $rep=&reply("encrypt:egetdom:$udom:$namespace:$items",$uhome); + } else { + $rep=&reply("getdom:$udom:$namespace:$items",$uhome); + } } my %returnhash; if ($rep eq '' || $rep =~ /^error: 2 /) { @@ -2698,7 +2707,7 @@ sub get_domain_defaults { if (ref($domconfig{'usersessions'}{'offloadnow'}) eq 'HASH') { $domdefaults{'offloadnow'} = $domconfig{'usersessions'}{'offloadnow'}; } - if (ref($domconfig{'usersessions'}{offloadoth'} eq 'HASH') { + if (ref($domconfig{'usersessions'}{'offloadoth'}) eq 'HASH') { $domdefaults{'offloadoth'} = $domconfig{'usersessions'}{'offloadoth'}; } } @@ -4065,6 +4074,10 @@ sub clean_filename { # Replace all .\d. sequences with _\d. so they no longer look like version # numbers $fname=~s/\.(\d+)(?=\.)/_$1/g; +# Replace three or more adjacent underscores with one for consistency +# with loncfile::filename_check() so complete url can be extracted by +# lonnet::decode_symb() + $fname=~s/_{3,}/_/g; return $fname; } @@ -12419,7 +12432,7 @@ sub EXT { } } elsif ($realm eq 'client') { if ($space eq 'remote_addr') { - return $ENV{'REMOTE_ADDR'}; + return &get_requestor_ip(); } } return '';