[Ada] Properly decode "+" in CGI parameters as spaces

Arnaud Charlet charlet@adacore.com
Thu Jun 11 15:59:00 GMT 2009


The decode routine was only handling the %nn encoded characters.
This patch adds the decoding of plus-sign into a space.

Tested on x86_64-pc-linux-gnu, committed on trunk

2009-06-11  Pascal Obry  <obry@adacore.com>

	* g-cgi.adb: Properly decode "+" in CGI parameters as spaces.

-------------- next part --------------
Index: g-cgi.adb
===================================================================
--- g-cgi.adb	(revision 148391)
+++ g-cgi.adb	(working copy)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---                      Copyright (C) 2001-2006, AdaCore                    --
+--                      Copyright (C) 2001-2009, AdaCore                    --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -123,6 +123,11 @@ package body GNAT.CGI is
               (Natural'Value ("16#" & S (K + 1 .. K + 2) & '#'));
             K := K + 3;
 
+         elsif S (K) = '+' then
+            --  + sign is decoded as a space
+            Result (J) := ' ';
+            K := K + 1;
+
          else
             Result (J) := S (K);
             K := K + 1;


More information about the Gcc-patches mailing list