check url match cookie's path
172733
function matchPath(ctx) {
    const pathname = parse(ctx).pathname;
    if (pathname.indexOf(cookie.path || '/') !== 0) {
      debug('cookie path not match');
      return false;
    }
    return true;
  }
1179252
public function matchesPath($path)
    {
        // RFC6265 http://tools.ietf.org/search/rfc6265#section-5.1.4
        // A request-path path-matches a given cookie-path if at least one of
        // the following conditions holds:

        // o  The cookie-path and the request-path are identical.
        if ($path == $this->getPath()) {
            return true;
        }

        $pos = stripos($path, $this->getPath());
        if ($pos === 0) {
            // o  The cookie-path is a prefix of the request-path, and the last
            // character of the cookie-path is %x2F ("/").
            if (substr($this->getPath(), -1, 1) === "/") {
                return true;
            }

            // o  The cookie-path is a prefix of the request-path, and the first
            // character of the request-path that is not included in the cookie-
            // path is a %x2F ("/") character.
            if (substr($path, strlen($this->getPath()), 1) === "/") {
                return true;
            }
        }

        return false;
    }
603200
def is_url(path):
        
        try:
            parse_result = urlparse(path)
            return all((parse_result.scheme, parse_result.netloc, parse_result.path))
        except ValueError:
            return False
1055596
def _ensure_url_has_path(self, url):
        
        inx = url.find('://')
        if inx > 0:
            rest = url[inx + 3:]
        elif url.startswith('//'):
            rest = url[2:]
        else:
            rest = url

        if '/' in rest:
            return url

        scheme, netloc, path, query, frag = urlsplit(url)
        if not path:
            path = '/'

        url = urlunsplit((scheme, netloc, path, query, frag))
        return url
894745
private function getCookiePath()
    {
        $path = dirname(parse_url($this->getCurrentUrl(), PHP_URL_PATH));

        if ('\\' === DIRECTORY_SEPARATOR) {
            $path = str_replace('\\', '/', $path);
        }

        return $path;
    }
201661
function(req) {
      if(!req || !req.url) return false;

      if(typeof(path) === 'string') {
        return (req.url).match(path) && ((req.url).match(path).index === 0);

      // RegExp
      } else {
        return (req.url).match(path) !== null;
      }
    }
1104338
function matchPaths(pageLinks, path) {
  let result;
  path = _.compact(path.split('/'));
  result = _.filter(_.keys(pageLinks), key => {
    const path2 = _.compact(key.split('/'));
    const noMatch = _.filter(path2, fragment => {
      return fragment.substring(0, 1) !== ':' && _.indexOf(path, fragment) !== _.indexOf(path2, fragment);
    });
    return noMatch.length === 0;
  });
  return result[0];
}
339779
def match_url(self, request):
        
        matched = False
        if self.exact_url:
            if re.match("%s$" % (self.url,), request.path):
                matched = True
        elif re.match("%s" % self.url, request.path):
            matched = True
        return matched
267465
def matches(self, request):
        
        return (
            partial_path_match(request.path_info, self.path) and
            request.method == self.method
        )
502464
private boolean matchesPath(String routePath, String pathToMatch) {
        routePath = PathKit.VAR_REGEXP_PATTERN.matcher(routePath).replaceAll(PathKit.VAR_REPLACE);
        return pathToMatch.matches("(?i)" + routePath);
    }
1340948
def match_path(entry, opts):
    """"""
    if entry.name in ALWAYS_OMIT:
        return False
    # TODO: currently we use fnmatch syntax and match against names.
    # We also might allow glob syntax and match against the whole relative path instead
    # path = entry.get_rel_path()
    path = entry.name
    ok = True
    match = opts.get("match")
    exclude = opts.get("exclude")
    if entry.is_file() and match:
        assert type(match) is list
        ok = False
        for pat in match:
            if fnmatch.fnmatch(path, pat):
                ok = True
                break
    if ok and exclude:
        assert type(exclude) is list
        for pat in exclude:
            if fnmatch.fnmatch(path, pat):
                ok = False
                break
    # write("match", ok, entry)
    return ok
92407
function match(path) {
    if (path.indexOf(prefix) !== 0) {
      return false;
    }

    const newPath = path.replace(prefix, '') || '/';
    if (trailingSlash) {
      return newPath;
    }

    if (newPath[0] !== '/') {
      return false;
    }

    return newPath;
  }
1215616
def return_ok(self, cookie, request):
        
        # Path has already been checked by .path_return_ok(), and domain
        # blocking done by .domain_return_ok().
        _debug(" - checking cookie %s=%s", cookie.name, cookie.value)

        for n in "version", "verifiability", "secure", "expires", "port", "domain":
            fn_name = "return_ok_"+n
            fn = getattr(self, fn_name)
            if not fn(cookie, request):
                return False
        return True
861916
function readCookie (cookiePath) {
  var cookie

  try {
    var c = fs.readFileSync(cookiePath)
    debug('loaded cookie', JSON.parse(c))
    var sid = c['connect-sid']
    debug('serialized', sid)
  } catch (e) {
    debug(e)
  }

  return cookie
}
1185119
function routeMatch(route, url) {
  const matcher = `^${route.replace(/(:\w+)/g, '([\\w-]+)')}$`
  return url.match(matcher)
}
221367
def check_cached_item(self, path):
        
        item_path = '%s/%s/%s' % (
                current_app.static_folder,
                self.cache_folder,
                path.strip('/')
            )

        if os.path.isfile(item_path):
            return '%s/%s/%s' % (current_app.static_url_path, self.cache_folder, path.strip('/'))
        else:
            return False
767559
function navigate(path, replace){
    if (replace)
      location.replace(location.pathname + '#' + path);
    else
      location.hash = path;

    if (started)
      checkUrl();
  }