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

Method encode_header

gunicorn/dirty/protocol.py:115–128  ·  view source on GitHub ↗

Encode the 16-byte message header. Args: msg_type: Message type (MSG_TYPE_REQUEST, etc.) request_id: Unique request identifier (uint64) payload_length: Length of the TLV-encoded payload Returns: bytes: 16-byte header

(msg_type: int, request_id: int, payload_length: int)

Source from the content-addressed store, hash-verified

113
114 @staticmethod
115 def encode_header(msg_type: int, request_id: int, payload_length: int) -> bytes:
116 """
117 Encode the 16-byte message header.
118
119 Args:
120 msg_type: Message type (MSG_TYPE_REQUEST, etc.)
121 request_id: Unique request identifier (uint64)
122 payload_length: Length of the TLV-encoded payload
123
124 Returns:
125 bytes: 16-byte header
126 """
127 return struct.pack(HEADER_FORMAT, MAGIC, VERSION, msg_type,
128 payload_length, request_id)
129
130 @staticmethod
131 def decode_header(data: bytes) -> tuple:

Callers 10

encode_requestMethod · 0.80
encode_responseMethod · 0.80
encode_errorMethod · 0.80
encode_chunkMethod · 0.80
encode_endMethod · 0.80
encode_statusMethod · 0.80
encode_manageMethod · 0.80
encode_stashMethod · 0.80
test_encode_headerMethod · 0.80
test_decode_headerMethod · 0.80

Calls

no outgoing calls

Tested by 2

test_encode_headerMethod · 0.64
test_decode_headerMethod · 0.64