multipart

package
v1.3.3-alpha12 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

rewrite multipart reader for compatibility with invalid boundary

Index

Constants

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

Variables

View Source
var (
	COLON              = []byte(":")
	CRLF               = []byte("\r\n")
	LF                 = []byte("\n")
	BoundaryStartOrEnd = []byte("--")

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

Functions

func BytesJoinSize

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

func GetPartEmptyLineNum

func GetPartEmptyLineNum(p *Part) uint8

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) Read

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

func (*Part) ReadRawHeader

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

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() []byte

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