mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-08-10 00:01:27 -04:00
fixing overwriting connection #transition, which wasn't taking tcp connect on proxy errors
This commit is contained in:
parent
f3d50e6a06
commit
1343c74e31
@ -489,6 +489,18 @@ module HTTPX
|
||||
end
|
||||
|
||||
def transition(nextstate)
|
||||
handle_transition(nextstate)
|
||||
rescue Errno::ECONNREFUSED,
|
||||
Errno::EADDRNOTAVAIL,
|
||||
Errno::EHOSTUNREACH,
|
||||
TLSError => e
|
||||
# connect errors, exit gracefully
|
||||
handle_error(e)
|
||||
@state = :closed
|
||||
emit(:close)
|
||||
end
|
||||
|
||||
def handle_transition(nextstate)
|
||||
case nextstate
|
||||
when :idle
|
||||
@timeout = @current_timeout = @options.timeout[:connect_timeout]
|
||||
@ -525,14 +537,6 @@ module HTTPX
|
||||
emit(:activate)
|
||||
end
|
||||
@state = nextstate
|
||||
rescue Errno::ECONNREFUSED,
|
||||
Errno::EADDRNOTAVAIL,
|
||||
Errno::EHOSTUNREACH,
|
||||
TLSError => e
|
||||
# connect errors, exit gracefully
|
||||
handle_error(e)
|
||||
@state = :closed
|
||||
emit(:close)
|
||||
end
|
||||
|
||||
def purge_after_closed
|
||||
|
@ -57,7 +57,9 @@ module HTTPX
|
||||
@io = build_socket
|
||||
end
|
||||
try_connect
|
||||
rescue Errno::EHOSTUNREACH => e
|
||||
rescue Errno::ECONNREFUSED,
|
||||
Errno::EADDRNOTAVAIL,
|
||||
Errno::EHOSTUNREACH => e
|
||||
raise e if @ip_index <= 0
|
||||
|
||||
@ip_index -= 1
|
||||
|
@ -81,7 +81,7 @@ module HTTPX
|
||||
super
|
||||
end
|
||||
|
||||
def transition(nextstate)
|
||||
def handle_transition(nextstate)
|
||||
state = @state
|
||||
super
|
||||
meter_elapsed_time("Connection##{object_id}[#{@origin}]: #{state} -> #{nextstate}") if nextstate == @state
|
||||
|
@ -234,7 +234,7 @@ module HTTPX
|
||||
end
|
||||
end
|
||||
|
||||
def transition(nextstate)
|
||||
def handle_transition(nextstate)
|
||||
return super unless @options.proxy
|
||||
|
||||
case nextstate
|
||||
|
@ -13,7 +13,7 @@ module HTTPX
|
||||
|
||||
private
|
||||
|
||||
def transition(nextstate)
|
||||
def handle_transition(nextstate)
|
||||
return super unless @options.proxy && @options.proxy.uri.scheme == "http"
|
||||
|
||||
case nextstate
|
||||
@ -54,7 +54,7 @@ module HTTPX
|
||||
@inflight += 1
|
||||
parser.send(connect_request)
|
||||
else
|
||||
transition(:connected)
|
||||
handle_transition(:connected)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -27,7 +27,7 @@ module HTTPX
|
||||
|
||||
private
|
||||
|
||||
def transition(nextstate)
|
||||
def handle_transition(nextstate)
|
||||
return super unless @options.proxy && PROTOCOLS.include?(@options.proxy.uri.scheme)
|
||||
|
||||
case nextstate
|
||||
|
@ -46,7 +46,7 @@ module HTTPX
|
||||
|
||||
private
|
||||
|
||||
def transition(nextstate)
|
||||
def handle_transition(nextstate)
|
||||
return super unless @options.proxy && @options.proxy.uri.scheme == "socks5"
|
||||
|
||||
case nextstate
|
||||
|
Loading…
x
Reference in New Issue
Block a user