def rules.big

bend-kit-websocket@0.4.0.0 · websocket.bend:319

import bend-kit-websocket@0.4.0.0/websocket.bend as Websocket
import Base

319# The §5.2 and §5.5 rules on a frame header. No extension is in use, so RSV must be 0.
320# big: the payload is over 125 octets.
321def rules.big(+fin: Bool, +rsv: U32, +op: U32, big: Bool) -> Maybe<&1, U32 & String>:
322  first(reject(U32.is_ne(rsv, 0), 1002, "reserved bits set"),
323  first(reject(Bool.not(known(op)), 1002, "unknown opcode"),
324  first(reject(Bool.and(U32.is_ge(op, 8), Bool.not(fin)), 1002, "fragmented control frame"),
325    reject(Bool.and(U32.is_ge(op, 8), big), 1002, "control frame over 125 bytes"))))

Uses (12)

Used by (1)