Class: HTTPX::UNIX
- Inherits:
-
TCP
show all
- Extended by:
- Forwardable
- Defined in:
- lib/httpx/io/unix.rb
Constant Summary
Constants included
from Loggable
Loggable::COLORS
Instance Attribute Summary
Attributes inherited from TCP
#addresses, #ip, #port
Instance Method Summary
collapse
Methods inherited from TCP
#close, #closed?, #connected?, #inspect, #protocol, #read, #scheme, #to_io, #write
Methods included from Loggable
#log, #log_exception
Constructor Details
#initialize(uri, addresses, options) ⇒ 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, options)
@uri = uri
@addresses = addresses
@state = :idle
@options = Options.new(options)
@path = @options.transport_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
|