marcelduran/yslow — pull request #75 by soulgalore (2013-05-24 08:10:19+00:00)
Title: PhantomJS: always use absolute url, fix for @import relative CSS

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 http://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":"http://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"}}}
...