Bug 20981 - HTTP request message does not process "put" and "delete" methods
Summary: HTTP request message does not process "put" and "delete" methods
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies (show other bugs)
Version: 3.4.0
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-06-30 17:22 UTC by RGeoffrion
Modified: 2017-09-06 16:55 UTC (History)
2 users (show)

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


Attachments
patch file (512 bytes, application/octet-stream)
2014-06-30 17:22 UTC, RGeoffrion
Details


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 for Bug 20981 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description RGeoffrion 2014-06-30 17:22:27 UTC
Created attachment 7235 [details]
patch file

The HTTP methods "PUT" and "DELETE" are not processed by HttpReplyProcess:TryReceiveRequest. 

		[OperationContract]
		[WebInvoke(UriTemplate = "attribute/{id}",
			Method = "PUT",
		           RequestFormat = WebMessageFormat.Json,
		           ResponseFormat = WebMessageFormat.Json)]
		void UpdateAttribute(Attribute attribute, string id);

The UpdateAttribute is never called. The request times out, no error is returned. If you change the method to "POST", UpdateAttribute is called and the appropriate response is returned.

The contract works in windows.net with the "PUT" method.

The attached patch file also has a fix for a POST and PUT method throwing on Xml and Json Content Types with a Content Length of 0 or less.

This is the exception when sending a put with json as the content type and content length = 0; modify the contract so no data is sent, everything is in the Uri.

		[OperationContract]
		[WebInvoke(UriTemplate = "attribute/{id}",
			Method = "PUT",
		           RequestFormat = WebMessageFormat.Json,
		           ResponseFormat = WebMessageFormat.Json)]
		void UpdateAttribute(string id);

Unhandled Exception:
System.InvalidOperationException: Argument XmlReader is expected to be positioned at element
  at System.ServiceModel.Channels.XmlReaderBodyWriter..ctor (System.Xml.XmlDictionaryReader reader) [0x0001a] in \mono-3.4.0\mono-3.4.0\mcs\class\System.ServiceModel\System.ServiceModel.Channels\XmlReaderBodyWriter.cs:62 
  at System.ServiceModel.Channels.Message.CreateMessage (System.ServiceModel.Channels.MessageVersion version, System.String action, System.Xml.XmlDictionaryReader body) [0x00000] in \mono-3.4.0\mono-3.4.0\mcs\class\System.ServiceModel\System.ServiceModel.Channels\Message.cs:398 
  at System.ServiceModel.Channels.WebMessageEncoder.ReadMessage (System.IO.Stream stream, Int32 maxSizeOfHeaders, System.String contentType) [0x000f9] in \mono-3.4.0\mono-3.4.0\mcs\class\System.ServiceModel.Web\System.ServiceModel.Channels\WebMessageEncoder.cs:120 
  at System.ServiceModel.Channels.Http.HttpReplyChannel.CreatePostMessage (System.ServiceModel.Channels.Http.HttpContextInfo ctxi) [0x00081] in \mono-3.4.0\mono-3.4.0\mcs\class\System.ServiceModel\System.ServiceModel.Channels.Http\HttpReplyChannel.cs:230 
  at System.ServiceModel.Channels.Http.HttpReplyChannel.TryReceiveRequest (TimeSpan timeout, System.ServiceModel.Channels.RequestContext& context) [0x000aa] in \mono-3.4.0\mono-3.4.0\mcs\class\System.ServiceModel\System.ServiceModel.Channels.Http\HttpReplyChannel.cs:172 
  at System.ServiceModel.Channels.ReplyChannelBase.<BeginTryReceiveRequest>m__0 (TimeSpan tout, System.ServiceModel.Channels.RequestContext& ctx) [0x00036] in \mono-3.4.0\mono-3.4.0\mcs\class\System.ServiceModel\System.ServiceModel.Channels\ReplyChannelBase.cs:126