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) ⇒ 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.
12 13 14 |
# File 'lib/http/timeout/null.rb', line 12 def initialize( = {}) @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/http/timeout/null.rb', line 10 def @options end |
#socket ⇒ Object (readonly)
Returns the value of attribute socket.
10 11 12 |
# File 'lib/http/timeout/null.rb', line 10 def socket @socket end |
Instance Method Details
#connect(socket_class, host, port) ⇒ Object
Connects to a socket
17 18 19 |
# File 'lib/http/timeout/null.rb', line 17 def connect(socket_class, host, port) @socket = socket_class.open(host, port) end |
#connect_ssl ⇒ Object
Starts a SSL connection on a socket
22 23 24 |
# File 'lib/http/timeout/null.rb', line 22 def connect_ssl @socket.connect end |
#readpartial(size) ⇒ Object
Read from the socket
40 41 42 |
# File 'lib/http/timeout/null.rb', line 40 def readpartial(size) @socket.readpartial(size) end |
#start_tls(host, ssl_socket_class, ssl_context) ⇒ Object
Configures the SSL connection and starts the connection
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/http/timeout/null.rb', line 27 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
45 46 47 |
# File 'lib/http/timeout/null.rb', line 45 def write(data) @socket << data end |