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

Method _send_error_response

gunicorn/asgi/protocol.py:1398–1409  ·  view source on GitHub ↗

Send an error response.

(self, status, message)

Source from the content-addressed store, hash-verified

1396 self._safe_write(body)
1397
1398 def _send_error_response(self, status, message):
1399 """Send an error response."""
1400 body = message.encode("utf-8")
1401 response = (
1402 f"HTTP/1.1 {status} {message}\r\n"
1403 f"Content-Type: text/plain\r\n"
1404 f"Content-Length: {len(body)}\r\n"
1405 f"Connection: close\r\n"
1406 f"\r\n"
1407 )
1408 self._safe_write(response.encode("latin-1"))
1409 self._safe_write(body)
1410
1411 def _get_reason_phrase(self, status):
1412 """Get HTTP reason phrase for status code."""

Callers 3

_handle_h1c_exceptionMethod · 0.95
_feed_callback_parserMethod · 0.95
_handle_http_requestMethod · 0.95

Calls 2

_safe_writeMethod · 0.95
encodeMethod · 0.80

Tested by

no test coverage detected