[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm

droeschl droeschl at source.lon-capa.org
Fri Dec 5 10:15:12 EST 2014


droeschl		Fri Dec  5 15:15:12 2014 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  Correct HTTP POST request body in cases where values of %form contain
  array references.
  
  The error became apparent because numerical response problems with multiple
  answer values embedded in composite pages showed ARRAY(..) in their input fields
  after a student submission. 
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1271 loncom/lonnet/perl/lonnet.pm:1.1272
--- loncom/lonnet/perl/lonnet.pm:1.1271	Thu Dec  4 15:41:36 2014
+++ loncom/lonnet/perl/lonnet.pm	Fri Dec  5 15:15:12 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1271 2014/12/04 15:41:36 raeburn Exp $
+# $Id: lonnet.pm,v 1.1272 2014/12/05 15:15:12 droeschl Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2723,7 +2723,12 @@
     &Apache::lonenc::check_encrypt(\$fn);
     if (%form) {
       $request=new HTTP::Request('POST',&absolute_url().$fn);
-      $request->content(join('&',map { &escape($_).'='.&escape($form{$_}) } keys(%form)));
+      $request->content(join('&',map { 
+            my $name = escape($_);
+            "$name=" . ( ref($form{$_}) eq 'ARRAY' 
+            ? join("&$name=", map {escape($_) } @{$form{$_}}) 
+            : &escape($form{$_}) );    
+        } keys(%form)));
     } else {
       $request=new HTTP::Request('GET',&absolute_url().$fn);
     }




More information about the LON-CAPA-cvs mailing list