Question

I am using MonoTouch to call a remote web service from an iOS app. I use HttpWebRequest and it works great for me for GET, PUT, and POST requests. 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).

The identical code works perfectly when run on a Windows Phone with the WP7.1 implementation of System.Net.HttpWebRequest.

I know that there is some debate on whether RFC 2616 allows an entity body in a DELETE request (e.g. Phil Haack's question). 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 (i.e. Mono enforces a Content-Length of 0 for the body of a DELETE request)? Or does Mono implement HWR on top of an Apple framework that is responsible for this behavior? 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.

Était-ce utile?

La solution

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.

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).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top