【发布时间】:2011-07-05 18:27:54
【问题描述】:
客户端将 mjpeg 流作为 HTTP POST 发布:
POST /feed/testfeed HTTP/1.0
Content-type: multipart/x-mixed-replace; boundary=--myboundary
--myboundary
Content-length: 14179
Content-type: image/jpeg
....JFIF....
....
我在 Django 中根本看不到任何传入数据。 request.read(6) 返回空字符串。我添加了假的“content-Length”标头:
POST /feed/testfeed HTTP/1.0
Content-Length: -1
Content-type: multipart/x-mixed-replace; boundary=--myboundary
...
现在它以最快的速度读取整个数据。 request.read(6) 仅在我中断连接后才返回(包含整个数据,而不仅仅是预期的 6 个字节)。
同样的行为是当我使用“PUT”请求而不是“POST”请求时。
如何关闭 POST 请求的缓冲?
【问题讨论】:
标签: python django buffering http-post