Class: HTTPX::UNIX
- Extended by:
- Forwardable
- Defined in:
- lib/httpx/io/unix.rb
Constant Summary
Constants included from Loggable
Instance Attribute Summary
Attributes inherited from TCP
Instance Method Summary collapse
- #connect ⇒ Object
- #hostname ⇒ Object
-
#initialize(uri, options) ⇒ UNIX
constructor
A new instance of UNIX.
Methods inherited from TCP
#close, #closed?, #connected?, #inspect, #protocol, #read, #scheme, #to_io, #write
Methods included from Loggable
Constructor Details
#initialize(uri, options) ⇒ UNIX
Returns a new instance of UNIX.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/httpx/io/unix.rb', line 9 def initialize(uri, ) @uri = uri @state = :idle @options = Options.new() @path = @options.[:path] @fallback_protocol = @options.fallback_protocol if @options.io @io = case @options.io when Hash @options.io[@path] else @options.io end unless @io.nil? @keep_open = true @state = :connected end end @io ||= build_socket end |
Instance Method Details
#connect ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/httpx/io/unix.rb', line 34 def connect return unless closed? begin if @io.closed? transition(:idle) @io = build_socket end @io.connect_nonblock(Socket.sockaddr_un(@path)) rescue Errno::EISCONN end transition(:connected) rescue Errno::EINPROGRESS, Errno::EALREADY, ::IO::WaitReadable end |
#hostname ⇒ Object
30 31 32 |
# File 'lib/httpx/io/unix.rb', line 30 def hostname @uri.host end |