MCPcopy
hub / github.com/benoitc/gunicorn / _is_valid_method

Method _is_valid_method

gunicorn/asgi/parser.py:799–810  ·  view source on GitHub ↗

Check if method is valid token with conventional restrictions.

(self, method)

Source from the content-addressed store, hash-verified

797 return False
798
799 def _is_valid_method(self, method):
800 """Check if method is valid token with conventional restrictions."""
801 if not method:
802 return False
803 # Check length (3-20 chars)
804 if not 3 <= len(method) <= 20:
805 return False
806 # Check for lowercase or # (unconventional)
807 for c in method:
808 if c in b'abcdefghijklmnopqrstuvwxyz#':
809 return False
810 return self._is_valid_token(method)
811
812 def _is_valid_token(self, data):
813 """Check if data contains only RFC 9110 token characters."""

Callers 1

_parse_request_lineMethod · 0.95

Calls 1

_is_valid_tokenMethod · 0.95

Tested by

no test coverage detected