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

后端 未结 3 798
盖世英雄少女心
盖世英雄少女心 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

    0 讨论(0)
  • 2021-01-14 07:39

    I don't recognize that Tools.Imaging.GetThumbnailStream() function, and neither does Google. Assuming that's your own code or a 3rd party library, I'd look there for the source of the strange bytestream.

    0 讨论(0)
  • 2021-01-14 07:42
    31 39 36 62 36 38 0D 0A
    

    is 196b68/r/n in ascii.

    • does this color some how related to your code?
    • does the string 196b68/r/n say something related to your platforms?
    0 讨论(0)
提交回复
热议问题