Public Class methods
new(origin, path, options)
[show source]
# File lib/httpx/io/unix.rb 11 def initialize(origin, path, options) 12 @addresses = [] 13 @hostname = origin.host 14 @state = :idle 15 @options = options 16 @fallback_protocol = @options.fallback_protocol 17 if (io = @options.io) 18 io = 19 case io 20 when Hash 21 io[origin.authority] 22 else 23 io 24 end 25 raise Error, "Given IO objects do not match the request authority" unless io 26 27 # @type var io: UNIXSocket 28 29 _, @path = io.addr 30 @io = io 31 @keep_open = true 32 @state = :connected 33 elsif path 34 @path = path 35 else 36 raise Error, "No path given where to store the socket" 37 end 38 @io ||= build_socket 39 end
Public Instance methods
addresses?()
the path is always explicitly passed, so no point in resolving.
[show source]
# File lib/httpx/io/unix.rb 59 def addresses? 60 true 61 end
connect()
[show source]
# File lib/httpx/io/unix.rb 41 def connect 42 return unless closed? 43 44 begin 45 if @io.closed? 46 transition(:idle) 47 @io = build_socket 48 end 49 @io.connect_nonblock(Socket.sockaddr_un(@path)) 50 rescue Errno::EISCONN 51 end 52 transition(:connected) 53 rescue Errno::EINPROGRESS, 54 Errno::EALREADY, 55 IO::WaitReadable 56 end
inspect()
:nocov:
[show source]
# File lib/httpx/io/unix.rb 64 def inspect 65 "#<#{self.class}:#{object_id} @path=#{@path}) @state=#{@state})>" 66 end