lib/httpx/connection/http1.rb in httpx-0.14.0 vs lib/httpx/connection/http1.rb in httpx-0.14.1

- old
+ new

@@ -252,16 +252,19 @@ @max_concurrent_requests = 1 @pipelining = false end def set_protocol_headers(request) - request.headers["host"] ||= request.authority - request.headers["connection"] ||= request.options.persistent ? "keep-alive" : "close" if !request.headers.key?("content-length") && request.body.bytesize == Float::INFINITY request.chunk! end + + { + "host" => (request.headers["host"] || request.authority), + "connection" => (request.headers["connection"] || (request.options.persistent ? "keep-alive" : "close")), + } end def headline_uri(request) request.path end @@ -280,11 +283,11 @@ end def join_headers(request) @buffer << "#{request.verb.to_s.upcase} #{headline_uri(request)} HTTP/#{@version.join(".")}" << CRLF log(color: :yellow) { "<- HEADLINE: #{@buffer.to_s.chomp.inspect}" } - set_protocol_headers(request) - join_headers2(request.headers) + extra_headers = set_protocol_headers(request) + join_headers2(request.headers.each(extra_headers)) log { "<- " } @buffer << CRLF end def join_body(request)