Skip to main content

validate_payload_protocol

Function validate_payload_protocol 

Source
pub fn validate_payload_protocol(
    ident: &str,
    raw: &[u8],
) -> Result<(), MessageProcessingError>
Expand description

Validate a decoded wire payload against GW_PICKLE_PROTOCOL.

Mirrors the ValueError arm of upstream Message.data_decode() (commit fee03a3): cPickle.loads() raises ValueError("unsupported pickle protocol: N") when a gateway running a newer Python emits a payload stamped with a protocol this side cannot read. Pickle protocol 2+ streams start with the PROTO opcode (\x80) followed by the protocol number; a number greater than the pinned gateway protocol is rejected with the same cause text so the mismatch is detected and reported instead of silently mis-decoded. Non-pickle payloads (no PROTO header) pass through unchanged.