module Multipart
Nested Classes and Modules
class ByteLimitTracks consumed bytes against an optional maximum.
class LimitErrorRaised when multipart processing exceeds a configured limit.
module EscapeUtilities for escaping and unescaping field names and values in multipart data
class FormDataFormData class for handling multipart/form-data format used in HTTP forms. Extends Mixed to provide specific support for form fields with names and values.
class HeadersThe header fields associated with a multipart body or part.
class IOPartA part that contains IO content (files, streams, etc.).
class MixedRepresents a multipart/mixed message. A composite part that contains multiple nested parts with a boundary separator.
class ParserA parser for multipart data based on RFC 2046 and RFC 2387. Parses multipart bodies and provides an enumerable interface to access the parts.
class PartRepresents a part in a multipart message.
module ReadableCommon operations for streaming readable multipart content.
class StringPartA 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