mirror of
https://github.com/smittix/intercept.git
synced 2026-04-24 06:40:00 -07:00
Add SSLZeroReturnError and SSLError to gevent's NOT_ERROR list so dropped TLS handshakes (browser preflight, plain HTTP to HTTPS port) don't print scary tracebacks to the console. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
22 lines
741 B
Python
22 lines
741 B
Python
"""Gunicorn configuration for INTERCEPT."""
|
|
|
|
|
|
def post_worker_init(worker):
|
|
"""Suppress noisy SystemExit tracebacks during gevent worker shutdown.
|
|
|
|
When gunicorn receives SIGINT, the gevent worker's handle_quit()
|
|
calls sys.exit(0) inside a greenlet. Gevent treats SystemExit as
|
|
an error by default and prints a traceback. Adding it to NOT_ERROR
|
|
silences this harmless noise.
|
|
"""
|
|
try:
|
|
import ssl
|
|
from gevent import get_hub
|
|
hub = get_hub()
|
|
suppress = (SystemExit, ssl.SSLZeroReturnError, ssl.SSLError)
|
|
for exc in suppress:
|
|
if exc not in hub.NOT_ERROR:
|
|
hub.NOT_ERROR = hub.NOT_ERROR + (exc,)
|
|
except Exception:
|
|
pass
|