Module: HTTPX::Plugins::Proxy::ConnectionMethods
- Defined in:
- lib/httpx/plugins/proxy.rb
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
# File 'lib/httpx/plugins/proxy.rb', line 270 def call super return unless @options.proxy case @state when :connecting consume end rescue *PROXY_ERRORS => e if connecting? error = ProxyConnectionError.new(e.) error.set_backtrace(e.backtrace) raise error end raise e end |
#connecting? ⇒ Boolean
264 265 266 267 268 |
# File 'lib/httpx/plugins/proxy.rb', line 264 def connecting? return super unless @options.proxy super || @state == :connecting || @state == :connected end |
#initialize ⇒ Object
251 252 253 254 255 256 257 258 |
# File 'lib/httpx/plugins/proxy.rb', line 251 def initialize(*) super return unless @options.proxy # redefining the connection origin as the proxy's URI, # as this will be used as the tcp peer ip. @proxy_uri = URI(@options.proxy.uri) end |
#peer ⇒ Object
260 261 262 |
# File 'lib/httpx/plugins/proxy.rb', line 260 def peer @proxy_uri || super end |
#reset ⇒ Object
289 290 291 292 293 294 295 296 |
# File 'lib/httpx/plugins/proxy.rb', line 289 def reset return super unless @options.proxy @state = :open super # emit(:close) end |