Module: HTTPX::Plugins::Proxy::ConnectionMethods

Defined in:
lib/httpx/plugins/proxy.rb

Instance Method Summary collapse

Instance Method Details

#callObject



245
246
247
248
249
250
251
252
253
254
# File 'lib/httpx/plugins/proxy.rb', line 245

def call
  super

  return unless @options.proxy

  case @state
  when :connecting
    consume
  end
end

#connecting?Boolean

Returns:

  • (Boolean)


239
240
241
242
243
# File 'lib/httpx/plugins/proxy.rb', line 239

def connecting?
  return super unless @options.proxy

  super || @state == :connecting || @state == :connected
end

#initializeObject



226
227
228
229
230
231
232
233
# File 'lib/httpx/plugins/proxy.rb', line 226

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

#peerObject



235
236
237
# File 'lib/httpx/plugins/proxy.rb', line 235

def peer
  @proxy_uri || super
end

#resetObject



256
257
258
259
260
261
262
263
# File 'lib/httpx/plugins/proxy.rb', line 256

def reset
  return super unless @options.proxy

  @state = :open

  super
  # emit(:close)
end