Module: HTTP::Session::Client::Perform
- Included in:
- HTTP::Session::Client
- Defined in:
- lib/http/session/client/perform.rb
Overview
Make an HTTP request without any HTTP::Features.
Mostly borrowed from http/lib/http/client.rb
Constant Summary collapse
- HTTP_OR_HTTPS_RE =
%r{^https?://}i
Instance Attribute Summary collapse
-
#default_options ⇒ Object
readonly
Returns the value of attribute default_options.
Instance Method Summary collapse
Instance Attribute Details
#default_options ⇒ Object (readonly)
Returns the value of attribute default_options.
9 10 11 |
# File 'lib/http/session/client/perform.rb', line 9 def @default_options end |
Instance Method Details
#close ⇒ Object
43 44 45 46 47 |
# File 'lib/http/session/client/perform.rb', line 43 def close @connection&.close @connection = nil @state = :clean end |
#httprb_initialize(default_options) ⇒ Object
11 12 13 14 15 |
# File 'lib/http/session/client/perform.rb', line 11 def httprb_initialize() @default_options = HTTP::Options.new() @connection = nil @state = :clean end |
#httprb_perform(req, options) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/http/session/client/perform.rb', line 17 def httprb_perform(req, ) verify_connection!(req.uri) @state = :dirty begin @connection ||= HTTP::Connection.new(req, ) unless @connection.failed_proxy_connect? @connection.send_request(req) @connection.read_headers! end rescue HTTP::Error => e .features.each_value do |feature| feature.on_error(req, e) end raise end res = build_response(req, ) @connection.finish_response if req.verb == :head @state = :clean res rescue close raise end |