[Mono-dev] Bug in mono 3.0.1 MVC3 File/FileResult

SirNoSkill quandary82 at hailmail.net
Thu Feb 7 15:31:24 UTC 2013


Hi,



I've forwarded the error to the nginx mailing list.



http://forum.nginx.org/read.php?2,235985,235988#msg-235988



The response I got:

It's bad idea to use "Transfer-Encoding" while working via CGI and

derived protocols like FastCGI. Quote from RFC 3875,

[1]http://tools.ietf.org/html/rfc3875#section-6.3.4:



The script MUST NOT return any header fields that relate to

client-side communication issues and could affect the server's

ability to send the response to the client.



As you are talking to nginx via FastCGI, not HTTP, it won't try to

dig into content returned and decode it according to any

Transfer-Encoding. Instead, the "Transfer-Encoding" header

returned will be just dropped by nginx as per RFC 3875.













On Sat, Feb 2, 2013, at 09:00 PM, SirNoSkill wrote:

I have more details on the bug.

The extra bytes that are at the beginning

31 39 36 62 36 38 0D 0A

which reads 196b68/r/n in ASCII

196b68 is the filesize of the original image in hex...



All details + hexdump links added here:

[2]http://stackoverflow.com/questions/14662795/why-do-i-have-unwanted-e
xtra-bytes-at-the-beginning-of-image







All traffic to that URL [[3]www.daniel-steiger.ch] (except for the
folders /doc and /images), but including images in /Content, is
directly forwarded to fastcgi by nginx, as per fastcgi config file for
domain.





 server {

         listen   80;

         server_name [4]www.daniel-steiger.ch daniel-steiger.ch;

         access_log   /var/log/nginx/daniel-steiger.ch.access.log;



         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;

         }





location /doc {

root /usr/share;

autoindex on;

allow 127.0.0.1;

deny all;

}



location /images {

root /usr/share;

autoindex off;

}



#error_page 404 /404.html;



# redirect server error pages to the static page /50x.html

#

error_page 500 501 503 504 /50x.html;

location = /50x.html {

root /home/danillo/www/HomePage;

}





error_page 502 /502.html;

location = /502.html {

root /home/danillo/www/HomePage;

}



}





It's sufficient to have the file served without FileResult.

Of course it's more efficient if nginx serves it directly, but this is
a very low traffic website, so performance is really not my problem ;)



And by the way, the problem is not finding a workaround.

I have already fixed it with a workaround about a week ago.

I really just want to know where the bug is, because if FileResult
malfunctions, there's probably more to it, and I don't want to walk
into a subtle not at the first sight spottable bug later, like a
botched binary upload/download file.











On Sat, Feb 2, 2013, at 06:51 AM, Daniel Lo Nigro wrote:

Hmm... Maybe try an X-Accel-Redirect header instead. This lets Nginx
serve the file instead of Mono having to serve it, which makes it more
efficient. See if that makes a difference, or if it has the same issue.

Why not just link directly to the file, instead of serving it through
your C# code?



On Sun, Feb 3, 2013 at 1:43 AM, quandary82 <[5]quandary82 at hailmail.net>
wrote:

Corrected the mime, but seems to be a mono-bug (or fastcgi) anyway.



More here:

[6]http://stackoverflow.com/questions/14662795/why-do-i-have-unwanted-e
xtra-bytes-at-the-beginning-of-image







--

View this message in context:
[7]http://mono.1490590.n4.nabble.com/Bug-in-mono-3-0-1-MVC3-File-FileRe
sult-tp4658382p4658422.html

Sent from the Mono - Dev mailing list archive at Nabble.com.

_______________________________________________
Mono-devel-list mailing list
[8]Mono-devel-list at lists.ximian.com
[9]http://lists.ximian.com/mailman/listinfo/mono-devel-list



--

SirNoSkill

quandary82 at hailmail.net

--
http://www.fastmail.fm - mmm... Fastmail...



--

SirNoSkill

quandary82 at hailmail.net

References

1. http://tools.ietf.org/html/rfc3875#section-6.3.4
2. http://stackoverflow.com/questions/14662795/why-do-i-have-unwanted-extra-bytes-at-the-beginning-of-image
3. http://www.daniel-steiger.ch/
4. http://www.daniel-steiger.ch/
5. mailto:quandary82 at hailmail.net
6. http://stackoverflow.com/questions/14662795/why-do-i-have-unwanted-extra-bytes-at-the-beginning-of-image
7. http://mono.1490590.n4.nabble.com/Bug-in-mono-3-0-1-MVC3-File-FileResult-tp4658382p4658422.html
8. mailto:Mono-devel-list at lists.ximian.com
9. http://lists.ximian.com/mailman/listinfo/mono-devel-list

-- 
http://www.fastmail.fm - IMAP accessible web-mail

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20130207/f7805f20/attachment.html>


More information about the Mono-devel-list mailing list