multipart

package
v1.3.4-alpha9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

rewrite multipart reader for compatibility with invalid boundary

Index

Constants

View Source
const (
	FINDING_BOUNDARY     = 0
	BOUNDARY_MATCHED     = 1
	PARSING_BLOCK_HEADER = iota
	PARSING_BLOCK_BODY
	PART_FINISHED
	FINISHED
)

Variables

View Source
var (
	CRLF = []byte("\r\n")
	LF   = []byte("\n")

	ErrInvalidBoundary = utils.Error("multipart: invalid boundary")
)

Functions

func BytesJoinSize

func BytesJoinSize(size int, s ...[]byte) []byte

func NewWriter

func NewWriter(w io.Writer) *multipart.Writer

Types

type Part

type Part struct {
	Header textproto.MIMEHeader
	// contains filtered or unexported fields
}

func (*Part) FileName

func (p *Part) FileName(stricts ...bool) string

func (*Part) FormName

func (p *Part) FormName(stricts ...bool) string

func (*Part) GetHeader

func (p *Part) GetHeader(key string, canonicals ...bool) string

func (*Part) NoBody

func (p *Part) NoBody() bool

func (*Part) NoEmptyLineDivider

func (p *Part) NoEmptyLineDivider() bool

func (*Part) Read

func (p *Part) Read(data []byte) (n int, err error)

func (*Part) ReadRawHeader

func (p *Part) ReadRawHeader() ([]byte, error)

func (*Part) SetNoBody

func (p *Part) SetNoBody(noBody bool)

func (*Part) SetNoEmptyLineDivider

func (p *Part) SetNoEmptyLineDivider(b bool)

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

func NewReader

func NewReader(r io.Reader) *Reader

func NewReaderWithString

func NewReaderWithString(s string) *Reader

func (*Reader) Boundary

func (r *Reader) Boundary() string

func (*Reader) NextPart

func (r *Reader) NextPart() (*Part, error)

func (*Reader) NextRawPart

func (r *Reader) NextRawPart() (*Part, error)

func (*Reader) PartsRead

func (r *Reader) PartsRead() int

type Writer

type Writer = multipart.Writer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL