[LON-CAPA-cvs] cvs: loncom /cgi loncgi.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 10 Apr 2006 17:46:05 -0000
albertel Mon Apr 10 13:46:05 2006 EDT
Modified files:
/loncom/cgi loncgi.pm
Log:
- session env is stored escaped now
Index: loncom/cgi/loncgi.pm
diff -u loncom/cgi/loncgi.pm:1.5 loncom/cgi/loncgi.pm:1.6
--- loncom/cgi/loncgi.pm:1.5 Wed May 25 18:31:51 2005
+++ loncom/cgi/loncgi.pm Mon Apr 10 13:46:04 2006
@@ -1,7 +1,7 @@
#
# LON-CAPA helpers for cgi-bin scripts
#
-# $Id: loncgi.pm,v 1.5 2005/05/25 22:31:51 albertel Exp $
+# $Id: loncgi.pm,v 1.6 2006/04/10 17:46:04 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -150,7 +150,9 @@
}
foreach my $envrow (@profile) {
chomp($envrow);
- my ($envname,$envvalue)=split(/=/,$envrow);
+ my ($envname,$envvalue)=split(/=/,$envrow,2);
+ $envname = &unescape($envname);
+ $envvalue = &unescape($envvalue);
$Apache::lonnet::env{$envname} = $envvalue;
}
$Apache::lonnet::env{'user.environment'} = "$lonidsdir/$handle.id";
@@ -160,6 +162,21 @@
#############################################
#############################################
+sub escape {
+ my $str=shift;
+ $str =~ s/(\W)/"%".unpack('H2',$1)/eg;
+ return $str;
+}
+
+# ----------------------------------------------------- Un-Escape Special Chars
+
+sub unescape {
+ my $str=shift;
+ $str =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
+ return $str;
+}
+
+
=pod
=back