client_python icon indicating copy to clipboard operation
client_python copied to clipboard

Metrics server not responding with HTTP 1.1

Open cirvladimir opened this issue 2 years ago • 2 comments
trafficstars

I'm using the default way of starting the server with start_http_server(). I noticed that the server responds with HTTP/1.0 to HTTP/1.1 requests. Is there a flag I need to set to support HTTP/1.1?

cirvladimir avatar Jun 20 '23 21:06 cirvladimir

In case anyone else comes across this and wants to change the version, it's coming from wsgiref.handlers in the python stdlib: https://github.com/python/cpython/blob/3.11/Lib/wsgiref/handlers.py#L104

You can change to using 1.1 by doing this:

from wsgiref.simple_server import ServerHandler

ServerHandler.http_version = "1.1"

Then later on when you call start_http_server(8000) (or similar) it will use this HTTP version and respond with HTTP/1.1 200 OK in responses.

jvperrin avatar Sep 28 '23 00:09 jvperrin