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

PhantomJS: always use absolute url, fix for @import relative CSS #75

Closed
wants to merge 1 commit into from
Closed

PhantomJS: always use absolute url, fix for @import relative CSS #75

wants to merge 1 commit into from

Conversation

soulgalore
Copy link
Contributor

There is one defect when you fetch a site that is using @import in the CSS and the url is relative. The comp.href is relative, but the key is absolute.

If you run it like this:

phantomjs yslow.js https://www.cybercom.com/en/

The CSS that are imported

@import url("reset.css");
doesn't get the right response

...
{"type":"css","url":"http%3A%2F%2Fwww.cybercom.com%2FTemplates%2FCybercom%2FStyles%2Freset.css","size":0,"resp":null,"headers":{"response":{}}}
...

with the fix it looks like this:

...
{"type":"css","url":"http%3A%2F%2Fwww.cybercom.com%2FTemplates%2FCyberco\
m%2FStyles%2Freset.css","size":650,"resp":609,"expires":"2013/5/24","etag":"\"1C9A79A7F574E00\"","headers":{"request":{"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.8.1 Safari/534.34","Accept":"text/css,*/*;q=0.1","Referer":"https://www.cybercom.com/en/"},"response":{"Cache-Control":"public","Content-Length":"650","Content-Type":"text/css","Expires":"Fri, 24 May 2013 08:41:13 GMT","Last-Modified":"Wed, 18 Mar 2009 07:23:56 GMT","Accept-Ranges":"bytes","ETag":"\"1C9A79A7F574E00\"","Server":"Microsoft-IIS/6.0","X-Aspnet-Version":"2.0.50727","X-Powered-By":"ASP.NET","Date":"Fri, 24 May 2013 08:00:59 GMT"}}}
...

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

2 participants