module Multipart

Nested Classes and Modules

class ByteLimit

Tracks consumed bytes against an optional maximum.

class LimitError

Raised when multipart processing exceeds a configured limit.

module Escape

Utilities for escaping and unescaping field names and values in multipart data

class FormData

FormData class for handling multipart/form-data format used in HTTP forms. Extends Mixed to provide specific support for form fields with names and values.

module Header
class Headers

The header fields associated with a multipart body or part.

class IOPart

A part that contains IO content (files, streams, etc.).

class Mixed

Represents a multipart/mixed message. A composite part that contains multiple nested parts with a boundary separator.

class Parser

A parser for multipart data based on RFC 2046 and RFC 2387. Parses multipart bodies and provides an enumerable interface to access the parts.

class Part

Represents a part in a multipart message.

module Readable

Common operations for streaming readable multipart content.

class StringPart

A part that contains string content. Represents a multipart part with string data.

Definitions

def self.secure_boundary(prefix = nil, length = 24)

Generate a secure boundary string for multipart messages. Approximately 192 bits of entropy by default, which is sufficient for most applications.

Implementation

def self.secure_boundary(prefix = nil, length = 24)
	if prefix
		"#{prefix}-#{SecureRandom.urlsafe_base64(length, false)}"
	else
		SecureRandom.urlsafe_base64(length, false)
	end
end