Bug 2580 - Http Connection Close error when returning response with 201 Status Code
Summary: Http Connection Close error when returning response with 201 Status Code
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web (show other bugs)
Version: master
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-12-20 04:44 UTC by Demis Bellot
Modified: 2011-12-20 04:44 UTC (History)
1 user (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 for Bug 2580 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 Demis Bellot 2011-12-20 04:44:13 UTC
There is a bug when trying to return a 201 response where the Connection isn't closed properly since there is no Content-Length or Connection: Close to mark the end of the response.

In my brief scan around the Mono source code, this may be the problem:
https://github.com/mono/mono/blob/master/mcs/class/System.Web/System.Web/HttpResponse.cs#L809

Here's a wireshark example of the offending Request/Response. 
Note: there is no combination of Response.Flush() / Response.Close() / Response.CloseOutputStream() I can do on my side to change the behaviour.

(If you want to replicate the bug go to: http://www.servicestack.net/ServiceStack.MovieRest/ and try to Add a new movie - no callbacks are fired because Chrome doesn't know the response has completed).


POST /ServiceStack.MovieRest/movies HTTP/1.1
Host: www.servicestack.net
Connection: keep-alive
Content-Length: 199
Origin: http://www.servicestack.net
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7
Content-Type: application/x-www-form-urlencoded
Accept: application/json, text/javascript, */*; q=0.01
Referer: http://www.servicestack.net/ServiceStack.MovieRest/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

ImdbId=tt0110912&Title=Pulp+Fiction&Rating=8.9&Director=Quentin+Tarantino&ReleaseDate=1994-11-24&TagLine=Girls+like+me+don't+make+invitations+like+this+to+just+anyone!&Genres=Crime%2CDrama%2CThrillerHTTP/1.1 201 Created

Server: nginx/0.6.39
Date: Tue, 20 Dec 2011 05:47:19 GMT
Content-Type: application/json
Connection: keep-alive
X-Powered-By: ServiceStack/3.16 Unix/Mono
Location: http://cpe-66-65-0-90.nyc.res.rr.com/ServiceStack.MovieRest/movies/6
X-AspNet-Version: 4.0.30319
Cache-Control: private

{"Movie":{"Id":6,"ImdbId":"tt0110912","Title":"Pulp Fiction","Rating":8.9,"Director":"Quentin Tarantino","ReleaseDate":"\/Date(785631600000+0000)\/","TagLine":"Girls like me don't make invitations like this to just anyone!","Genres":["Crime","Drama","Thriller"]}}