Class: Docker::API::Session Private
- Inherits:
-
Net::HTTP
- Object
- Net::HTTP
- Docker::API::Session
- Defined in:
- lib/docker/api/session.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A Net::HTTP that connects through a Transport rather than by dialling a hostname itself.
Overriding #connect is the whole trick, and it is what makes a
dependency-free client practical: the stdlib keeps doing the tedious,
well-tested parts -- chunked transfer decoding, keep-alive, header
parsing, 100-continue -- while we retain ownership of the socket. That
ownership is what unix sockets, TLS and Windows named pipes all need, and
it is why none of them requires an HTTP library that knows about Docker.
Class Method Summary collapse
-
.new(transport, read_timeout: 60, open_timeout: 10) ⇒ Docker::API::Session
private
Net::HTTP.new is not a plain allocator: it resolves proxy settings and then re-dispatches to Class#new with its own positional arguments, which do not match ours.
Instance Method Summary collapse
-
#initialize(transport, read_timeout: 60, open_timeout: 10) ⇒ Session
constructor
private
A new instance of Session.
Constructor Details
#initialize(transport, read_timeout: 60, open_timeout: 10) ⇒ Session
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Session.
42 43 44 45 46 47 |
# File 'lib/docker/api/session.rb', line 42 def initialize(transport, read_timeout: 60, open_timeout: 10) super(transport.host_header, 80) @transport = transport self.read_timeout = read_timeout self.open_timeout = open_timeout end |
Class Method Details
.new(transport, read_timeout: 60, open_timeout: 10) ⇒ Docker::API::Session
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Net::HTTP.new is not a plain allocator: it resolves proxy settings and then re-dispatches to Class#new with its own positional arguments, which do not match ours. A session connects through a transport and never proxies, so that work is not merely unnecessary, it actively gets in the way.
31 32 33 34 35 36 |
# File 'lib/docker/api/session.rb', line 31 def new(transport, read_timeout: 60, open_timeout: 10) allocate.tap do |session| session.send(:initialize, transport, read_timeout: read_timeout, open_timeout: open_timeout) end end |