Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
net/http: content type detection does not work correctly for some documents that start with HTML comments #25771
Some website documents start with "<!--[if IE]" or "<--comment with no space" and some close it without leaving an actual comment like this: "<!--->".
None of these cases are detected correctly because "<!--" htmlSig is treated like a regular HTML tag when in reality behaves slightly differently.
What version of Go are you using (
changed the title
net/http: content type detection does not work correctly for HTML comments
Jun 7, 2018
We follow the algorithm laid out at http://mimesniff.spec.whatwg.org/. According to it, the string
So this is working as intended. If you want this changed, I would suggest raising an issue at https://github.com/whatwg/mimesniff.