-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
Z_DATA_ERROR on this site #14254
Comments
Hi @ile, the site is not sending gzipped data back to the client. Probably not related to Node or |
Hmm, if I do this: var request = require('request');
request({ url: 'http://www.marketsnare.com/', gzip: true }, (err, response, body) => {
if (err) {
console.error(err);
}
else {
console.log(body);
}
}); Then I get:
So, something is wrong...? |
It seems odd that looking at the Network tab in Chrome dev tools for the site, it indicates that the site is using gzip compression, but checking the site using https://checkgzipcompression.com/?url=http%3A%2F%2Fwww.marketsnare.com%2F, it says it is not using compression. |
@ile Your code works fine for me (no errors) with request 2.81.0. Can you update to 2.81.0? |
Actually, it works for me with 2.80.0 too. I wonder if you might be behind a proxy server or something? |
Also: @ile What happens if you try a more common URL, say |
Ok, this seems to work on another computer (Mac) but not on an Ubuntu 16.04 (two different machines). Here's the info of one of the Ubuntus: Linux pc 4.4.0-83-generic #106-Ubuntu SMP Mon Jun 26 17:54:43 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux So maybe it's OS/architecture dependent, not sure. I can test some more, but I have actually used this same code on production and it has worked for tens of thousands of urls before. This one url seems to be the only problematic so far. |
Interesting. Perhaps that site chooses not to compress (or compresses incorrectly) with certain User-Agent strings or something like that, ignoring the Accepts-Encoding header in those cases. It seems like a stretch, but it would explain the behavior you see along with the fact that I see the site compressing the payload when I look at headers in Chrome Dev Tools but I get "compression not implemented" when I use checkgzipcompression.com on the site. Actually, the fact that checkgzipcompression.com reports the site as not compressing makes me wonder if I should see if I can find out if they're using Node.js or not. If not, it's a good indication that the problem is with the site and nothing to do with Node.js. But if they are using Node.js, then that still leaves open the possibility of a Node.js or request bug in here somewhere. |
Occam's razor suggests a website bug more than anything else.
It identifies itself as Microsoft-IIS/8.5. |
Were anybody else able to reproduce this, or is it just me? |
I think @addaleax looked at it for a bit last week and might have even tried to reproduce it without |
I also could reproduce this on Ubuntu, but only with request < 2.80.0 (which makes sense to me, I supplied a fix to request 2.80.0 for something that may or may not be related to your problem). A wire capture, or even better a dump of the exact data that request passes to the gunzip stream, would be really helpful. |
Now everything seems to work, I'm not sure why. I can't reproduce this error anymore. Not with request 2.80.0 or 2.81.0 (I'm not sure when the 2.81.0 was released - I thought I was using the latest at the time of the bug report). So, I think this can be closed for now as it doesn't seem to happen anymore. |
I'll close it out, thanks for following up. |
Still encountering this issue. For a reproducable test case you can do the following:
In
Adding |
Any update on this issue? Some incorrect servers still do not work properly like this |
@rogierslag It’s hard to tell without extra information what kind of issue exactly you are seeing, but passing the a |
I get
Z_DATA_ERROR
on this url when requesting a page withrequest
and whengzip
istrue
: http://www.marketsnare.com/ ... so it seems compression related.Requesting the page without
gzip
works.I think this shouldn't happen.
Also reported this here: request/request#2713
The text was updated successfully, but these errors were encountered: