URI handling of "//hostname.foo.com/" as base_uri
Ben Scott (scotsman@euphorion.com)
Wed, 18 Apr 2001 15:52:28 -0700
I'm working on some scripts to change URLs to "akamized" ARLs. The site
I'm working on has a number of files which are are used in both http and
https. The suggestion by Akamai on how to handle this is to leave off the
scheme portion of the URL, making it:
<a href="//a248.e.akamai.net/...">
instead of
<a href="http://a248.e.akamai.net/...">
This allows the browser to decide from the calling context whether to
use http or https. This is indeed part of the URI RFC (RFC2396).
Unfortunately the following does not work:
use URI;
$url = "images/foo.gif";
$base = "//a248.e.akamai.net/.../";
$arl = URI->new_abs($url,$base);
This results in the following error:
Warning: Use of "require" without parens is ambiguous at (eval 21) line 1, <IN> chunk 43.
eval 'requireURI:://a248_Oe_Oakamai_Onet/.../
;' called at /usr/local/lib/perl5/site_perl/5.005/URI.pm line 116
URI::implementor('//a248.e.akamai.net/f/.../') called at /usr/local/lib/perl5/site_perl/5.005/URI.pm line 53
URI::new('URI', 'images/foo.gif', '//a248.e.akamai.net/f/.../') called at /usr/local/lib/perl5/site_perl/5.005/URI.pm line 65
URI::new_abs('URI', '/images/foo.gif', '//a248.e.akamai.net/f/.../') called at update.new line 170
--
Ben Scott Office (408)894-6807
Comptroller of His Majesty's Fireworks as well as for War as for Triumph