summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKris Hicks <krishicks@gmail.com>2013-07-08 11:12:25 -0400
committerKris Hicks <krishicks@gmail.com>2013-07-08 11:12:25 -0400
commit899f1cf75ab8055f33b5dcbf71e940b0c94ac9a4 (patch)
treec378db15a2c541950a818d80c19a9450774b546d
parent8bdef39d5b572b7a630ed007b8d6fe0da946a395 (diff)
downloadnet-ssh-899f1cf75ab8055f33b5dcbf71e940b0c94ac9a4.tar.gz
Guard against socket.gets being nil
In the situation where the socket has only one line to respond with, any following gets to the socket need to take care to not assume there is a non-nil response.
-rw-r--r--lib/net/ssh/proxy/http.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/net/ssh/proxy/http.rb b/lib/net/ssh/proxy/http.rb
index 4f86dcf..0d183be 100644
--- a/lib/net/ssh/proxy/http.rb
+++ b/lib/net/ssh/proxy/http.rb
@@ -73,7 +73,7 @@ module Net; module SSH; module Proxy
version, code, reason = socket.gets.chomp.split(/ /, 3)
headers = {}
- while (line = socket.gets.chomp) != ""
+ while (line = socket.gets) && (line.chomp! != "")
name, value = line.split(/:/, 2)
headers[name.strip] = value.strip
end