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
Depends on:
Reported: 2014-06-30 17:22 UTC by RGeoffrion
Modified: 2017-09-06 16:55 UTC (History)
2 users (show)

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

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

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. 

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

		[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

Note You need to log in before you can comment on or make changes to this bug.