diff --git a/hslib.pas b/hslib.pas index a0305ec..bd1796a 100644 --- a/hslib.pas +++ b/hslib.pas @@ -527,10 +527,14 @@ while i < len do continue; if c >= $FE then exit(FALSE); - if c >= $F0 then more:=3 - else if c >= $E0 then more:=2 - else if c >= $C0 then more:=1 - else exit(FALSE); + if c >= $F0 then + more:=3 + else if c >= $E0 then + more:=2 + else if c >= $C0 then + more:=1 + else + exit(FALSE); if i+more > len then exit(FALSE); while more > 0 do diff --git a/main.pas b/main.pas index c810d57..2ea92d3 100644 --- a/main.pas +++ b/main.pas @@ -4624,22 +4624,26 @@ var procedure doLog(); var i: integer; - url_: string; // an alias, final '_' is to not confuse with the other var s: string; + + function decodedUrl():string; + begin + if conn = NIL then + exit(''); + result:=decodeURL(conn.request.url); + end; + begin if assigned(data) and data.dontLog and (event <> HE_DISCONNECTED) then exit; // we exit expect for HE_DISCONNECTED because dontLog is always set AFTER connections, so HE_CONNECTED is always logged. The coupled HE_DISCONNECTED should be then logged too. if assigned(data) and (data.preReply = PR_BAN) and not logBannedChk.checked then exit; - if conn = NIL then url_:='' - else url_:=decodeURL(conn.request.url); if not (event in [HE_OPEN, HE_CLOSE, HE_CONNECTED, HE_DISCONNECTED, HE_GOT]) then if not logIconsChk.checked and (data.downloadingWhat = DW_ICON) or not logBrowsingChk.checked and (data.downloadingWhat = DW_FOLDERPAGE) - or not logProgressChk.checked and (url_ = '/~progress') then + or not logProgressChk.checked and (decodedUrl() = '/~progress') then exit; - if not (event in [HE_OPEN, HE_CLOSE]) and addressMatch(dontLogAddressMask, data.address) then exit; @@ -4693,7 +4697,7 @@ var s:=subStr(conn.getHeader('Range'), 7); if s > '' then s:=TAB+'['+s+']'; - add2log(format('Requested %s %s%s', [ METHOD2STR[conn.request.method], url_, s ]), data); + add2log(format('Requested %s %s%s', [ METHOD2STR[conn.request.method], decodedUrl(), s ]), data); end; if dumprequestsChk.checked then add2log('Request dump'+CRLF+conn.request.full, data); @@ -4730,7 +4734,7 @@ var add2log(format('Fully downloaded - %s @ %sB/s - %s', [ smartSize(conn.bytesSentLastItem), smartSize(calcAverageSpeed(conn.bytesSentLastItem)), - url_]), data); + decodedUrl()]), data); end; end;