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

Add deflate as a supported REST response encoding #5016

Merged
merged 1 commit into from
Nov 5, 2024

Commits on Oct 22, 2024

  1. Add deflate as a supported REST response encoding

    Some HTTP servers don't parse Accept-Encoding headers as they should
    and just assume that deflate is commonly available.
    
    okhttp3 has built-in support for transparently adding gzip as an
    accepted encoding, and decoding the response body,
    which is how gzip previously Just Worked.
    
    This built-in encoding handler is conditional on the user not passing in
    any Accept-Encoding headers, which is assumed to indicate that the
    caller intends to somehow handle the encoded response body themself.
    
    We can implement our own transparent decoding support
    using the same mechanism that okhttp3 does internally
    and add an Interceptor callback that adds headers before the request
    and returns a new response with the encoding headers removed
    and the body wrapped in decoding readers.
    
    This is strictly more correct than the okhttp3 built-in decoder
    because Content-Encoding can be a sequence of encodings applied in
    order that have to be decoded in reverse order.
    fishface60 committed Oct 22, 2024
    Configuration menu
    Copy the full SHA
    61307e0 View commit details
    Browse the repository at this point in the history