Skip to content

Allow to explicitly inflate WebRequestConcern responses using deflate#2801

Open
dsander wants to merge 1 commit into
huginn:masterfrom
dsander:add-deflate-unzip-option
Open

Allow to explicitly inflate WebRequestConcern responses using deflate#2801
dsander wants to merge 1 commit into
huginn:masterfrom
dsander:add-deflate-unzip-option

Conversation

@dsander
Copy link
Copy Markdown
Collaborator

@dsander dsander commented May 26, 2020

Some website do not send the correct header values, the new option value
allows the user to explicitly inflate the response using deflate.

@dsander dsander requested a review from knu May 26, 2020 18:07
when 'gzip'.freeze
body.replace(ActiveSupport::Gzip.decompress(body))
when 'deflate'.freeze
body.replace(Zlib::Inflate.inflate(body))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have an experience that some Microsoft servers (not sure about the product and version) violating RFC used to return a raw deflate stream, and contributed a patch to faraday_middleware as shown below. You may need the same technique here.

lostisland/faraday_middleware@7ea9bd1

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for the hint. I think ill change our code to use the middleware in both cases.

Some website do not send the correct header values, the new option value
allows the user to explicitly inflate the response using deflate.
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.

2 participants