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
243 def initialize(*)
244   super
245   return unless @options.proxy
246 
247   # redefining the connection origin as the proxy's URI,
248   # as this will be used as the tcp peer ip.
249   @proxy_uri = URI(@options.proxy.uri)
250 end

Public Instance methods

call()
[show source]
    # File lib/httpx/plugins/proxy.rb
262 def call
263   super
264 
265   return unless @options.proxy
266 
267   case @state
268   when :connecting
269     consume
270   end
271 rescue *PROXY_ERRORS => e
272   if connecting?
273     error = ProxyConnectionError.new(e.message)
274     error.set_backtrace(e.backtrace)
275     raise error
276   end
277 
278   raise e
279 end
connecting?()
[show source]
    # File lib/httpx/plugins/proxy.rb
256 def connecting?
257   return super unless @options.proxy
258 
259   super || @state == :connecting || @state == :connected
260 end
peer()
[show source]
    # File lib/httpx/plugins/proxy.rb
252 def peer
253   @proxy_uri || super
254 end
reset()
[show source]
    # File lib/httpx/plugins/proxy.rb
281 def reset
282   return super unless @options.proxy
283 
284   @state = :open
285 
286   super
287   # emit(:close)
288 end