diff options
author | Steve Kemp <steve@steve.org.uk> | 2012-11-17 23:23:53 +0000 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2012-11-17 23:23:53 +0000 |
commit | c5c74fb557d825f9a8b67c51cfeeb5a48adfc6c0 (patch) | |
tree | 4ffba6ef1bdf1d281ade878e3ab7349d3c285e7c /lib/custodian/protocol-tests | |
parent | e74704126abddcb3efa38787f951c07ec5c9ede6 (diff) |
strip newlines from the banner we read.
Diffstat (limited to 'lib/custodian/protocol-tests')
-rwxr-xr-x | lib/custodian/protocol-tests/tcp.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/custodian/protocol-tests/tcp.rb b/lib/custodian/protocol-tests/tcp.rb index acf4737..08707a5 100755 --- a/lib/custodian/protocol-tests/tcp.rb +++ b/lib/custodian/protocol-tests/tcp.rb @@ -90,7 +90,10 @@ class TCPTest # read a banner from the remote server read = socket.gets(nil) + + # trim to a sane length & strip newlines. read = read[0,255] + read.gsub!(/[\n\r]/, "") unless ( read.nil? ) socket.close() @@ -116,7 +119,6 @@ class TCPTest @error = "TIMEOUT: #{e}" return false end - @error = "Misc failure" return false end @@ -134,7 +136,7 @@ end # -# Sample test, for testing. +# Sample test, for basic testing. # if __FILE__ == $0 then |