Bug 10001 - Bug in HttpResponse.TransmitFile involving Chuncked transfer encoding
Summary: Bug in HttpResponse.TransmitFile involving Chuncked transfer encoding
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web ()
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
: 6689 ()
Depends on:
Reported: 2013-02-03 07:20 UTC by All
Modified: 2013-09-05 07:53 UTC (History)
4 users (show)

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

Fixes checking for CGI and if yes omitting chuncked encoding (418 bytes, patch)
2013-02-12 00:10 UTC, All

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 GitHub or Developer Community 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:

Description All 2013-02-03 07:20:49 UTC
Response.TransmitFile doesn't work.
The file that is transmitted is invalid.
This seems to be a bug involving Chuncked transfer encoding.
Environment used:  ASP.NET MVC3 Razor on Mono 3.0.1 on nginx via fastcgi-mono-server4.

Bug location:
Class: System.Web.HttpResponse (or one of its dependencies)
Method: TransmitFile(string filename)

, or in the fastcgi interface implementation.

- It does not occur in Response.WriteFile(string filename)
- It has nothing to do with large filesize per se, as it also occurs on a 4kb image

All necessary description here:

and here:
Comment 1 Andres G. Aragoneses 2013-02-03 12:40:06 UTC
I think this is not a bug in Mono.

But what I'm sure is that the symptoms are the same as the ones I reported in bug 6689, so, can you mark this as a duplicate?

FYI, my latest findings in that bug tell me that NGinx doesn't support chunked encoding yet (at least the version I tested), so it's very probable that the bug is finally closed as INVALID anyway.
Comment 2 All 2013-02-07 01:06:06 UTC

         location / {
                 root /home/danillo/www/HomePage;
                 #index index.html index.htm default.aspx Default.aspx;
                 #fastcgi_index Default.aspx;
                 include /etc/nginx/fastcgi_params;
                 chunked_transfer_encoding on;
                 proxy_http_version 1.1;
                 #fastcgi_keep_conn on;
to nginx config. no change.
set proxy version to 1.0 and transfer_encoding to off, but still no change.
Comment 3 All 2013-02-12 00:10:33 UTC
Created attachment 3356 [details]
Fixes checking for CGI and if yes omitting chuncked encoding

Now checks if cgi/fastcgi, and if yes, omitts chuncked encoding 

Comment 4 Andres G. Aragoneses 2013-02-13 12:37:25 UTC
Can you respect Mono coding guidelines please? i.e.: put a space after the if and before the bracket, use camelCase for variables.

Also, just before the .StartsWith("CGI") check, you could add a comment referencing to the documentation where it is stated that FastCGI transport should not use chunked encoding (I think someone pointed out an RFC about this in the mono mailing list).

Comment 5 Andres G. Aragoneses 2013-02-13 12:38:23 UTC
*** Bug 6689 has been marked as a duplicate of this bug. ***
Comment 6 Victor 2013-08-28 09:19:03 UTC
Mr Champetier did a pull request : https://github.com/mono/mono/pull/744 to fix the failure to comply with the standard of RFC 3875 ( http://tools.ietf.org/html/rfc3875#section-6.3.4 ).

The patch provided is in accordance to Mono coding guidelines ;)

I hope this fix will be added as soon as possible in the next mono release.

Comment 7 Marek Habersack 2013-09-02 11:49:47 UTC
Fixed in mono/master b6d634dd24c088149736e083235bbc29b770859b by merging PR 744 in mono/master 5178f29c4b3b6c31b88357d9c126af707a27992b
Comment 8 Marek Habersack 2013-09-05 06:16:46 UTC
The commit apparently caused regressions in the System.Web test suite, see http://wrench.mono-project.com/Wrench/WebServices/Download.aspx?workfile_id=2747689

Thus reopening the issue - please run the full test suite in all profiles before submitting the fix,thanks!
Comment 9 Marek Habersack 2013-09-05 07:53:33 UTC
New PR merged (https://github.com/mono/mono/pull/752) in:

mono/master da51407be53a61d67bd50e2ed69de6b766a239ef
mono/master 41f7b183680d3c8517feb6120544a93490339def