akka / akka-http

The Streaming-first HTTP server/module of Akka
https://doc.akka.io/docs/akka-http
Other
1.34k stars 594 forks source link

Application/octet-stream doesn't support compressing #145

Open akka-ci opened 8 years ago

akka-ci commented 8 years ago

Issue by vans239 Friday Nov 27, 2015 at 16:10 GMT Originally opened as https://github.com/akka/akka/issues/19036


I recently found that Media type application/octet-stream couldn't be gziped due uncompressible flag. What cause of such behavior? I didn't find any info in rfc. Thanks

akka-ci commented 8 years ago

Comment by jrudolph Monday Nov 30, 2015 at 09:20 GMT


I agree, the current compressibility heuristic seems inaccurate and a bit inflexible.

The current way to configure what to compress is by creating your own instances of Gzip or Deflate and pass a MessageFilter that suits your needs.

akka-ci commented 8 years ago

Comment by vans239 Monday Nov 30, 2015 at 09:41 GMT


Thank's for idea of custom encoder))

akka-ci commented 8 years ago

Comment by viktorklang Tuesday Dec 08, 2015 at 11:06 GMT


For clarity, are we saying that:

val `application/octet-stream` = abin("octet-stream", NotCompressible, "a", "bin", "class", "dump", "exe", "lhx", "lzh", "o", "psd", "saveme", "zoo")

ought to be changed to:

val `application/octet-stream` = abin("octet-stream", Compressible, "a", "bin", "class", "dump", "exe", "lhx", "lzh", "o", "psd", "saveme", "zoo")
akka-ci commented 8 years ago

Comment by vans239 Tuesday Dec 08, 2015 at 12:03 GMT


Yes, i mean this. But i am not sure that it should be changed to compressible. I want understand cause of such behaviour. For example, *.class could be compressed well.

akka-ci commented 8 years ago

Comment by viktorklang Tuesday Dec 08, 2015 at 13:07 GMT


@ktoso @jrudolph Thoughts?

akka-ci commented 8 years ago

Comment by ktoso Thursday Apr 21, 2016 at 18:51 GMT


Seems valid, bumping to see if anyone objects.

leachbj commented 7 years ago

I just ran into this problem, was pretty confused as to why my response wasn't being gzip'ed. Had to go to the source code to figure out what was going on. +1 to not marking octet stream as compressible.

ochrons commented 7 years ago

I recently got bitten by this "feature" as well. IMO it should be compressible since it cannot be assumed to be compressed data to begin with (like zip, gif, jpg etc. are)

jrudolph commented 7 years ago

I agree that changing the default here would be fine for me. As suggested above this might be quite a simple change so if anyone wants to PR please go for it ;)

ktoso commented 7 years ago

Yep, please send in a PR @ochrons