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 the mp4 mimetype #8773

Closed
verokarhu opened this issue Sep 18, 2014 · 8 comments

Comments

Projects
None yet
9 participants
@verokarhu
Copy link

commented Sep 18, 2014

What does 'go version' print?
Go 1.3.1

What steps reproduce the problem?

1. Write mp4 data to ResponseWriter

What happened?
The Content-Type header is set to "application/octet-stream"

What should have happened instead?
The Content-Type header is set to "video/mp4"
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Sep 18, 2014

Comment 1:

This is, as it happens, a TODO item in net/http/sniff.go.

Labels changed: added repo-main, release-none, suggested.

Status changed to Accepted.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015

@rsc rsc removed release-none labels Apr 10, 2015

@Francesco149

This comment has been minimized.

Copy link

commented Nov 16, 2015

any plans on implementing this yet? it would help a lot with stuff like file uploading tools that have to detect mime types.

@bradfitz

This comment has been minimized.

Copy link
Member

commented Nov 16, 2015

/cc @dsymonds

@dsymonds

This comment has been minimized.

Copy link
Member

commented Nov 16, 2015

Contributions welcome. I'm not planning to do it myself.

@dominikh

This comment has been minimized.

Copy link
Member

commented Nov 16, 2015

@dsymonds Any chance to get some input, though? Your todo reads "Re-enable this when the spec is sorted w.r.t. MP4." – Do you, by any chance, remember what had to be sorted? Only the little-endian <-> big-endian issue? I realise this code is 4 years old, so it might be hard to remember.

Also: The current version of the spec only looks for "mp4", not all the other types (iso, M4V, ...) that the original code checks for. How closely should the spec be followed here?

In order to follow the current version of the spec, only a number, and which strings to consider valid, need to be changed.

@dsymonds

This comment has been minimized.

Copy link
Member

commented Nov 16, 2015

I can't remember. I think at the time the spec didn't actually specify the MP4 string to match, but it looks like it does now. If you add a sniff.go entry for the MP4 string(s) that the spec specifies, that seems fine to me.

@odeke-em

This comment has been minimized.

Copy link
Member

commented Nov 17, 2015

@gopherbot

This comment has been minimized.

Copy link

commented Nov 17, 2015

CL https://golang.org/cl/16951 mentions this issue.

@bradfitz bradfitz closed this in 8b1152a Nov 17, 2015

@golang golang locked and limited conversation to collaborators Nov 16, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.