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, addresses, 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, addresses, options) ⇒ UNIX
Returns a new instance of UNIX.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/httpx/io/unix.rb', line 11 def initialize(uri, addresses, ) @uri = uri @addresses = addresses @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
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/httpx/io/unix.rb', line 37 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
33 34 35 |
# File 'lib/httpx/io/unix.rb', line 33 def hostname @uri.host end |