rails/rails — pull request #6625 by kylev (2012-06-04 20:04:23+00:00)
Title: Asset host doesn't recognize protocol agnostic "//" links.

It is common practice to use protocol-less URIs when serving a site from both http and https. This form ("//cdn.host/blah/foo.css") allows the same content to be served (and cached) for both normal and secure sites, leaving the user agent to resolve the protocol.

Currently, the asset host plumbing doesn't recognize this as a valid URI form (it is, says RFC 3986 section 4.2). If I specify my asset host of "//a.example.com/assets", loading asset "foo.png" results in an invalid URI "http:////a.example.com/assets/foo.png" on HTTP and "https:////a.example.com/assets/foo.png" on HTTPS.

This patch correctly recognizes my protocol-less URI as valid and doesn't attempt to add the proto.