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 383 def <<(str) super debug(str) end
close()
click to toggle source
Calls superclass method
# File lib/httpclient/session.rb, line 360 def close super debug("! CONNECTION CLOSED\n") end
debug_dev=(debug_dev)
click to toggle source
# File lib/httpclient/session.rb, line 356 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 365 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 371 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 377 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 390 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