Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending a request with Accept-Encoding: deflate, gzip won't produce a compressed response #272

Closed
uaalto opened this issue Sep 12, 2016 · 6 comments

Comments

@uaalto
Copy link

uaalto commented Sep 12, 2016

A request using the mentioned header doesn't produce a response with Content-Encoding: gzip or deflate as expected. I've tried with this setting, but doesn't change much:

:pipeline-transform #(doto % (.addLast "deflater" (io.netty.handler.codec.http.HttpContentCompressor.)))

I don't see the deflater being added to the pipeline in Aleph's code anywhere. If this is supposed to be default in Netty, what does it need to be triggered otherwise?

Thanks @ztellman !

@uaalto
Copy link
Author

uaalto commented Sep 12, 2016

Also tried with:

:pipeline-transform #(doto % (.addLast "decoder" (io.netty.handler.codec.http.HttpRequestDecoder.))
                                              (.addLast "encoder" (io.netty.handler.codec.http.HttpRequestEncoder.))
                                              (.addLast "inflater" (io.netty.handler.codec.http.HttpContentDecompressor.))
                                              (.addLast "deflater" (io.netty.handler.codec.http.HttpContentCompressor.)))

@uaalto
Copy link
Author

uaalto commented Sep 13, 2016

In order for this to work, I had to use:

#(doto % (.addAfter "http-server" "deflater" (HttpContentCompressor. 1)))

Seems reasonable, but what about adding this to the pipeline by default. It's quite standard.
Also, do you think it would make sense to move https://github.com/ztellman/aleph/blob/master/src/aleph/http/server.clj#L398 up the pipeline before the handler?
Well, I see the benefits of having it this way too, so any function added to pipeline-transform can reference anything behind in the pipeline, and be placed wherever is required.

I would just add that the only inconvenience here is that for such an important feature, the way to enable it is not documented and not easily discoverable unless familiar with Netty.

@ztellman
Copy link
Collaborator

Hi, sorry for the late reply to this. I don't think this is something that should be enabled by default, but I think there's a strong argument to be made for adding a parameter to start-server which exposes this as an option.

Patches are welcome, or I'll get to it myself.

@uaalto
Copy link
Author

uaalto commented Sep 26, 2016

Hi @ztellman !
Thanks for your reply. What about adding it simply as documentation? That would also work.

@ztellman
Copy link
Collaborator

I'd be fine with a documentation patch, too.

truemped pushed a commit to truemped/aleph that referenced this issue Apr 8, 2017
Initial version of server side compression. This roughly follows the
discussion in clj-commons#272.
truemped added a commit to truemped/aleph that referenced this issue Apr 8, 2017
Initial version of server side compression. This roughly follows the
discussion in clj-commons#272.
@kachayev
Copy link
Collaborator

Closing this one as compression is already supported since d137b5f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants