lib/httpx/connection/http1.rb in httpx-0.14.4 vs lib/httpx/connection/http1.rb in httpx-0.14.5
- old
+ new
@@ -38,10 +38,11 @@
end
def reset
@max_requests = @options.max_requests || MAX_REQUESTS
@parser.reset!
+ @handshake_completed = false
end
def close
reset
emit(:close, true)
@@ -258,10 +259,11 @@
request.chunk!
end
requests_limit = [@max_requests, @requests.size].min
- connection = if request.options.persistent || request != @requests[requests_limit - 1]
+ connection = if request != @requests[requests_limit - 1] &&
+ request.options.persistent && @max_requests != 1
"keep-alive"
else
"close"
end