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

Public Instance methods

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