lib/async/http/protocol/http10.rb in async-http-0.19.0 vs lib/async/http/protocol/http10.rb in async-http-0.20.0
- old
+ new
@@ -29,11 +29,11 @@
def version
VERSION
end
- def keep_alive?(headers)
+ def persistent?(headers)
headers['connection'] == KEEP_ALIVE
end
# Server loop.
def receive_requests
@@ -42,31 +42,31 @@
response.version ||= request.version
write_response(response.version, response.status, response.headers, response.body)
- unless keep_alive?(request.headers) && keep_alive?(headers)
+ unless persistent?(request.headers) && persistent?(headers)
@keep_alive = false
break
end
end
return false
end
- def write_body(body, chunked = true)
+ def write_body(body, chunked = false)
# We don't support chunked encoding.
- super(body, false)
+ super(body, chunked)
end
def read_body(headers)
if body = super
return body
end
# Technically, with HTTP/1.0, if no content-length is specified, we just need to read everything until the connection is closed.
- if !keep_alive?(headers)
+ if !persistent?(headers)
return Body::Remainder.new(@stream)
end
end
end
end