# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Shorten a URL in various ways.
sub URLtrim {
	local($url) = @_;
	local($org) = @_ if $V>3;
	$url =~ s"/%7E"/~"g;				# Reduce this encoding
	$url =~ s"\\"/"g;					# Some MS users use \ for /
	$url =~ s"(/.*)\#.*"$1";			# Strip off name references
#	$url =~ s"(/.*)\?.*"$1";			# Strip off qualifiers
#	$url =~ s"(/.*)\%.*"$1";			# What are these?
	while ($url =~ s"/\./"/") {}		# Strip out /./ self-references
	while ($url =~ s"/[^/]+/\.\./"/"){}	# Strip out /foo/../ up-references
	print V "URLtrim <= \"$org\"\n   => \"$url\"\n" if (($V>3) && ($url ne $org));
	$url;
}
1;
