Class: HTTP::Timeout::Null
- Inherits:
-
Object
- Object
- HTTP::Timeout::Null
- Extended by:
- Forwardable
- Defined in:
- lib/http/timeout/null.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#socket ⇒ Object
readonly
Returns the value of attribute socket.
Instance Method Summary collapse
-
#connect(socket_class, host, port, nodelay = false) ⇒ Object
Connects to a socket.
-
#connect_ssl ⇒ Object
Starts a SSL connection on a socket.
-
#initialize(options = {}) ⇒ Null
constructor
A new instance of Null.
-
#readpartial(size) ⇒ Object
Read from the socket.
-
#start_tls(host, ssl_socket_class, ssl_context) ⇒ Object
Configures the SSL connection and starts the connection.
-
#write(data) ⇒ Object
(also: #<<)
Write to the socket.
Constructor Details
#initialize(options = {}) ⇒ Null
Returns a new instance of Null.
13 14 15 |
# File 'lib/http/timeout/null.rb', line 13 def initialize( = {}) @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
11 12 13 |
# File 'lib/http/timeout/null.rb', line 11 def @options end |
#socket ⇒ Object (readonly)
Returns the value of attribute socket.
11 12 13 |
# File 'lib/http/timeout/null.rb', line 11 def socket @socket end |
Instance Method Details
#connect(socket_class, host, port, nodelay = false) ⇒ Object
Connects to a socket
18 19 20 21 |
# File 'lib/http/timeout/null.rb', line 18 def connect(socket_class, host, port, nodelay = false) @socket = socket_class.open(host, port) @socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1) if nodelay end |
#connect_ssl ⇒ Object
Starts a SSL connection on a socket
24 25 26 |
# File 'lib/http/timeout/null.rb', line 24 def connect_ssl @socket.connect end |
#readpartial(size) ⇒ Object
Read from the socket
42 43 44 45 46 |
# File 'lib/http/timeout/null.rb', line 42 def readpartial(size) @socket.readpartial(size) rescue EOFError :eof end |
#start_tls(host, ssl_socket_class, ssl_context) ⇒ Object
Configures the SSL connection and starts the connection
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/http/timeout/null.rb', line 29 def start_tls(host, ssl_socket_class, ssl_context) @socket = ssl_socket_class.new(socket, ssl_context) @socket.hostname = host if @socket.respond_to? :hostname= @socket.sync_close = true if @socket.respond_to? :sync_close= connect_ssl return unless ssl_context.verify_mode == OpenSSL::SSL::VERIFY_PEER @socket.post_connection_check(host) end |
#write(data) ⇒ Object Also known as: <<
Write to the socket
49 50 51 |
# File 'lib/http/timeout/null.rb', line 49 def write(data) @socket.write(data) end |