响应BaseHttp模块python的Http版本

响应BaseHttp模块python的Http版本,python,basehttpserver,Python,Basehttpserver,我正在运行一个带有BaseHttp和python的服务器 我从一个基于HTTP/1.1的客户端收到一个请求 然而,当我回复客户我的回复时,客户拒绝接受我的回复。 进一步分析后,我发现我发送的HTTP版本是HTTP/1.0。 然而,我不知道它是如何设置的 客户端的错误是 Original message: not well-formed (invalid token): line 2, column 4 Response HTTP/1.0 200 OK Server: BaseHTTP/0.3

我正在运行一个带有BaseHttp和python的服务器

我从一个基于HTTP/1.1的客户端收到一个请求

然而,当我回复客户我的回复时,客户拒绝接受我的回复。 进一步分析后,我发现我发送的HTTP版本是HTTP/1.0。 然而,我不知道它是如何设置的

客户端的错误是

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
我以以下方式设置标题:

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()
在处理程序类上设置:

handler.protocol_version = 'HTTP/1.1'
这要求您设置
内容长度
标题,您已经这样做了