mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-08-10 00:01:27 -04:00
fixed all usages of @pending
This commit is contained in:
parent
adf479221c
commit
8a296674aa
@ -254,8 +254,7 @@ module HTTPX
|
||||
end
|
||||
|
||||
def send_pending
|
||||
while !@write_buffer.full? && (req_args = @pending.shift)
|
||||
request = req_args
|
||||
while !@write_buffer.full? && (request = @pending.shift)
|
||||
parser.send(request)
|
||||
end
|
||||
end
|
||||
|
@ -41,7 +41,7 @@ module HTTPX
|
||||
end
|
||||
|
||||
def __http_proxy_connect
|
||||
req, _ = @pending.first
|
||||
req = @pending.first
|
||||
# if the first request after CONNECT is to an https address, it is assumed that
|
||||
# all requests in the queue are not only ALL HTTPS, but they also share the certificate,
|
||||
# and therefore, will share the connection.
|
||||
@ -55,15 +55,15 @@ module HTTPX
|
||||
end
|
||||
end
|
||||
|
||||
def __http_on_connect(_request, response)
|
||||
def __http_on_connect(_, response)
|
||||
if response.status == 200
|
||||
req, _ = @pending.first
|
||||
req = @pending.first
|
||||
request_uri = req.uri
|
||||
@io = ProxySSL.new(@io, request_uri, @options)
|
||||
transition(:connected)
|
||||
throw(:called)
|
||||
else
|
||||
pending = @pending.map(&:first) + @parser.pending
|
||||
pending = @pending + @parser.pending
|
||||
while (req = pending.shift)
|
||||
emit(:response, req, response)
|
||||
end
|
||||
@ -104,7 +104,7 @@ module HTTPX
|
||||
end
|
||||
|
||||
class ConnectRequest < Request
|
||||
def initialize(uri, options)
|
||||
def initialize(uri, _options)
|
||||
super(:connect, uri, {})
|
||||
@headers.delete("accept")
|
||||
end
|
||||
|
@ -28,7 +28,7 @@ module HTTPX
|
||||
@io.connect
|
||||
return unless @io.connected?
|
||||
|
||||
req, _ = @pending.first
|
||||
req = @pending.first
|
||||
return unless req
|
||||
|
||||
request_uri = req.uri
|
||||
@ -51,7 +51,7 @@ module HTTPX
|
||||
def __socks4_on_packet(packet)
|
||||
_version, status, _port, _ip = packet.unpack("CCnN")
|
||||
if status == GRANTED
|
||||
req, _ = @pending.first
|
||||
req = @pending.first
|
||||
request_uri = req.uri
|
||||
@io = ProxySSL.new(@io, request_uri, @options) if request_uri.scheme == "https"
|
||||
transition(:connected)
|
||||
|
@ -52,7 +52,7 @@ module HTTPX
|
||||
when :negotiating
|
||||
return unless @state == :connecting || @state == :authenticating
|
||||
|
||||
req, _ = @pending.first
|
||||
req = @pending.first
|
||||
request_uri = req.uri
|
||||
@write_buffer << Packet.connect(request_uri)
|
||||
when :connected
|
||||
@ -93,7 +93,7 @@ module HTTPX
|
||||
version, reply, = packet.unpack("CC")
|
||||
__socks5_check_version(version)
|
||||
__on_socks5_error("socks5 negotiation error: #{reply}") unless reply == SUCCESS
|
||||
req, _ = @pending.first
|
||||
req = @pending.first
|
||||
request_uri = req.uri
|
||||
@io = ProxySSL.new(@io, request_uri, @options) if request_uri.scheme == "https"
|
||||
transition(:connected)
|
||||
|
Loading…
x
Reference in New Issue
Block a user