Skip to content

Commit

Permalink
fix cookie parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
zamronypj committed Aug 10, 2019
1 parent c7bed91 commit 7b766b1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/Http/Request/RequestImpl.pas
Expand Up @@ -34,7 +34,9 @@ interface
(*!------------------------------------------------
* basic class having capability as
* HTTP request
*
*-------------------------------------------------
* TODO: refactor
*-------------------------------------------------
* @author Zamrony P. Juhara <zamronypj@yahoo.com>
*-----------------------------------------------*)
TRequest = class(TInterfacedObject, IRequest)
Expand Down Expand Up @@ -64,7 +66,8 @@ TRequest = class(TInterfacedObject, IRequest)

procedure initParamsFromString(
const data : string;
const body : IList
const body : IList;
const separatorChar : char = '&'
);

procedure initPostBodyParamsFromStdInput(
Expand Down Expand Up @@ -272,13 +275,14 @@ implementation

procedure TRequest.initParamsFromString(
const data : string;
const body : IList
const body : IList;
const separatorChar : char = '&'
);
var arrOfQryStr, keyvalue : TStringArray;
i, len, lenKeyValue : integer;
param : PKeyValue;
begin
arrOfQryStr := data.split(['&']);
arrOfQryStr := data.split([separatorChar]);
len := length(arrOfQryStr);
for i:= 0 to len-1 do
begin
Expand Down Expand Up @@ -307,7 +311,7 @@ implementation
const cookies : IList
);
begin
initParamsFromString(env.httpCookie(), cookies);
initParamsFromString(env.httpCookie(), cookies, ';');
end;

procedure TRequest.raiseExceptionIfPostDataTooBig(const contentLength : int64);
Expand Down

0 comments on commit 7b766b1

Please sign in to comment.