multipartkit/limit

Types

Limits applied during parsing to bound resource consumption.

All limits are inclusive: a value equal to the limit is allowed; the (limit + 1)-th byte / part triggers the error.

pub type Limits {
  Limits(
    max_body_bytes: Int,
    max_part_bytes: Int,
    max_parts: Int,
    max_header_bytes: Int,
  )
}

Constructors

  • Limits(
      max_body_bytes: Int,
      max_part_bytes: Int,
      max_parts: Int,
      max_header_bytes: Int,
    )

    Arguments

    max_body_bytes

    Total bytes consumed from input, including boundary delimiters, preamble, epilogue, and per-part header blocks. Triggers BodyTooLarge.

    max_part_bytes

    Bytes of a single part body excluding the part’s header block and the surrounding boundary lines. Triggers PartTooLarge.

    max_parts

    Maximum number of parts produced. Triggers TooManyParts when the (limit + 1)-th part is detected.

    max_header_bytes

    Total bytes of one part’s complete header block, measured from the byte after the boundary delimiter line up to and including the blank line that terminates the header block. Triggers HeaderTooLarge.

Values

pub fn default_limits() -> Limits

Conservative defaults used by parse and parse_stream when no explicit limits are supplied.

Search Document