Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Http version in response BaseHttp module python

I am running a server with BaseHttp with python.

I receive a request from a client which is based on HTTP/ 1.1

However, when I am answering the client back with my response, the client refuses to accept my response. On further analysis I saw that the HTTP Version I am sending is HTTP/1.0. However , I dont know how is it set.

The error at the client side is.

Original message: not well-formed (invalid token): line 2, column 4 
Response 
HTTP/1.0 200 OK
Server: BaseHTTP/0.3 Python/2.7.5
Date: Wed, 30 Jul 2014 15:11:42 GMT
Content-type: application/soap+xml; charset=utf-8
Content-length: 823

I am setting the header in the following way:

self.send_response(200)
self.send_header("Content-type", "application/soap+xml; charset=utf-8")
self.send_header("Content-length", content_length)
self.end_headers()
like image 707
infoclogged Avatar asked Apr 27 '26 16:04

infoclogged


1 Answers

Set the protocol_version attribute on your handler class:

handler.protocol_version = 'HTTP/1.1'

This requires that you set a Content-Length header, which you already do.

like image 127
Martijn Pieters Avatar answered Apr 30 '26 04:04

Martijn Pieters



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!