Module: HTTPX::Plugins::Proxy::ConnectionMethods
- Defined in:
- lib/httpx/plugins/proxy.rb
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
# File 'lib/httpx/plugins/proxy.rb', line 262 def call super return unless @options.proxy case @state when :connecting consume end rescue *PROXY_ERRORS => e if connecting? error = ProxyConnectionError.new(e.) error.set_backtrace(e.backtrace) raise error end raise e end |
#connecting? ⇒ Boolean
256 257 258 259 260 |
# File 'lib/httpx/plugins/proxy.rb', line 256 def connecting? return super unless @options.proxy super || @state == :connecting || @state == :connected end |
#initialize ⇒ Object
243 244 245 246 247 248 249 250 |
# File 'lib/httpx/plugins/proxy.rb', line 243 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 |
#peer ⇒ Object
252 253 254 |
# File 'lib/httpx/plugins/proxy.rb', line 252 def peer @proxy_uri || super end |
#reset ⇒ Object
281 282 283 284 285 286 287 288 |
# File 'lib/httpx/plugins/proxy.rb', line 281 def reset return super unless @options.proxy @state = :open super # emit(:close) end |