Module: HTTPX::Plugins::Proxy::HTTP::ConnectionMethods
- Defined in:
- lib/httpx/plugins/proxy/http.rb,
sig/plugins/proxy/http.rbs
Instance Method Summary collapse
- #__http_on_connect(request, response) ⇒ void
- #__http_proxy_connect(parser) ⇒ void
- #force_close ⇒ Object
Instance Method Details
#__http_on_connect(request, response) ⇒ void
This method returns an undefined value.
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/httpx/plugins/proxy/http.rb', line 152 def __http_on_connect(request, response) @inflight -= 1 if response.is_a?(Response) && response.status == 200 req = @pending.first request_uri = req.uri @io = ProxySSL.new(@io, request_uri, @options) transition(:connected) throw(:called) elsif response.is_a?(Response) && response.status == 407 && !request.headers.key?("proxy-authorization") && @options.proxy.can_authenticate?(response.headers["proxy-authenticate"]) request.transition(:idle) request.headers["proxy-authorization"] = @options.proxy.authenticate(request, response.headers["proxy-authenticate"]) @parser.send(request) @inflight += 1 else pending = @pending + @parser.pending while (req = pending.shift) response.finish! req.response = response req.emit_response(response) end reset end end |
#__http_proxy_connect(parser) ⇒ void
This method returns an undefined value.
137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/httpx/plugins/proxy/http.rb', line 137 def __http_proxy_connect(parser) req = @pending.first if req && req.uri.scheme == "https" # if the first request after CONNECT is to an https address, it is assumed that # all requests in the queue are not only ALL HTTPS, but they also share the certificate, # and therefore, will share the connection. # connect_request = ConnectRequest.new(req.uri, @options) @inflight += 1 parser.send(connect_request) else handle_transition(:connected) end end |
#force_close ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/httpx/plugins/proxy/http.rb', line 49 def force_close(*) if @state == :connecting # proxy connect related requests should not be reenqueed @parser.reset @inflight -= @parser.pending.size @parser.pending.clear end super end |