Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http: DetectContentType does not detect application/x-bzip2 #32508

Open
coreydaley opened this issue Jun 9, 2019 · 5 comments

Comments

@coreydaley
Copy link

commented Jun 9, 2019

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

$ go version
go version go1.12.5 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/cdaley/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/cdaley/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/golang"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/cdaley/Projects/github.com/offlinedocs/offlinedocs/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build110412641=/tmp/go-build -gno-record-gcc-switches"GOARCH="amd64"
GOBIN=""
GOCACHE="/home/cdaley/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/cdaley/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/golang"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/cdaley/Projects/github.com/offlinedocs/offlinedocs/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build110412641=/tmp/go-build -gno-record-gcc-switches"

What did you do?

extracted the first 512 bytes of a bzip2 file and ran net/http.DetectContentType on it
https://play.golang.org/p/u4WBPl0bsMS

What did you expect to see?

application/x-bzip2

What did you see instead?

application/octet-stream

@gopherbot

This comment has been minimized.

Copy link

commented Jun 9, 2019

Change https://golang.org/cl/181420 mentions this issue: net/http: add application/x-bzip2 detection to DetectContentType

@odeke-em odeke-em changed the title net/http.DetectContentType does not detect application/x-bzip2 net/http: DetectContentType does not detect application/x-bzip2 Jun 9, 2019
@odeke-em

This comment has been minimized.

Copy link
Member

commented Jun 9, 2019

Thank you for filing this issue @coreydaley!

So we get the signatures from https://mimesniff.spec.whatwg.org/#zip-based-mime-type so perhaps let's first file an issue on the Github issues https://github.com/whatwg/mimesniff and once that's agreed upon we'll LGTM your CL. Thank you.

@odeke-em

This comment has been minimized.

Copy link
Member

commented Sep 26, 2019

I am going to move this to the unreleased milestone since we are depending on browsers and the MIME working group to approve the signatures.

@odeke-em odeke-em modified the milestones: Go1.14, Unreleased Sep 26, 2019
@bradfitz bradfitz modified the milestones: Unreleased, Unplanned Oct 14, 2019
@bradfitz

This comment has been minimized.

Copy link
Member

commented Oct 14, 2019

@odeke-em, Unreleased is for code that's not included in Go releases. I changed to Unplanned. We can do this if the upstream spec is updated.

@odeke-em

This comment has been minimized.

Copy link
Member

commented Oct 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.