Bug - HTTP Client can call :shutdown on closed IO
When running Rex HTTP client calls across pivots, pivot sockets can get closed by the remote server, resulting in a closed :conn object within the client object. The clients :close method calls self.conn.shutdown which raises an 'IOError closed stream' on what is effectively a TCPSocket object in a closed state (under the Rex abstraction). Resolve by moving the self.conn.closed? check into the conditional just above the :shutdown call, and remove if from the underlying :close call as calling :close on an already closed TCPSocket returns nil as opposed to throwing an exception like the :shutdown method.bug/bundler_fix
parent
faa84faf25
commit
8d60fdf9e7
|
@ -191,9 +191,9 @@ class Client
|
|||
# Closes the connection to the remote server.
|
||||
#
|
||||
def close
|
||||
if (self.conn)
|
||||
if (self.conn and !self.conn.closed?)
|
||||
self.conn.shutdown
|
||||
self.conn.close unless self.conn.closed?
|
||||
self.conn.close
|
||||
end
|
||||
|
||||
self.conn = nil
|
||||
|
|
Loading…
Reference in New Issue