Browse Source

* Handle all methods

git-svn-id: trunk@23666 -
michael 12 years ago
parent
commit
81e2032bbe
1 changed files with 6 additions and 10 deletions
  1. 6 10
      packages/fcl-web/src/base/httpdefs.pp

+ 6 - 10
packages/fcl-web/src/base/httpdefs.pp

@@ -660,7 +660,7 @@ end;
 Function THttpHeader.GetFieldValue(Index : Integer) : String;
 Function THttpHeader.GetFieldValue(Index : Integer) : String;
 
 
 begin
 begin
-  if (Index>1) and (Index<NoHTTPFields) then
+  if (Index>=1) and (Index<=NoHTTPFields) then
     Result:=FFields[Index]
     Result:=FFields[Index]
   else
   else
     case Index of
     case Index of
@@ -1231,16 +1231,12 @@ begin
   R:=Method;
   R:=Method;
   if (R='') then
   if (R='') then
     Raise Exception.Create(SErrNoRequestMethod);
     Raise Exception.Create(SErrNoRequestMethod);
-  if CompareText(R,'POST')=0 then
-    begin
+  // Always process QUERYSTRING.
+  InitGetVars;
+  // POST and PUT, force post var treatment.
+  // To catch other methods we do not treat specially, we'll do the same if contentlength>0
+  if (CompareText(R,'POST')=0) or (CompareText(R,'PUT')=0) or (ContentLength>0) then
     InitPostVars;
     InitPostVars;
-    if FHandleGetOnPost then
-      InitGetVars;
-    end
-  else if (CompareText(R,'GET')=0) or (CompareText(R,'HEAD')=0) or (CompareText(R,'OPTIONS')=0) then
-    InitGetVars
-  else
-    Raise Exception.CreateFmt(SErrInvalidRequestMethod,[R]);
 {$ifdef CGIDEBUG}
 {$ifdef CGIDEBUG}
   SendMethodExit('TRequest.InitRequestVars');
   SendMethodExit('TRequest.InitRequestVars');
 {$endif}
 {$endif}