How to determine the Content-Length of a gzipped file?

前端 未结 3 1797
半阙折子戏
半阙折子戏 2020-12-10 12:35

Right now I\'m trying to serve CSS and JS files from a server that won\'t let me enable mod_gzip or mod_deflate. So I wrote a small PHP script to

3条回答
  •  孤城傲影
    2020-12-10 13:07

    To solve your firefox issue, I think you need to include header( "Content-Encoding: gzip" ); so that the browser knows to decompress the content.

    As for the content length, you can try just leaving this value off, or try to figure out a way to use "Transfer-Encoding: chunked" (you can't jsut send this header, you need to format the data specially for it). It is possible that ob_end_flush automatically enables chunking.

    I recommend you get wireshark and capture what your php script is sending and compare it to a properly behaving server to see what headers, etc are missing.

提交回复
热议问题