MCPcopy Create free account
hub / github.com/EasyIME/PIME / HostMatches

Class HostMatches

python/python3/tornado/routing.py:517–532  ·  view source on GitHub ↗

Matches requests from hosts specified by ``host_pattern`` regex.

Source from the content-addressed store, hash-verified

515
516
517class HostMatches(Matcher):
518 """Matches requests from hosts specified by ``host_pattern`` regex."""
519
520 def __init__(self, host_pattern: Union[str, Pattern]) -> None:
521 if isinstance(host_pattern, basestring_type):
522 if not host_pattern.endswith("$"):
523 host_pattern += "$"
524 self.host_pattern = re.compile(host_pattern)
525 else:
526 self.host_pattern = host_pattern
527
528 def match(self, request: httputil.HTTPServerRequest) -> Optional[Dict[str, Any]]:
529 if self.host_pattern.match(request.host_name):
530 return {}
531
532 return None
533
534
535class DefaultHostMatches(Matcher):

Callers 2

add_handlersMethod · 0.90
get_appMethod · 0.90

Calls

no outgoing calls

Tested by 1

get_appMethod · 0.72