module HTTPX::Plugins::Proxy::ConnectionMethods

  1. lib/httpx/plugins/proxy.rb

Methods

Public Class

  1. new

Public Instance

  1. call
  2. connecting?
  3. peer
  4. reset

Public Class methods

new(*)
[show source]
    # File lib/httpx/plugins/proxy.rb
254 def initialize(*)
255   super
256   return unless @options.proxy
257 
258   # redefining the connection origin as the proxy's URI,
259   # as this will be used as the tcp peer ip.
260   @proxy_uri = @options.proxy.uri
261 end

Public Instance methods

call()
[show source]
    # File lib/httpx/plugins/proxy.rb
273 def call
274   super
275 
276   return unless @options.proxy
277 
278   case @state
279   when :connecting
280     consume
281   end
282 rescue *PROXY_ERRORS => e
283   if connecting?
284     error = ProxyConnectionError.new(e.message)
285     error.set_backtrace(e.backtrace)
286     raise error
287   end
288 
289   raise e
290 end
connecting?()
[show source]
    # File lib/httpx/plugins/proxy.rb
267 def connecting?
268   return super unless @options.proxy
269 
270   super || @state == :connecting || @state == :connected
271 end
peer()
[show source]
    # File lib/httpx/plugins/proxy.rb
263 def peer
264   @proxy_uri || super
265 end
reset()
[show source]
    # File lib/httpx/plugins/proxy.rb
292 def reset
293   return super unless @options.proxy
294 
295   @state = :open
296 
297   super
298   # emit(:close)
299 end