lib/httpx/channel/http1.rb in httpx-0.0.4 vs lib/httpx/channel/http1.rb in httpx-0.0.5

- old
+ new

@@ -10,11 +10,10 @@ CRLF = "\r\n" def initialize(buffer, options) @options = Options.new(options) @max_concurrent_requests = @options.max_concurrent_requests - @retries = options.max_retries @parser = HTTP::Parser.new(self) @parser.header_value_type = :arrays @buffer = buffer @version = [1, 1] @pending = [] @@ -139,14 +138,20 @@ if @parser.upgrade? response << @parser.upgrade_data throw(:called) end - close + reset send(@pending.shift) unless @pending.empty? return unless response.headers["connection"] == "close" disable_concurrency emit(:reset) + end + + def handle_error(ex) + @requests.each do |request| + emit(:error, request, ex) + end end private def disable_concurrency