http
http copied to clipboard
Response should use the same HTTP version as the request
At the moment if the request is version 1.0, we reply with HTTP version 1.1. e.g. curl --http1.0 -v localhost:8000/json (from techempower-benchmarks) returns
* About to connect() to localhost port 8000 (#0)
* Trying ::1...
* Adding handle: conn: 0x1da8d10
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x1da8d10) send_pipe: 1, recv_pipe: 0
* Connection refused
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8000 (#0)
> GET /json HTTP/1.0
> User-Agent: curl/7.30.0
> Host: localhost:8000
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Length: 27
< Date: Wed, 14 May 2014 09:32:49 +0200
* Server HTTP Server/0.9 is not blacklisted
< Server: HTTP Server/0.9
< Content-Type: application/json
<
* Connection #0 to host localhost left intact
{"message":"Hello, World!"}
At the moment send-response-line uses the constant $http-version as the http version to use. I think this should be changed to be based on the http version of the request.
I think a function like response-version(response) would be useful. e.g. response-version(res) => #"http/1.1". At the moment we have to do response.response-request.request-version.