Browse Source

* Fix from Дмитрий Ворошин, fix issue #39495

Michael Van Canneyt 3 years ago
parent
commit
bd77787712
1 changed files with 7 additions and 27 deletions
  1. 7 27
      packages/fcl-web/src/base/httpdefs.pp

+ 7 - 27
packages/fcl-web/src/base/httpdefs.pp

@@ -999,7 +999,6 @@ end;
 function TCORSSupport.HandleRequest(aRequest: TRequest; aResponse: TResponse; aOptions: THandleCORSOptions): Boolean;
 
 Var
-  S : String;
   Full : Boolean;
 
 begin
@@ -1763,9 +1762,6 @@ end;
 
 class function THTTPHeader.GetVariableHeaderType(Const aName: string): THTTPVariableType;
 
-Var
-   V : THTTPVariableType;
-
 begin
   Case IndexText(aName,[FieldCookie,FieldSetCookie,FieldXRequestedWith]) of
     0 : Result:=hvCookie;
@@ -1996,9 +1992,9 @@ begin
     // mean it is being used that way. In those cases the non-streaming file-
     // creation has to take place: (For example, CGI does not use the
     // streaming capabilities (may 2021))
-    CreateUploadedFile(Files)
+    Result:=CreateUploadedFile(Files)
   else
-    CreateFile(Files);
+    Result:=CreateFile(Files);
 end;
 
 
@@ -2301,6 +2297,8 @@ var
     isSep : Boolean;
 
   begin
+    if aPos > aLenStr then Exit(false);
+    Result := true;    
     BoT:=aPos;
     EoT:=aPos;
     for i:=aPos to aLenStr do
@@ -2325,30 +2323,13 @@ var
         begin
         if i = aLenStr then
           begin
-          EoT  := i;
-          aPos := i;
+          EoT  := i+1;
+          aPos := i+1;
           Break;
           end;
         end;
       end;
-    if aPos < aLenStr then
-      begin
-      aToken := Copy(aString, BoT, EoT - BoT);
-      Result := true;
-      end
-    else
-      begin
-      if aPos = aLenStr then
-        begin
-        aToken := Copy(aString, BoT, EoT - BoT + 1);
-        Result := true;
-        aPos   := aPos + 1;
-        end
-      else
-        begin
-        Result := false;
-       end;
-    end;
+    aToken := Copy(aString, BoT, EoT - BoT);
   end;
 
 
@@ -2507,7 +2488,6 @@ procedure TRequest.ProcessMultiPart(Stream: TStream; const Boundary: String;
 Var
   L : TMimeItems;
   B : String;
-  I : Integer;
   S : String;
   ST: TStringList;