class HTTPX::UNIX

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

Methods

Public Class

  1. new

Public Instance

  1. connect
  2. hostname

Public Class methods

new (uri, addresses, options)
[show source]
   # File lib/httpx/io/unix.rb
11 def initialize(uri, addresses, options)
12   @uri = uri
13   @addresses = addresses
14   @state = :idle
15   @options = Options.new(options)
16   @path = @options.transport_options[:path]
17   @fallback_protocol = @options.fallback_protocol
18   if @options.io
19     @io = case @options.io
20           when Hash
21             @options.io[@path]
22           else
23             @options.io
24     end
25     unless @io.nil?
26       @keep_open = true
27       @state = :connected
28     end
29   end
30   @io ||= build_socket
31 end

Public Instance methods

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