【发布时间】:2012-03-03 12:33:29
【问题描述】:
我想发送分块的 HTTP 正文来测试我自己的 HTTP 服务器。 所以我写了这个python代码:
import http.client
body = 'Hello World!' * 80
conn = http.client.HTTPConnection("some.domain.com")
url = "/some_path?arg=true_arg"
conn.request("POST", url, body, {"Transfer-Encoding":"chunked"})
resp = conn.getresponse()
print(resp.status, resp.reason)
我希望 HTTP 请求的正文被传输分块, 但是我用 Wireshark 捕获了网络包,HTTP 请求的正文没有被分块传输。
如何在python中通过http.client lib传输分块体?
【问题讨论】: