method
normalize_path
normalize_path(path)
private
Hide source
# File lib/webrick/httputils.rb, line 21 def normalize_path(path) raise "abnormal path `#{path}'" if path[0] != // ret = path.dup ret.gsub!(%{/+}, '/') # // => / while ret.sub!(%/\.(?:/|\Z)', '/'); end # /. => / while ret.sub!(%/(?!\.\./)[^/]+/\.\.(?:/|\Z)', '/'); end # /foo/.. => /foo raise "abnormal path `#{path}'" if %{/\.\.(/|\Z)} =~ ret ret end