Class FrameValidator

java.lang.Object
dev.relism.flash.http2.frame.FrameValidator

public final class FrameValidator extends Object
Table-driven RFC 9113 per-frame-type validation: length bounds, the stream-id required/forbidden/either rule, and the two special-cased structural rules (SETTINGS' multiple-of-6 length, PUSH_PROMISE always rejected from a client) that do not fit a class is the code that reads it.

The error code is not uniform — read the RFC per violation, not just per type. A SETTINGS frame with a bad length is FRAME_SIZE_ERROR; the same frame with a non-zero stream id is PROTOCOL_ERROR. This class throws the specific code each violation's own RFC citation requires, not a single blanket code per type.

  • Method Details

    • validate

      public static void validate(FrameHeader header, boolean insideHeaderBlock)
      Validates header against RFC 9113's rules for its type.
      Parameters:
      insideHeaderBlock - whether this frame arrived between a HEADERS/PUSH_PROMISE frame lacking END_HEADERS and its terminating CONTINUATION — changes the handling of an unrecognised type (§6.10: a PROTOCOL_ERROR, not the usual silent ignore, since an in-progress header block cannot tolerate an interloper frame of any kind without desynchronizing HPACK's stateful decode)
      Throws:
      Http2Exception - on any RFC violation, with the specific error code the violated rule mandates