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 | 8d4f8df269045f61f3922dfb827a729b727f5307 (patch) | |
tree | 4ffba6ef1bdf1d281ade878e3ab7349d3c285e7c | |
parent | e512dcab32f2cad1c4c369270ac7cc7749614e80 (diff) |
strip newlines from the banner we read.
-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 |