Documentation
¶
Overview ¶
Package multipart implements MIME multipart parsing, as defined in RFC 2046.
The implementation is sufficient for HTTP (RFC 2388) and the multipart bodies generated by popular browsers.
Limits ¶
To protect against malicious inputs, this package sets limits on the size of the MIME data it processes.
Reader.NextPart and Reader.NextRawPart limit the number of headers in a part to 10000 and Reader.ReadForm limits the total number of headers in all FileHeaders to 10000. These limits may be adjusted with the GODEBUG=multipartmaxheaders=<values> setting.
Reader.ReadForm further limits the number of parts in a form to 1000. This limit may be adjusted with the GODEBUG=multipartmaxparts=<value> setting.
Index ¶
- Variables
- func FileContentDisposition(fieldname, filename string) string
- type File
- type FileHeader
- type Form
- type Part
- type Reader
- type Writer
- func (w *Writer) Boundary() string
- func (w *Writer) Close() error
- func (w *Writer) CreateFormField(fieldname string) (io.Writer, error)
- func (w *Writer) CreateFormFile(fieldname, filename string) (io.Writer, error)
- func (w *Writer) CreatePart(header textproto.MIMEHeader) (io.Writer, error)
- func (w *Writer) FormDataContentType() string
- func (w *Writer) SetBoundary(boundary string) error
- func (w *Writer) WriteField(fieldname, value string) error
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ErrMessageTooLarge = errors.New("multipart: message too large")
ErrMessageTooLarge is returned by ReadForm if the message form data is too large to be processed.
Functions ¶
func FileContentDisposition ¶ added in go1.25.0
FileContentDisposition returns the value of a Content-Disposition header with the provided field name and file name.
Types ¶
type File ¶
File is an interface to access the file part of a multipart message. Its contents may be either stored in memory or on disk. If stored on disk, the File's underlying concrete type will be an *os.File.
type FileHeader ¶
type FileHeader struct {
Filename string
Header textproto.MIMEHeader