Skip to content

net/textproto: can write binary header it can't read #60674

Description

@Jorropo

What version of Go are you using (go version)?

$ go version
go version go1.20.5 linux/amd64

Does this issue reproduce with the latest release?

  • b9baf44 (latest tip) yes
  • 1.20.5 (latest release) yes
  • 1.19.10 (latest previous release) no

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/hugo/.cache/go-build"
GOENV="/home/hugo/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/hugo/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/hugo/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/hugo/Documents/Scripts/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/hugo/Documents/Scripts/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20.5"
GCCGO="gccgo"
GOAMD64="v3"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/hugo/Documents/Scripts/go/src/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build4234151944=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Run https://go.dev/play/p/f3mNQX8WQf6.

What did you expect to see?

Hello, 世界

What did you see instead?

panic: malformed MIME header line: Test: this is a header � containing binary

goroutine 1 [running]:
main.main()
	/tmp/sandbox1871938318/prog.go:39 +0x2b7

git bisect

I bisected the issue a6642e6.

RFC 7230

I get that my original code was buggy given RFC 7230 however it was working fine before and isn't anymore which is a breaking change, that why I am raising the issue here.
If you maintainers decide this is a WONTFIX, at least we should convert this issue to something along the lines of net/textproto, mime/multipart: should error when writing invalid part header, it is not normal that I can write thoses broken headers but not read them, if anything this should be consistent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions