Module: HTTPX::Plugins::Proxy::ConnectionMethods
- Defined in:
- lib/httpx/plugins/proxy.rb
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/httpx/plugins/proxy.rb', line 265 def call super return unless .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
259 260 261 262 263 |
# File 'lib/httpx/plugins/proxy.rb', line 259 def connecting? return super unless .proxy super || @state == :connecting || @state == :connected end |
#initialize ⇒ Object
246 247 248 249 250 251 252 253 |
# File 'lib/httpx/plugins/proxy.rb', line 246 def initialize(*) super return unless .proxy # redefining the connection origin as the proxy's URI, # as this will be used as the tcp peer ip. @proxy_uri = URI(.proxy.uri) end |
#peer ⇒ Object
255 256 257 |
# File 'lib/httpx/plugins/proxy.rb', line 255 def peer @proxy_uri || super end |
#reset ⇒ Object
284 285 286 287 288 289 290 291 |
# File 'lib/httpx/plugins/proxy.rb', line 284 def reset return super unless .proxy @state = :open super # emit(:close) end |