[PATCH] Accept file://localhost/ style urls as local

Jonathan S. Shapiro shap at eros-os.com
Sun Sep 9 01:59:22 CDT 2007


On Sat, 2007-09-08 at 23:03 -0700, Brendan Cully wrote:
> I'm still not convinced this isn't stillborn code. I have a feeling
> it's just as likely for applications to insert hostnames meant to be
> local but that don't reverse resolve as it is for them to deliberately
> constrain the host in file URL for safety (and that neither is
> common). The fact that one result is RFC compliant and one isn't is
> cold comfort.

Then I propose a simpler approach:

  allow    file:/path/to/file
  disallow file://host/path/to/file

Basically, if you aren't going to do host processing correctly, at least
raise an exception if the host part is present. That way you retain the
option to add the functionality later.

Also, it may be worthwhile to handle

  file:relative/path

but note that this is a non-standard extension. Once again, if you
choose not to implement it, fail all file: URI's that do not have at
least one leading / in their path component.


shap



More information about the Mercurial-devel mailing list