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-tar #32505

Open
coreydaley opened this issue Jun 9, 2019 · 4 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 tar file and ran net/http.DetectContentType on it
https://play.golang.org/p/6K9ve_L54ua

What did you expect to see?

application/x-tar

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/181419 mentions this issue: net/http: add application/x-tar detection to DetectContentType

@dmitshur dmitshur changed the title /net/http.DetectContentType does not detect application/x-tar net/http: DetectContentType does not detect application/x-tar Jun 9, 2019
@dmitshur dmitshur added this to the Go1.14 milestone Jun 9, 2019
@odeke-em

This comment has been minimized.

Copy link
Member

commented Jun 9, 2019

Just like in #32508 (comment), we get the signatures from https://mimesniff.spec.whatwg.org/ 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 review your CL @coreydaley.

@coreydaley

This comment has been minimized.

Copy link
Author

commented Jun 9, 2019

@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
@odeke-em odeke-em modified the milestones: Unreleased, Unplanned Oct 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.