class Async::HTTP::Protocol::HTTP10

Implements basic HTTP/1.1 request/response.

def keep_alive?(headers)

def keep_alive?(headers)
	headers['connection'] == KEEP_ALIVE
end

def read_body(headers)

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)
		return Body::Remainder.new(@stream)
	end
end

def receive_requests

Server loop.
def receive_requests
	while request = Request.new(*self.read_request)
		response = yield request
		
		response.version ||= request.version
		
		write_response(response.version, response.status, response.headers, response.body)
		
		unless keep_alive?(request.headers) && keep_alive?(headers)
			@keep_alive = false
			
			break
		end
	end
	
	return false
end

def version

def version
	VERSION
end

def write_body(body, chunked = true)

def write_body(body, chunked = true)
	# We don't support chunked encoding.
	super(body, false)
end