module HTTPClient::DebugSocket
Module for intercepting Socket methods and dumps in/out to given debugging device. debug_dev must respond to <<.
Public Instance Methods
<<(str)
click to toggle source
Calls superclass method
# File lib/httpclient/session.rb, line 392 def <<(str) super debug(str) end
close()
click to toggle source
Calls superclass method
# File lib/httpclient/session.rb, line 369 def close super debug("! CONNECTION CLOSED\n") end
debug_dev=(debug_dev)
click to toggle source
# File lib/httpclient/session.rb, line 365 def debug_dev=(debug_dev) @debug_dev = debug_dev end
gets(rs)
click to toggle source
Calls superclass method
# File lib/httpclient/session.rb, line 374 def gets(rs) str = super debug(str) str end
read(size, buf = nil)
click to toggle source
Calls superclass method
# File lib/httpclient/session.rb, line 380 def read(size, buf = nil) str = super debug(str) str end
readpartial(size, buf = nil)
click to toggle source
Calls superclass method
# File lib/httpclient/session.rb, line 386 def readpartial(size, buf = nil) str = super debug(str) str end
Private Instance Methods
debug(str)
click to toggle source
# File lib/httpclient/session.rb, line 399 def debug(str) if str && @debug_dev if str.index("\0") require 'hexdump' str.force_encoding('BINARY') if str.respond_to?(:force_encoding) @debug_dev << HexDump.encode(str).join("\n") else @debug_dev << str end end end