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

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


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

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:
http://stackoverflow.com/questions/14662795/why-do-i-have-unwanted-extra-bytes-at-the-beginning-of-image

and here:
http://mono.1490590.n4.nabble.com/Bug-in-mono-3-0-1-MVC3-File-FileResult-td4658382.html
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
added

         location / {
                 root /home/danillo/www/HomePage;
                 #index index.html index.htm default.aspx Default.aspx;
                 #fastcgi_index Default.aspx;
                 fastcgi_pass 127.0.0.1:9000;
                 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 

http://stackoverflow.com/questions/14662795/why-do-i-have-unwanted-extra-bytes-at-the-beginning-of-image/14671753#14671753
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).

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

Regards,
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

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.


Create a new report for Bug 10001 on Developer Community or GitHub if you have new information to add and do not yet see a matching report.

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • 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


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.

Related Links: