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

Update utils.js #151

Closed
wants to merge 1 commit into from
Closed

Update utils.js #151

wants to merge 1 commit into from

Conversation

VisualFox
Copy link
Contributor

This fix an issue with zlib: unexpected end of file with node v7.2.1 - Follow the PR: More lenient gzip decompression #2492 request/request#2492 -

This fix an issue with zlib: unexpected end of file with node v7.2.1 - Follow the PR: More lenient gzip decompression #2492 request/request#2492 -
@VisualFox
Copy link
Contributor Author

With a more recent version of Node (7.2.1) Zlib was randomly throwing a "unexpected end of file" exception.

I think this PR summarise well the issue: request/request#2492
I simply ported this PR to iframely/lib/utils.js

My implementation is probably a bit naive (that just a simple copy and paste) but that fixed the issue. Let me know if you want me to re-factor the code differently.

@iparamonau
Copy link
Member

Thanks for the PR. We'll need a bit of time to carefully evaluate the issue.

@VisualFox
Copy link
Contributor Author

You are very welcome and that makes perfect sense to me. Let me know if I can help you.

The first step is probably to be able to reproduce the issue. I was getting these exceptions when testing google map and youtube, but even that was not consistent. I will say only a quarter of the requests were triggering the error. Also I was firing 10 requests in a rows, I am not sure if that was part of the problem, but I was trying to evaluate iframely in a production environment.

My fix is a bit naive too, as it was at the base more a hack to evaluate the issue. It works on my end but there are few different approach we can use.

One of them is to just pass these options:

var zlibOptions = {
flush: zlib.Z_SYNC_FLUSH,
finishFlush: zlib.Z_SYNC_FLUSH
};

to zlib.createUnzip()

I guess I didn't understand why your were using the same createUnzip method for both gzip and deflate mode, and that why I refactored the code this way.

@nleush
Copy link
Member

nleush commented Feb 24, 2017

Merged to develop.

@nleush nleush closed this Feb 24, 2017
@iparamonau
Copy link
Member

@VisualFox tested and accepted. Works well. Thanks for heads up!

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

3 participants