lib/httpx/plugins/proxy/socks4.rb in httpx-0.0.2 vs lib/httpx/plugins/proxy/socks4.rb in httpx-0.0.3

- old
+ new

@@ -25,14 +25,14 @@ _version, status, _port, _ip = packet.unpack("CCnN") if status == GRANTED req, _ = @pending.first request_uri = req.uri @io = ProxySSL.new(@io, request_uri, @options) if request_uri.scheme == "https" - transition(:open) + transition(:connected) throw(:called) else - response = ErrorResponse.new("socks error: #{status}", 0) + response = ErrorResponse.new(Error.new("socks error: #{status}"), 0, @options) until @pending.empty? req, _ = @pending.shift emit(:response, req, response) end end @@ -41,16 +41,16 @@ def transition(nextstate) case nextstate when :connecting return unless @state == :idle @io.connect - return if @io.closed? + return unless @io.connected? req, _ = @pending.first return unless req request_uri = req.uri @write_buffer << Packet.connect(@parameters, request_uri) proxy_connect - when :open + when :connected return unless @state == :connecting @parser = nil end log(1, "SOCKS4: ") { "#{nextstate}: #{@write_buffer.to_s.inspect}" } super