Few ip formatting fixes

This commit is contained in:
Ujjwal Verma 2017-06-25 04:09:45 +05:30
parent c5858463ca
commit 3bccc2b8c6

View File

@ -174,7 +174,7 @@ class Dumper:
# This aligns the HTTP response code with the HTTP request method: # This aligns the HTTP response code with the HTTP request method:
# 127.0.0.1:59519: GET http://example.com/ # 127.0.0.1:59519: GET http://example.com/
# << 304 Not Modified 0b # << 304 Not Modified 0b
arrows = " " * (len(repr(flow.client_conn.address)) - 2) + arrows arrows = " " * (len(human.format_address(flow.client_conn.address)) - 2) + arrows
line = "{replay}{arrows} {code} {reason} {size}".format( line = "{replay}{arrows} {code} {reason} {size}".format(
replay=replay, replay=replay,
@ -224,7 +224,7 @@ class Dumper:
def websocket_error(self, f): def websocket_error(self, f):
self.echo( self.echo(
"Error in WebSocket connection to {}: {}".format( "Error in WebSocket connection to {}: {}".format(
repr(f.server_conn.address), f.error human.format_address(f.server_conn.address), f.error
), ),
fg="red" fg="red"
) )
@ -247,7 +247,7 @@ class Dumper:
def tcp_error(self, f): def tcp_error(self, f):
self.echo( self.echo(
"Error in TCP connection to {}: {}".format( "Error in TCP connection to {}: {}".format(
repr(f.server_conn.address), f.error human.format_address(f.server_conn.address), f.error
), ),
fg="red" fg="red"
) )
@ -257,8 +257,8 @@ class Dumper:
message = f.messages[-1] message = f.messages[-1]
direction = "->" if message.from_client else "<-" direction = "->" if message.from_client else "<-"
self.echo("{client} {direction} tcp {direction} {server}".format( self.echo("{client} {direction} tcp {direction} {server}".format(
client=repr(f.client_conn.address), client=human.format_address(f.client_conn.address),
server=repr(f.server_conn.address), server=human.format_address(f.server_conn.address),
direction=direction, direction=direction,
)) ))
if ctx.options.flow_detail >= 3: if ctx.options.flow_detail >= 3: