class HTTPX::UNIX

  1. lib/httpx/io/unix.rb
Superclass: TCP

Methods

Public Class

  1. new

Public Instance

  1. connect
  2. expired?
  3. inspect
  4. path

Attributes

host [R]
path [R]

Public Class methods

new(origin, addresses, options)
[show source]
   # File lib/httpx/io/unix.rb
11 def initialize(origin, addresses, options)
12   @addresses = []
13   @hostname = origin.host
14   @state = :idle
15   @options = Options.new(options)
16   @fallback_protocol = @options.fallback_protocol
17   if @options.io
18     @io = case @options.io
19           when Hash
20             @options.io[origin.authority]
21           else
22             @options.io
23     end
24     raise Error, "Given IO objects do not match the request authority" unless @io
25 
26     @path = @io.path
27     @keep_open = true
28     @state = :connected
29   else
30     @path = addresses.first
31   end
32   @io ||= build_socket
33 end

Public Instance methods

connect()
[show source]
   # File lib/httpx/io/unix.rb
35 def connect
36   return unless closed?
37 
38   begin
39     if @io.closed?
40       transition(:idle)
41       @io = build_socket
42     end
43     @io.connect_nonblock(Socket.sockaddr_un(@path))
44   rescue Errno::EISCONN
45   end
46   transition(:connected)
47 rescue Errno::EINPROGRESS,
48        Errno::EALREADY,
49        ::IO::WaitReadable
50 end
expired?()
[show source]
   # File lib/httpx/io/unix.rb
52 def expired?
53   false
54 end
inspect()

:nocov:

[show source]
   # File lib/httpx/io/unix.rb
57 def inspect
58   "#<#{self.class}(path: #{@path}): (state: #{@state})>"
59 end