Re: remove dot segment

I would like to discuss one old problem of the remove_dot_segments function,
which is not yet solved as I know.

Following URIs are valid with the respect to the latest rfc2396bis:

file:/x/..//y
	scheme = "file"
	authority = not defined
	path = "/x/..//y"
	query = not defined
	fragment = not defined

file:x/..//y/
	scheme = "file"
	authority = not defined
	path = "x/..//y/"
	query = not defined
	fragment = not defined

The result of applying the remove_dot_segments function is in the first case
"file://y". Segment "y" is considered to be an authority instead a segment
of the path "//y".
The result in the second case is "file:/y/", where the path "/y/" is an
absolute path. It is not a relative path beginning with an empty segment (in
addition this is not allowed).

I suggest to treat with the empty segments of the form "//" in the same way
as with the segments "/./". If we replace in the input buffer every
occurence of "//" by "/./" before applying the remove_dot_segments function,
we get the intuitive result "file:/y" for the first case and "file:y/" for
the second. Other empty segments not appearing at the beginning, which don't
cause in general any troubles, are of course removed too. Empty segment at
the end of the path is the only one exception.

This approach solves problem with empty segment at the beginning of the path
and introduces a normalization form for URIs, which don't contain empty
segments.

Problem can occur only if for another schemes does not hold that empty
segments have the same meaning as dot segments.

Martin

Received on Friday, 19 November 2004 05:24:05 UTC