OSDN Git Service

Update comments.
[pf3gnuchains/gcc-fork.git] / gcc / ada / g-cgi.adb
index 1cd9100..dad3738 100644 (file)
@@ -6,9 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---                            $Revision: 1.3 $
---                                                                          --
---              Copyright (C) 2001 Ada Core Technologies, Inc.              --
+--                      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- --
@@ -18,8 +16,8 @@
 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
 -- for  more details.  You should have  received  a copy of the GNU General --
 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
--- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
--- MA 02111-1307, USA.                                                      --
+-- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
+-- Boston, MA 02110-1301, USA.                                              --
 --                                                                          --
 -- As a special exception,  if other files  instantiate  generics from this --
 -- unit, or you link  this unit with other files  to produce an executable, --
@@ -28,7 +26,8 @@
 -- however invalidate  any other reasons why  the executable file  might be --
 -- covered by the  GNU Public License.                                      --
 --                                                                          --
--- GNAT is maintained by Ada Core Technologies Inc (http://www.gnat.com).   --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
 --                                                                          --
 ------------------------------------------------------------------------------
 
@@ -51,10 +50,10 @@ package body GNAT.CGI is
    --  services exported by this unit.
 
    Current_Method : Method_Type;
-   --  This is the current method used to pass CGI parameters.
+   --  This is the current method used to pass CGI parameters
 
    Header_Sent : Boolean := False;
-   --  Will be set to True when the header will be sent.
+   --  Will be set to True when the header will be sent
 
    --  Key/Value table declaration
 
@@ -73,7 +72,7 @@ package body GNAT.CGI is
 
    procedure Check_Environment;
    pragma Inline (Check_Environment);
-   --  This procedure will raise Data_Error if Valid_Environment is False.
+   --  This procedure will raise Data_Error if Valid_Environment is False
 
    procedure Initialize;
    --  Initialize CGI package by reading the runtime environment. This
@@ -124,6 +123,12 @@ package body GNAT.CGI is
               (Natural'Value ("16#" & S (K + 1 .. K + 2) & '#'));
             K := K + 3;
 
+         --  Plus sign is decoded as a space
+
+         elsif S (K) = '+' then
+            Result (J) := ' ';
+            K := K + 1;
+
          else
             Result (J) := S (K);
             K := K + 1;
@@ -179,7 +184,7 @@ package body GNAT.CGI is
       --  for the data is passed in CONTENT_LENGTH environment variable.
 
       procedure Set_Parameter_Table (Data : String);
-      --  Parse the parameter data and set the parameter table.
+      --  Parse the parameter data and set the parameter table
 
       --------------------
       -- Initialize_GET --
@@ -189,6 +194,7 @@ package body GNAT.CGI is
          Data : constant String := Metavariable (Query_String);
       begin
          Current_Method := Get;
+
          if Data /= "" then
             Set_Parameter_Table (Data);
          end if;
@@ -329,16 +335,15 @@ package body GNAT.CGI is
       Required : Boolean := False) return String
    is
       function Get_Environment (Variable_Name : String) return String;
-      --  Returns the environment variable content.
+      --  Returns the environment variable content
 
       ---------------------
       -- Get_Environment --
       ---------------------
 
       function Get_Environment (Variable_Name : String) return String is
-         Value : OS_Lib.String_Access := OS_Lib.Getenv (Variable_Name);
+         Value  : OS_Lib.String_Access := OS_Lib.Getenv (Variable_Name);
          Result : constant String := Value.all;
-
       begin
          OS_Lib.Free (Value);
          return Result;