简体   繁体   English

MonoTouch或iOS Web堆栈是否正在吞噬我的HTTP DELETE请求正文?

[英]Is MonoTouch or the iOS web stack eating my HTTP DELETE request body?

I am using MonoTouch to call a remote web service from an iOS app. 我正在使用MonoTouch从iOS应用程序调用远程Web服务。 I use HttpWebRequest and it works great for me for GET, PUT, and POST requests. 我使用HttpWebRequest,它对GET,PUT和POST请求非常有用。 However, when I try to make a DELETE request, I get some odd behavior: the entity body that I send gets truncated and the server receives an empty body (Content-Length: 0). 但是,当我尝试发出DELETE请求时,我得到一些奇怪的行为:我发送的实体主体被截断,服务器接收到一个空主体(Content-Length:0)。

The identical code works perfectly when run on a Windows Phone with the WP7.1 implementation of System.Net.HttpWebRequest. 在具有System.Net.HttpWebRequest的WP7.1实现的Windows Phone上运行时,相同的代码可以完美地工作。

I know that there is some debate on whether RFC 2616 allows an entity body in a DELETE request (eg Phil Haack's question ). 我知道关于RFC 2616是否允许DELETE请求中的实体正文存在一些争论(例如Phil Haack的问题 )。 This question isn't about that - it is about why the body does not make it to the server. 这个问题不是关于这个问题的,而是关于主体为什么不将其传递给服务器的问题。

Now to the question :-) Is this issue in MonoTouch's implementation of HttpWebRequest (ie Mono enforces a Content-Length of 0 for the body of a DELETE request)? 现在开始提出问题:-) MonoTouch的HttpWebRequest实现中是否存在此问题(即Mono对DELETE请求的主体强制Content-Length为0)? Or does Mono implement HWR on top of an Apple framework that is responsible for this behavior? 还是Mono在负责此行为的Apple框架之上实现HWR? The reason for the question, of course, is to better understand whether I can work around the issue and/or implore Miguel to allow DELETE bodies, or whether I need to change my wire format. 当然,提出该问题的原因是为了更好地理解我是否可以解决此问题和/或恳请Miguel允许DELETE正文,或者是否需要更改线材格式。

This looks like a bug in Mono, after a (very) quick look in the source code I found this , which seems to be the culprit. 在对源代码进行(非常)快速浏览后,我发现似乎是Mono中的错误,这似乎是罪魁祸首。

You should file a bug with a test case so it can be fixed (even better: provide a patch as well, in which case it shouldn't take long to get it fixed). 您应该在测试用例中提交一个错误 ,以便可以对其进行修复(甚至更好:提供一个补丁,在这种情况下,可以很快就将其修复)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM