Python Bottle HTTPResponse Object => Change HTTP version from 1.0 to 1.1

73 Views Asked by At

I`m implementing a web server using Bottle. There is another webserver which sends a Post request and expects a response with HTTP/1.1 where wireshark shows my responses are HTTP 1.0

enter image description here

This is the piece of code where I handle the POST. Apologizes for commented parts , I wanted to add what I have been experimenting.

 myr = HTTPResponse()
        myr.status = 200
        myr.body = dict(health)
        myr.content_type = "application/json"
        myr.add_header("protocol_version", "HTTP/1.1")
        x = myr.headers.allitems()
        return myr  # HTTPResponse(status=201, body=dict(health))

I tried add_header but this did not work. I still get HTTP/1.0

enter image description here

I understand this might be related to BaseResponse Class.

Is there a way to change HTTP/1.0 to HTTP/1.1 ? Thanks

1

There are 1 best solutions below

0
tguclu On

Protocol version is a property of server. Adding line below before starting server resolved my problem

   paste.httpserver.WSGIHandler.protocol_version = 'HTTP/1.1'
   run(server='paste')