# File lib_core/rucy/request.rb, line 10
    def self.normalize(req_path)
      path, query = req_path.split(/\?/, 2)

      path.gsub!(/\+/, ' ')
      path.gsub!(/%([0-9A-Fa-f][0-9A-Fa-f])/) {|c| $1.hex.chr }

      while (path.gsub!(%r"/\./", '/'))
        # foo/./bar => foo/bar
      end
      while (path.gsub!(%r"[^/]+/\.\./", ''))
        # foo/../bar => bar
      end
      while (path.gsub!(%r"[^/]+/\.\.$", ''))
        # foo/bar/.. => foo/
      end
      while (path.gsub!(%r"^/\.\./", '/'))
        # /../foo => /foo
      end
      path.sub!(%r"/\.$", '/')  # foo/. => foo/
      path.sub!(%r"^/..$", '/') # /.. => /

      return path, query
    end