[REBOL] Re: URL comparisons
From: tomc:darkwing:uoregon at: 7-Apr-2003 16:48
I do not have a shorter way but I do have a way that addresses
a few more problems than a trailing slash...
canotical-url: func[ url /local t p q][
replace/all url "\" "/"
t: parse url "/"
while [p: find t ".."][remove remove back p]
while [p: find t "."][remove p]
p: find t ""
while [p <> q: find/last t ""][remove q]
for i 1 (length? t) - 1 1[append t/:i "/"]
to-url url-encode/re rejoin t
sorry in advance for the warts..
it was written at least a year ago when
I needed to solve the problem quickly
(ran in to relative paths causing infinate loops)
there are very likely better ways to do some parts
and I look forward to any improvements
On Mon, 7 Apr 2003, Hallvard Ystad