mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-06 00:02:08 -04:00
proxy: add inflight bookkeeping for http proxy; close the connection if receiving connect request error
This commit is contained in:
parent
1b97001b5f
commit
9a66db3ab4
@ -215,6 +215,8 @@ module HTTPX
|
||||
|
||||
case nextstate
|
||||
when :closing
|
||||
# this is a hack so that we can use the super method
|
||||
# and it'll thing that the current state is open
|
||||
@state = :open if @state == :connecting
|
||||
end
|
||||
super
|
||||
|
@ -51,7 +51,7 @@ module HTTPX
|
||||
#
|
||||
if req.uri.scheme == "https"
|
||||
connect_request = ConnectRequest.new(req.uri, @options)
|
||||
|
||||
@inflight += 1
|
||||
parser.send(connect_request)
|
||||
else
|
||||
transition(:connected)
|
||||
@ -59,6 +59,7 @@ module HTTPX
|
||||
end
|
||||
|
||||
def __http_on_connect(_, response)
|
||||
@inflight -= 1
|
||||
if response.status == 200
|
||||
req = @pending.first
|
||||
request_uri = req.uri
|
||||
@ -70,6 +71,7 @@ module HTTPX
|
||||
while (req = pending.shift)
|
||||
req.emit(:response, response)
|
||||
end
|
||||
reset
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user