Why do I have unwanted extra bytes at the beginning of image?

后端 未结 3 799
盖世英雄少女心
盖世英雄少女心 2021-01-14 07:15

Question:

I\'ve made a homepage for my brother, accessible here:
http://www.daniel-steiger.ch

It uses Microsoft ASP.NET MVC3 on Linux with mono 3, over

3条回答
  •  野的像风
    2021-01-14 07:31

    This seems to be a bug involving Chuncked transfer encoding in

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

    Edit:
    There is this code in the constructor:

    if (worker_request != null)
          use_chunked = (worker_request.GetHttpVersion () == "HTTP/1.1");
    

    Patched it to check for CGI (if CGI, the server handles the file transfer, so there may be no chuncked encoding given back from the FastCGI server as per RFC 3875.

            internal HttpResponse (HttpWorkerRequest worker_request, HttpContext context) : this ()
            {
                WorkerRequest = worker_request;
                this.context = context;
    
    #if !TARGET_J2EE
                if (worker_request != null)
                {
    
                    if(worker_request.GetHttpVersion () == "HTTP/1.1")
                    {
                        string GatewayIface = context.Request.ServerVariables["GATEWAY_INTERFACE"];
                        use_chunked = (GatewayIface == null || !GatewayIface.StartsWith("CGI"));
                    }
                    else
                        use_chunked = false;
    
                }
    #endif
                writer = new HttpWriter (this);
            }
    

    Added patch to https://bugzilla.xamarin.com/show_bug.cgi?id=10001
    Fixed in mono 3.2.3

提交回复
热议问题