From 99af92cc1821f5f6579fcee9510b6c455474b9d3 Mon Sep 17 00:00:00 2001 From: Massimo Melina Date: Sat, 9 May 2020 00:36:57 +0200 Subject: [PATCH] fix: unicode problems (accounts) --- hslib.pas | 9 +++++---- main.pas | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/hslib.pas b/hslib.pas index af97481..18b539e 100644 --- a/hslib.pas +++ b/hslib.pas @@ -118,7 +118,7 @@ type ver: ansistring; firstByte, lastByte: int64; // body interval for partial requests headers, cookies: ThashedStringList; - user,pwd: ansistring; + user,pwd: string; end; ThttpPost = record @@ -1055,6 +1055,7 @@ procedure ThttpConn.processInputBuffer(); function parseHeader():boolean; var r, s: ansistring; + u: string; i : integer; begin result:=FALSE; @@ -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'); diff --git a/main.pas b/main.pas index 0c32184..36c2619 100644 --- a/main.pas +++ b/main.pas @@ -6365,7 +6365,7 @@ type 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); @@ -6719,7 +6719,7 @@ var if p = 'login' then begin if not anycharIn(':', t) then - t:=base64decode(t); + t:=decodeB64utf8(t); a.user:=chop(':',t); a.pwd:=t; end