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

#1918 gzip and deflate content codecs #2148

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

iyfedorov
Copy link

Hello! Can you look at my suggestion of concept for request content encoding support?

@adamw
Copy link
Member

adamw commented Apr 24, 2024

Thanks for looking into this!

I think I would have two general suggestions:

  1. the compression should probably be handled in the backends themselves. Right now, if you have a chain of Backends with delegates, the first one would perform the compression of the body and passed the compressed body to its delegate. I think this should rather happen at the end of the chain, right before sending. So any metrics, logging, redirect etc. backends would get the uncompressed body
  2. then, the backends could use our default methods of compression, or use their built-in ones. For sure the default backend doesn't handle compression (based on Java's HttpClient), but maybe pekko-http, or async-http-client do? Something to check :)

In a somewhat similar fashion we handle decompressino (see e.g. customEncodingHandler and standardEncoding in HttpClientBackend)

@iyfedorov
Copy link
Author

Thanks for looking into this!

I think I would have two general suggestions:

  1. the compression should probably be handled in the backends themselves. Right now, if you have a chain of Backends with delegates, the first one would perform the compression of the body and passed the compressed body to its delegate. I think this should rather happen at the end of the chain, right before sending. So any metrics, logging, redirect etc. backends would get the uncompressed body
  2. then, the backends could use our default methods of compression, or use their built-in ones. For sure the default backend doesn't handle compression (based on Java's HttpClient), but maybe pekko-http, or async-http-client do? Something to check :)

In a somewhat similar fashion we handle decompressino (see e.g. customEncodingHandler and standardEncoding in HttpClientBackend)

Hello! Thank u for the answer. I will try to implement compression on one of the backends in the near future.

@adamw
Copy link
Member

adamw commented Apr 25, 2024

Great :) I suspect the default backend - HttpClientBackend - would be the best one to tackle first

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

Successfully merging this pull request may close these issues.

None yet

2 participants