Skip to content

Commit ba75d19

Browse files
committed
Fix failing spec.
1 parent 2a6b367 commit ba75d19

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

lib/rex/proto/http/client.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -634,11 +634,13 @@ def pipelining?
634634
#
635635
def peerinfo
636636
if self.conn
637-
pi = self.conn.peerinfo
638-
return {
639-
'addr' => pi.split(':')[0],
640-
'port' => pi.split(':')[1].to_i
641-
}
637+
pi = self.conn.peerinfo || nil
638+
if pi
639+
return {
640+
'addr' => pi.split(':')[0],
641+
'port' => pi.split(':')[1].to_i
642+
}
643+
end
642644
end
643645
nil
644646
end

spec/lib/rex/proto/http/client_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ def excuse_needs_auth
119119
it "should send creds after receiving a 401" do
120120
conn = double
121121
allow(conn).to receive(:put)
122+
allow(conn).to receive(:peerinfo)
122123
allow(conn).to receive(:shutdown)
123124
allow(conn).to receive(:close)
124125
allow(conn).to receive(:closed?).and_return(false)

0 commit comments

Comments
 (0)