Bug 6472 - Call to HttpWebRequest.GetRequestStream() connects to server when HTTP Method is DELETE
Summary: Call to HttpWebRequest.GetRequestStream() connects to server when HTTP Method...
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 5.2
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Martin Baulig
URL:
Depends on:
Blocks:
 
Reported: 2012-08-08 14:04 UTC by amsidev
Modified: 2012-09-04 13:55 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description amsidev 2012-08-08 14:04:41 UTC
Using Monodevelop 3.0.3.5, MOno 2.10.9, MonoTouch 5.2.12

Submitting this report in reference to:
http://stackoverflow.com/q/11785597/1572495

Basically, in the following code, as soon as the line req.GetRequestStream is hit, the Delete Web API on the server within the Session Controller is executed. And hence the additional data sent via jSON does not go through. Similar workflow for POST  or PUT works fine.

HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create("http://localhost/module/api/session/");
        req.ContentType = "application/json";
        req.CookieContainer = jar;
        req.Method = "Delete";
        using (var streamWrite = new StreamWriter(req.GetRequestStream()))
        {
            string jSON = "{\"UserName\":\"" + "someone" + "\"}";
            streamWrite.Write(jSON);
            streamWrite.Close();
        }
        HttpWebResponse res = (HttpWebResponse)req.GetResponse();


The same code works fine in a Visual Studio 2010 windows app.
Comment 1 Martin Baulig 2012-09-03 16:57:20 UTC
This has already been fixed in Mono 2.10.10:
https://github.com/mono/mono/commit/74ec9d9f0ec847e42d8e17334ac30f04d274b6db

We need to backport this into Monotouch.
Comment 2 Martin Baulig 2012-09-04 13:55:04 UTC
The fix has been backported into Monotouch.