Skip to content
This repository was archived by the owner on May 30, 2023. It is now read-only.

PhantomJS does not like GZIP compression in some scenarios #10930

Closed
ariya opened this issue Dec 21, 2012 · 9 comments
Closed

PhantomJS does not like GZIP compression in some scenarios #10930

ariya opened this issue Dec 21, 2012 · 9 comments
Labels

Comments

@ariya
Copy link
Owner

ariya commented Dec 21, 2012

sahab.ya...@gmail.com commented:

Which version of PhantomJS are you using? 1.7.0 for Windows stock from the web-page.

What steps will reproduce the problem?
Run PhantomJS against a web server with a slightly malformed GZIP response stream (attached a sample VS 2010 project hooking into IIS Express 8.0 that demonstrates this problem) and watch PhantomJS fall over itself every now and then. I think this is because of two distinct WebKit related bugs:

  1. https://bugs.webkit.org/show_bug.cgi?id=58727
  2. https://bugreports.qt-project.org/browse/QTBUG-16022

But both of them seem to be fixed, so not sure if they are truly related.

I've attached a Visual Studio project which demonstrates the problem. I've configured it such that the server (IIS Express must be installed as well) sends back GZIPped content if the "X-Test-Runner" request header is not present and send back GZIPped content if the "X-Test-Runner" request header is present. When the content is GZIPed, then PhantomJS will sometimes throw an "$ is undefined" exception but sometimes work correctly. When the content is not GZIPed, then PhantomJS will work correctly.

Sorry if this bug report isn't exactly the clearest, I've had a hell of a time tracking down the problem and if you need any further details please do let me know.

Disclaimer:
This issue was migrated on 2013-03-15 from the project's former issue tracker on Google Code, Issue #930.
🌟   5 people had starred this issue at the time of migration.

@vitallium
Copy link
Collaborator

vitaliy....@gmail.com commented:

Ouch. PhantomJS 1.8 crashes!

@vitallium
Copy link
Collaborator

vitaliy....@gmail.com commented:

Crash dump attached. OS: Win 7 x64. IIS Express 7.5.
Command line: testrunner.js http://localhost:62097/index.html true

@ariya
Copy link
Owner Author

ariya commented Feb 16, 2013

descarta...@gmail.com commented:

i know this is not a support forum... but a workaround would be to add headers on the request saying we can't handle gzip. is this easy to do?

@ariya
Copy link
Owner Author

ariya commented Feb 16, 2013

sahab.ya...@gmail.com commented:

FWIW, that is the workaround that we are using right now. You can just configure Phantom with a bogus custom Accept-Encoding header using the customHeaders object: ttps://github.com/ariya/phantomjs/wiki/API-Reference-WebPage#wiki-webpage-customHeaders (and sorry for the support forum-esque answer :)

@autumnjolitz
Copy link

I was working on a MITM proxy and ran into this exact issue. I was decompressing the output but forgot to update the Content-Length header. It produced the same misleading Parse Error message. Chrome, Safari worked fine.

I'd ask if the Content-Length for the actual data in question is correct.

@paulyoung
Copy link

You can just configure Phantom with a bogus custom Accept-Encoding header

What would that header look like? I've tried Accept-Encoding: gzip;q=0

@adrianheine
Copy link

@paulyoung I'm using the following (took it from localnerve/html-snapshots@f99ddc5):

page.customHeaders = {
  "Accept-Encoding": "identity"
};

atdt added a commit to wikimedia/operations-puppet that referenced this issue Jul 23, 2015
* Set a custom Accept-Encoding header to avoid receiving compressed replies,
  which mess up our ability to compute payload size. See
  <ariya/phantomjs#10930> for details.
* Don't track the number of compressed responses. We no longer send a header
  indicating that we accept compressed responses, so we shouldn't be getting
  any, and hence the number will always be zero.
* Update payload size calculation code for
  <ariya/phantomjs#13195>. I re-packaged phantomjs on
  hafnium to include this patch.
* Conform with MediaWiki JavaScript code style.

Change-Id: I55cf5556867463a3315d74b213efb00231fa0b9b
@khebbie
Copy link

khebbie commented Apr 23, 2016

Hello!

You have a new message, please read http://risk-management979.tk/arm.php?j2s8

klaus@hebsgaard.dk

pocketjoso added a commit to pocketjoso/penthouse that referenced this issue Jan 16, 2017
to make it possible to resolve compression issues, see:
ariya/phantomjs#10930 (comment)
pocketjoso added a commit to pocketjoso/penthouse that referenced this issue Jan 16, 2017
pocketjoso added a commit to pocketjoso/penthouse that referenced this issue Jan 16, 2017
to make it possible to resolve compression issues, see:
ariya/phantomjs#10930 (comment)
pocketjoso added a commit to pocketjoso/penthouse that referenced this issue Jan 16, 2017
@ghost ghost removed old.Priority-Medium labels Dec 19, 2017
@stale stale bot added the stale label Dec 26, 2019
@stale
Copy link

stale bot commented Dec 29, 2019

Due to our very limited maintenance capacity (see #14541 for more details), we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed. In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!

@stale stale bot closed this as completed Dec 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants