fix: display ipv6 address with brackets in log

This commit is contained in:
Massimo Melina 2020-06-06 19:59:10 +02:00
parent 74a5710f99
commit bdc5991fa1
2 changed files with 9 additions and 4 deletions

View File

@ -156,6 +156,7 @@ type
P_requestCount: integer; P_requestCount: integer;
P_destroying: boolean; // destroying is in progress P_destroying: boolean; // destroying is in progress
P_sndBuf: integer; P_sndBuf: integer;
P_v6: boolean;
persistent: boolean; persistent: boolean;
disconnecting: boolean; // disconnected() has been called disconnecting: boolean; // disconnected() has been called
lockCount: integer; // prevent freeing of the object lockCount: integer; // prevent freeing of the object
@ -219,6 +220,7 @@ type
function initInputStream():boolean; function initInputStream():boolean;
property address:string read P_address; // other peer ip address property address:string read P_address; // other peer ip address
property port:string read P_port; // other peer port property port:string read P_port; // other peer port
property v6:boolean read P_v6;
property requestCount:integer read P_requestCount; property requestCount:integer read P_requestCount;
property bytesToSend:int64 read getBytesToSend; property bytesToSend:int64 read getBytesToSend;
property bytesToPost:int64 read getBytesToPost; property bytesToPost:int64 read getBytesToPost;
@ -978,6 +980,7 @@ limiters:=TObjectList.create;
limiters.ownsObjects:=FALSE; limiters.ownsObjects:=FALSE;
P_address:=sock.GetPeerAddr(); P_address:=sock.GetPeerAddr();
P_port:=sock.GetPeerPort(); P_port:=sock.GetPeerPort();
P_v6:=pos(':', address) > 0;
state:=HCS_IDLE; state:=HCS_IDLE;
srv:=server; srv:=server;
srv.conns.add(self); srv.conns.add(self);

View File

@ -4179,11 +4179,13 @@ if lines = '' then
else else
rest:=reReplace(lines, '^', '> ')+CRLF; rest:=reReplace(lines, '^', '> ')+CRLF;
addr:='';
if assigned(cd) and assigned(cd.conn) then if assigned(cd) and assigned(cd.conn) then
addr:=nonEmptyConcat('', cd.user, '@') addr:=nonEmptyConcat('', cd.user, '@')
+cd.address+':'+cd.conn.port +ifThen(cd.conn.v6, '['+cd.address+']', cd.address)
+nonEmptyConcat(' {', localDNSget(cd.address), '}'); +':'+cd.conn.port
+nonEmptyConcat(' {', localDNSget(cd.address), '}')
else
addr:='';
if (logFile.filename > '') and (logFile.apacheFormat = '') then if (logFile.filename > '') and (logFile.apacheFormat = '') then
begin begin
@ -11371,7 +11373,7 @@ pt:=logbox.caretpos;
if pt.y >= logbox.lines.count then if pt.y >= logbox.lines.count then
exit; exit;
s:=logbox.lines[pt.y]; s:=logbox.lines[pt.y];
s:=reGet(s, '^.+ (\S+@)?(\S+):\d+ ', 2); s:=reGet(s, '^.+ (\S+@)?\[?(\S+?)\]?:\d+ ', 2);
if checkAddressSyntax(s,FALSE) then if checkAddressSyntax(s,FALSE) then
result:=s; result:=s;
end; // ipPointedInLog end; // ipPointedInLog