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

Public Instance methods

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