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

Method _check_allowed_ip

gunicorn/uwsgi/message.py:70–83  ·  view source on GitHub ↗

Verify source IP is in the allowed list.

(self)

Source from the content-addressed store, hash-verified

68 self.set_body_reader()
69
70 def _check_allowed_ip(self):
71 """Verify source IP is in the allowed list."""
72 allow_ips = getattr(self.cfg, 'uwsgi_allow_ips', ['127.0.0.1', '::1'])
73
74 # UNIX sockets don't have IP addresses
75 if not isinstance(self.peer_addr, tuple):
76 return
77
78 # Wildcard allows all
79 if '*' in allow_ips:
80 return
81
82 if self.peer_addr[0] not in allow_ips:
83 raise ForbiddenUWSGIRequest(self.peer_addr[0])
84
85 def force_close(self):
86 """Force the connection to close after this request."""

Callers 2

__init__Method · 0.95
parseMethod · 0.80

Calls 1

Tested by

no test coverage detected