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

Fix parsing of gzipped distant files #111

Merged
merged 2 commits into from Nov 9, 2015
Merged

Fix parsing of gzipped distant files #111

merged 2 commits into from Nov 9, 2015

Conversation

gmetais
Copy link
Contributor

@gmetais gmetais commented Nov 9, 2015

Hi!

Analyze-css fails to parse some files when they are compressed.

Some servers are misconfigured, they always return compressed content, even if the request doesn't contain the Accept-Encoding header. This leads to problems with analyze-css, which is not able to ungzip these files.

Example:

$ analyze-css --url=http://cdn.quilt.janrain.com/2.2.19/providers.css

"offenders": {
    "parsingErrors": [
      "missing '}' @ 1:120",
      "property missing ':' @ 1:125",
      "missing '}' @ 1:125",
      "property missing ':' @ 1:306",
      "missing '}' @ 1:306",
      "property missing ':' @ 2:226",
      "missing '}' @ 2:226",
      "missing '}' @ 2:305",
      "missing '}' @ 2:577",
      "missing '}' @ 3:24",
      "selector missing @ 3:24"
    ]
  }

While downloading the file and running a local test using --file instead of --url works without any parsing errors.

The fix adds compatibility with gzip and deflate to analyze-css.

I have also taken the liberty to add an Accept-Encoding:gzip, deflate header to the requests, to save a little bandwidth and speed-up analyze-css.

@macbre macbre added the bug label Nov 9, 2015
@macbre
Copy link
Owner

macbre commented Nov 9, 2015

Thanks for the fix! I guess the long term solution is to use a request like library for handling HTTP requests.

@macbre macbre added this to the Roadmap milestone Nov 9, 2015
macbre added a commit that referenced this pull request Nov 9, 2015
Fix parsing of gzipped distant files
@macbre macbre merged commit a9b8c95 into macbre:devel Nov 9, 2015
@macbre macbre modified the milestones: Roadmap, v0.11.0 Nov 9, 2015
macbre added a commit that referenced this pull request Apr 16, 2016
This reverts commit a9b8c95, reversing
changes made to 18d0923.

Conflicts:
	lib/runner.js
@macbre
Copy link
Owner

macbre commented Apr 16, 2016

See #120

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants