[LON-CAPA-cvs] cvs: loncom(version_1_3_X) /lonnet/perl lonnet.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 28 Jan 2005 09:25:19 -0000
albertel Fri Jan 28 04:25:19 2005 EDT
Modified files: (Branch: version_1_3_X)
/loncom/lonnet/perl lonnet.pm
Log:
- BUG#597, store,restore,tmpstore,tmprestore,putstore all understand object references and can store them and restore them.
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.587.2.1 loncom/lonnet/perl/lonnet.pm:1.587.2.2
--- loncom/lonnet/perl/lonnet.pm:1.587.2.1 Thu Jan 20 01:40:38 2005
+++ loncom/lonnet/perl/lonnet.pm Fri Jan 28 04:25:18 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.587.2.1 2005/01/20 06:40:38 albertel Exp $
+# $Id: lonnet.pm,v 1.587.2.2 2005/01/28 09:25:18 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2092,9 +2092,11 @@
$namespace=~s/\//\_/g;
$namespace=~s/\W//g;
- #FIXME needs to do something for /pub resources
if (!$domain) { $domain=$ENV{'user.domain'}; }
if (!$stuname) { $stuname=$ENV{'user.name'}; }
+ if ($domain eq 'public' && $stuname eq 'public') {
+ $stuname=$ENV{'REMOTE_ADDR'};
+ }
my $path=$perlvar{'lonDaemons'}.'/tmp';
my %hash;
if (tie(%hash,'GDBM_File',
@@ -2127,9 +2129,11 @@
}
$namespace=~s/\//\_/g;
$namespace=~s/\W//g;
-#FIXME needs to do something for /pub resources
if (!$domain) { $domain=$ENV{'user.domain'}; }
if (!$stuname) { $stuname=$ENV{'user.name'}; }
+ if ($domain eq 'public' && $stuname eq 'public') {
+ $stuname=$ENV{'REMOTE_ADDR'};
+ }
my $now=time;
my %hash;
my $path=$perlvar{'lonDaemons'}.'/tmp';
@@ -2141,7 +2145,7 @@
my $allkeys='';
foreach my $key (keys(%$storehash)) {
$allkeys.=$key.':';
- $hash{"$version:$symb:$key"}=$$storehash{$key};
+ $hash{"$version:$symb:$key"}=&freeze_escape($$storehash{$key});
}
$hash{"$version:$symb:timestamp"}=$now;
$allkeys.='timestamp';
@@ -2168,10 +2172,12 @@
$symb=escape($symb);
if (!$namespace) { $namespace=$ENV{'request.state'}; }
- #FIXME needs to do something for /pub resources
+
if (!$domain) { $domain=$ENV{'user.domain'}; }
if (!$stuname) { $stuname=$ENV{'user.name'}; }
-
+ if ($domain eq 'public' && $stuname eq 'public') {
+ $stuname=$ENV{'REMOTE_ADDR'};
+ }
my %returnhash;
$namespace=~s/\//\_/g;
$namespace=~s/\W//g;
@@ -2189,8 +2195,8 @@
my $key;
$returnhash{"$scope:keys"}=$vkeys;
foreach $key (@keys) {
- $returnhash{"$scope:$key"}=$hash{"$scope:$symb:$key"};
- $returnhash{"$key"}=$hash{"$scope:$symb:$key"};
+ $returnhash{"$scope:$key"}=&thaw_unescape($hash{"$scope:$symb:$key"});
+ $returnhash{"$key"}=&thaw_unescape($hash{"$scope:$symb:$key"});
}
}
if (!(untie(%hash))) {
@@ -2231,7 +2237,7 @@
my $namevalue='';
foreach (keys %$storehash) {
- $namevalue.=escape($_).'='.escape($$storehash{$_}).'&';
+ $namevalue.=&escape($_).'='.&freeze_escape($$storehash{$_}).'&';
}
$namevalue=~s/\&$//;
&courselog($symb.':'.$stuname.':'.$domain.':STORE:'.$namevalue);
@@ -2267,7 +2273,7 @@
my $namevalue='';
foreach (keys %$storehash) {
- $namevalue.=escape($_).'='.escape($$storehash{$_}).'&';
+ $namevalue.=&escape($_).'='.&freeze_escape($$storehash{$_}).'&';
}
$namevalue=~s/\&$//;
&courselog($symb.':'.$stuname.':'.$domain.':CSTORE:'.$namevalue);
@@ -2301,7 +2307,7 @@
my %returnhash=();
foreach (split(/\&/,$answer)) {
my ($name,$value)=split(/\=/,$_);
- $returnhash{&unescape($name)}=&unescape($value);
+ $returnhash{&unescape($name)}=&thaw_unescape($value);
}
my $version;
for ($version=1;$version<=$returnhash{'version'};$version++) {
@@ -2692,7 +2698,7 @@
my $key = $1.':keys:'.$2;
$allitems{$key} .= $3.':';
}
- $items.=$_.'='.&escape($$storehash{$_}).'&';
+ $items.=$_.'='.&freeze_escape($$storehash{$_}).'&';
}
foreach (keys %allitems) {
$allitems{$_} =~ s/\:$//;