nytimes / gziphandler

Go middleware to gzip HTTP responses
https://godoc.org/github.com/NYTimes/gziphandler
Apache License 2.0
868 stars 129 forks source link

Changed minimum size to gzip response & added missing test #67

Closed zemariamm closed 6 years ago

zemariamm commented 6 years ago

if you’re compressing files that are smaller than the MTU size of a TCP packet, you’re wasting your time. 1500 bytes is the MTU size for the internet since that is the largest size allowed at the network layer. If you take a file that is 1300 bytes and compress it to 800 bytes, it’s still transmitted in that same 1500 byte packet regardless, so you’ve gained nothing. That being the case, you should restrict the gzip compression to files with a size greater than a single packet, 1400 bytes (1.4KB) is a safe value.

zemariamm commented 6 years ago

@jprobinson no problemo! It was actually a "copy-paste" from a forum

jprobinson commented 6 years ago

thanks again, @zemariamm!

zemariamm commented 6 years ago

@jprobinson my pleasure