use URI.pm to do proper URL parsing.