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

Class DefaultHostMatches

python/python3/tornado/routing.py:535–549  ·  view source on GitHub ↗

Matches requests from host that is equal to application's default_host. Always returns no match if ``X-Real-Ip`` header is present.

Source from the content-addressed store, hash-verified

533
534
535class DefaultHostMatches(Matcher):
536 """Matches requests from host that is equal to application's default_host.
537 Always returns no match if ``X-Real-Ip`` header is present.
538 """
539
540 def __init__(self, application: Any, host_pattern: Pattern) -> None:
541 self.application = application
542 self.host_pattern = host_pattern
543
544 def match(self, request: httputil.HTTPServerRequest) -> Optional[Dict[str, Any]]:
545 # Look for default host if not behind load balancer (for debugging)
546 if "X-Real-Ip" not in request.headers:
547 if self.host_pattern.match(self.application.default_host):
548 return {}
549 return None
550
551
552class PathMatches(Matcher):

Callers 1

add_handlersMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected