This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 10001 - Bug in HttpResponse.TransmitFile involving Chuncked transfer encoding
: Bug in HttpResponse.TransmitFile involving Chuncked transfer encoding
Status: RESOLVED FIXED
Product: Class Libraries
Classification: Mono
Component: Sys.Web
: Trunk
: PC Linux
: --- normal
: ---
Assigned To: Bugzilla
:
:
:
:
  Show dependency treegraph
 
Reported: 2013-02-03 07:20 EST by All
Modified: 2013-09-05 07:53 EDT (History)
4 users (show)

See Also:
Tags:
Test Case URL:
External Submit: ---


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

Description All 2013-02-03 07:20:49 EST
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 EST
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 EST
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 EST
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 EST
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 EST
*** Bug 6689 has been marked as a duplicate of this bug. ***
Comment 6 Victor 2013-08-28 09:19:03 EDT
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 EDT
Fixed in mono/master b6d634dd24c088149736e083235bbc29b770859b by merging PR 744
in mono/master 5178f29c4b3b6c31b88357d9c126af707a27992b
Comment 8 Marek Habersack 2013-09-05 06:16:46 EDT
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 EDT
New PR merged (https://github.com/mono/mono/pull/752) in:

mono/master da51407be53a61d67bd50e2ed69de6b766a239ef
mono/master 41f7b183680d3c8517feb6120544a93490339def

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