fix: unicode problems (accounts)

This commit is contained in:
Massimo Melina 2020-05-09 00:36:57 +02:00
parent 09abf511ea
commit 99af92cc18
2 changed files with 7 additions and 6 deletions

View File

@ -118,7 +118,7 @@ type
ver: ansistring; ver: ansistring;
firstByte, lastByte: int64; // body interval for partial requests firstByte, lastByte: int64; // body interval for partial requests
headers, cookies: ThashedStringList; headers, cookies: ThashedStringList;
user,pwd: ansistring; user,pwd: string;
end; end;
ThttpPost = record ThttpPost = record
@ -1055,6 +1055,7 @@ procedure ThttpConn.processInputBuffer();
function parseHeader():boolean; function parseHeader():boolean;
var var
r, s: ansistring; r, s: ansistring;
u: string;
i : integer; i : integer;
begin begin
result:=FALSE; result:=FALSE;
@ -1097,9 +1098,9 @@ procedure ThttpConn.processInputBuffer();
if AnsiStartsText('Basic',s) then if AnsiStartsText('Basic',s) then
begin begin
delete(s,1,6); delete(s,1,6);
s:=base64decode(s); u:=UTF8decode(base64decode(s));
request.user:=trim(chop(':',s)); request.user:=trim(chop(':',u));
request.pwd:=s; request.pwd:=u;
end; end;
s:=getHeader('Connection'); s:=getHeader('Connection');

View File

@ -6365,7 +6365,7 @@ type
begin begin
case encoding of case encoding of
E_PLAIN: result:=s; E_PLAIN: result:=s;
E_B64: result:=base64encode(s); E_B64: result:=b64utf8(s);
E_ZIP: E_ZIP:
begin begin
result:=zCompressStr(s, clMax); result:=zCompressStr(s, clMax);
@ -6719,7 +6719,7 @@ var
if p = 'login' then if p = 'login' then
begin begin
if not anycharIn(':', t) then if not anycharIn(':', t) then
t:=base64decode(t); t:=decodeB64utf8(t);
a.user:=chop(':',t); a.user:=chop(':',t);
a.pwd:=t; a.pwd:=t;
end end