Commit bf8eef2a authored by Agniva De Sarker's avatar Agniva De Sarker Committed by Brad Fitzpatrick

net/http: add sniffing support for woff2

Sniffing woff2 is now added to the spec -
https://github.com/whatwg/mimesniff/commit/e29b9f4a22843bf6c7f0177223b0147bc03e37f7

Change-Id: Ie63744454d0ee54ed0f985c2873d7eb20a14015a
Reviewed-on: https://go-review.googlesource.com/102455Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 5526ef1c
......@@ -140,6 +140,7 @@ var sniffSignatures = []sniffSig{
&exactSig{[]byte("OTTO"), "application/font-off"},
&exactSig{[]byte("ttcf"), "application/font-cff"},
&exactSig{[]byte("wOFF"), "application/font-woff"},
&exactSig{[]byte("wOF2"), "application/font-woff2"},
&exactSig{[]byte("\x1A\x45\xDF\xA3"), "video/webm"},
&exactSig{[]byte("\x52\x61\x72\x20\x1A\x07\x00"), "application/x-rar-compressed"},
......
......@@ -64,8 +64,7 @@ var sniffTests = []struct {
{"OTTO sample I", []byte("\x4f\x54\x54\x4f\x00\x0e\x00\x80\x00\x03\x00\x60\x42\x41\x53\x45"), "application/font-off"},
{"woff sample I", []byte("\x77\x4f\x46\x46\x00\x01\x00\x00\x00\x00\x30\x54\x00\x0d\x00\x00"), "application/font-woff"},
// Woff2 is not yet recognized, change this test once mime-sniff working group adds woff2
{"woff2 not recognized", []byte("\x77\x4f\x46\x32\x00\x01\x00\x00\x00"), "application/octet-stream"},
{"woff2 sample", []byte("\x77\x4f\x46\x32\x00\x01\x00\x00\x00"), "application/font-woff2"},
}
func TestDetectContentType(t *testing.T) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment