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
Depends on:
Reported: 2011-12-20 04:44 UTC by Demis Bellot
Modified: 2011-12-20 04:44 UTC (History)
1 user (show)

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


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:

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"]}}

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