Skip to content

Commit

Permalink
fix: unicode problems (accounts)
Browse files Browse the repository at this point in the history
  • Loading branch information
rejetto committed May 8, 2020
1 parent 09abf51 commit 99af92c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions hslib.pas
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ ThttpRequest = record
ver: ansistring;
firstByte, lastByte: int64; // body interval for partial requests
headers, cookies: ThashedStringList;
user,pwd: ansistring;
user,pwd: string;
end;

ThttpPost = record
Expand Down Expand Up @@ -1055,6 +1055,7 @@ procedure ThttpConn.processInputBuffer();
function parseHeader():boolean;
var
r, s: ansistring;
u: string;
i : integer;
begin
result:=FALSE;
Expand Down Expand Up @@ -1097,9 +1098,9 @@ procedure ThttpConn.processInputBuffer();
if AnsiStartsText('Basic',s) then
begin
delete(s,1,6);
s:=base64decode(s);
request.user:=trim(chop(':',s));
request.pwd:=s;
u:=UTF8decode(base64decode(s));
request.user:=trim(chop(':',u));
request.pwd:=u;
end;

s:=getHeader('Connection');
Expand Down
4 changes: 2 additions & 2 deletions main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6365,7 +6365,7 @@ function TmainFrm.getCfg(exclude:string=''):string;
begin
case encoding of
E_PLAIN: result:=s;
E_B64: result:=base64encode(s);
E_B64: result:=b64utf8(s);
E_ZIP:
begin
result:=zCompressStr(s, clMax);
Expand Down Expand Up @@ -6719,7 +6719,7 @@ function TmainFrm.setCfg(cfg:string; alreadyStarted:boolean):boolean;
if p = 'login' then
begin
if not anycharIn(':', t) then
t:=base64decode(t);
t:=decodeB64utf8(t);
a.user:=chop(':',t);
a.pwd:=t;
end
Expand Down

0 comments on commit 99af92c

Please sign in to comment.