Skip to content

net/http: document, audit ProtocolError #17558

Closed
@bradfitz

Description

@bradfitz

https://golang.org/pkg/net/http/#ProtocolError is a bit of an oddball.

It's used a little:

$ git grep ProtocolError
httputil/persist.go:    ErrPersistEOF = &http.ProtocolError{ErrorString: "persistent connection closed"}
httputil/persist.go:    ErrClosed     = &http.ProtocolError{ErrorString: "connection closed by user"}
httputil/persist.go:    ErrPipeline   = &http.ProtocolError{ErrorString: "pipeline error"}
request.go:type ProtocolError struct {
request.go:func (err *ProtocolError) Error() string { return err.ErrorString }
request.go:     ErrHeaderTooLong        = &ProtocolError{"header too long"}
request.go:     ErrShortBody            = &ProtocolError{"entity body too short"}
request.go:     ErrNotSupported         = &ProtocolError{"feature not supported"}
request.go:     ErrUnexpectedTrailer    = &ProtocolError{"trailer header without chunked transfer encoding"}
request.go:     ErrMissingContentLength = &ProtocolError{"missing ContentLength in HEAD response"}
request.go:     ErrNotMultipart         = &ProtocolError{"request Content-Type isn't multipart/form-data"}
request.go:     ErrMissingBoundary      = &ProtocolError{"no multipart boundary param in Content-Type"}

Should it be used more? Are those error variables even used?

Check. If ProtocolError isn't consistently used and we don't want to make it so, document that it's not always used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions