Handle local file:/// paths on Windows

Windows can't handle a path like `/c:/foo`; when turning `file:///` URIs into local paths, we must strip the leading slash.  While we're handling `file:///` paths, also allow `file://localhost/`, since RFC1738 deems these identical:

> As a special case, <host> can be the string "localhost" or the empty
> string; this is interpreted as `the machine from which the URL is
> being interpreted'.

But also because I have a tendency to type it that way and it would sadden me if it failed.
This logic is going waaay above my head. Particularly the part where it sets `is_local` to false (when `is_local` is already false). Can you give this some thought and refactor it?