使用Django / PyISAPIe / IIS时,大型POST数据已损坏 [英] Large POST data is corrupted when using Django/PyISAPIe/IIS

查看:363
本文介绍了使用Django / PyISAPIe / IIS时,大型POST数据已损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用Django 1.2.3,PyISAPIe v1.1.0-rc4和IIS 7.5时,我遇到了大型POST数据(> 16384字节)的问题。



例如,当提交约60kB的表单数据使用POST,以下情况发生:




  • POST数据的第一个16kB块是正确的

  • 下一个16kB块是第一个块的重复

  • 下一个16kB是第一个块的另一个重复

  • 其余的(< ; 16kB)再次正确



有趣的是当使用 content-type =multipart / form数据,它的工作正常。



使用这些信息我将django\中的bug的可能位置跟踪到WSGIRequest._get_raw_post_data core\handlers\wsgi.py与默认(无内容类型)的情况分开处理 content-type =multipart / form-data。 / p>

这两种情况都是从 self.environ ['wsgi.input'] 中读取的,它被设置为PyISAPIe对象。不同的是,默认情况下看起来读取16kB的块,而多部分处理程序似乎读取的大小不到2GB。



我不知道关于C和Python接口C进一步挖掘,但我猜这个Bug是PySAPIe在ReadWrite.cpp中的ReadClient函数的某个地方。



我目前的解决方法是将 content-type =multipart / form-data添加到可能产品的表单中超过16kB的数据。



有没有人遇到这个,还是有人知道如何确定这个错误是否在PyISAPIe中?



谢谢!

解决方案

此处的PyISAPIe作者。



这已在修订版本184 ,而不是在可下载的版本中,如邮寄列表



它解决了一个以前记录的错误,显然没有受到很多关注,因为许多用户正在检查源,而不是下载包。或者,这是我最好的猜测无论我打算提供一个可下载的固定代码版本。



感谢您提请我注意,以便我们可以提醒这个项目的发行版本处于运行状态。


I'm running into a problem with large POST data (>16384 bytes) when using Django 1.2.3, PyISAPIe v1.1.0-rc4, and IIS 7.5.

For example, when submitting approx. 60kB of form data using POST, the following happens:

  • The first 16kB block of POST data are correct
  • The next 16kB block is a repeat of the first block
  • The next 16kB is another repeat of the first block
  • The rest (<16kB) is correct again

The interesting part is that when using content-type="multipart/form-data", it works fine.

Using this information I tracked down the likely location of the bug to WSGIRequest._get_raw_post_data in django\core\handlers\wsgi.py, which handles the content-type="multipart/form-data" separately from the default (no content-type) case.

Both cases read from self.environ['wsgi.input'], which is set to the PyISAPIe object. The difference is that the default case seems to read in chunks of 16kB, whereas the multipart handler seems to read in chunks of just under 2GB.

I don't know enough about C and the Python interface for C to dig in further, but I'm guessing the bug is somewhere in PyISAPIe in the ReadClient function in ReadWrite.cpp.

My current workaround is to add content-type="multipart/form-data" to forms that may product more than 16kB of data.

Has anybody run into this as well, or does anybody know how to determine if the bug is in fact in PyISAPIe?

Thank you!

解决方案

PyISAPIe author here.

This was fixed in revision 184 in the repository but not in the downloadable release, as discussed on the mailing list.

It addressed a previously documented bug that apparently hasn't received much attention because many users are checking out the source rather than downloading the package. Or, that's my best guess anyway; regardless, I plan to provide a downloadable version of the fixed code.

Thanks for bringing this to my attention so I can be reminded to keep this project's releases in a functioning state.

这篇关于使用Django / PyISAPIe / IIS时,大型POST数据已损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆