]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: use top-level font media type
authorAgniva De Sarker <agnivade@yahoo.co.in>
Sun, 25 Mar 2018 17:06:33 +0000 (22:36 +0530)
committerBrad Fitzpatrick <bradfitz@golang.org>
Sun, 25 Mar 2018 17:36:45 +0000 (17:36 +0000)
RFC 8081 declares a top level font media type for all types of fonts.
Updating the mime types in sniffer to reflect the new changes.

Fixes #24524

Change-Id: Iba6cef4c5974e9930e14705720d42550ee87ba56
Reviewed-on: https://go-review.googlesource.com/102458
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/net/http/sniff.go
src/net/http/sniff_test.go

index b21bfab9ab2138c1376f3aeba4888243d8c9450f..1486d1346052e520131efee947b7539ef6b088bb 100644 (file)
@@ -136,11 +136,11 @@ var sniffSignatures = []sniffSig{
                mask: []byte("\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF"),
                ct:   "application/vnd.ms-fontobject",
        },
-       &exactSig{[]byte("\x00\x01\x00\x00"), "application/font-ttf"},
-       &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("\x00\x01\x00\x00"), "font/ttf"},
+       &exactSig{[]byte("OTTO"), "font/otf"},
+       &exactSig{[]byte("ttcf"), "font/collection"},
+       &exactSig{[]byte("wOFF"), "font/woff"},
+       &exactSig{[]byte("wOF2"), "font/woff2"},
 
        &exactSig{[]byte("\x1A\x45\xDF\xA3"), "video/webm"},
        &exactSig{[]byte("\x52\x61\x72\x20\x1A\x07\x00"), "application/x-rar-compressed"},
index 1aaa54181ac5b6485c9b75db2eb2ce7ef66b8528..b9e94886109066d18a763dde8c9556e8da8397a7 100644 (file)
@@ -58,13 +58,13 @@ var sniffTests = []struct {
 
        // Font types.
        // {"MS.FontObject", []byte("\x00\x00")},
-       {"TTF sample  I", []byte("\x00\x01\x00\x00\x00\x17\x01\x00\x00\x04\x01\x60\x4f"), "application/font-ttf"},
-       {"TTF sample II", []byte("\x00\x01\x00\x00\x00\x0e\x00\x80\x00\x03\x00\x60\x46"), "application/font-ttf"},
+       {"TTF sample  I", []byte("\x00\x01\x00\x00\x00\x17\x01\x00\x00\x04\x01\x60\x4f"), "font/ttf"},
+       {"TTF sample II", []byte("\x00\x01\x00\x00\x00\x0e\x00\x80\x00\x03\x00\x60\x46"), "font/ttf"},
 
-       {"OTTO sample  I", []byte("\x4f\x54\x54\x4f\x00\x0e\x00\x80\x00\x03\x00\x60\x42\x41\x53\x45"), "application/font-off"},
+       {"OTTO sample  I", []byte("\x4f\x54\x54\x4f\x00\x0e\x00\x80\x00\x03\x00\x60\x42\x41\x53\x45"), "font/otf"},
 
-       {"woff sample  I", []byte("\x77\x4f\x46\x46\x00\x01\x00\x00\x00\x00\x30\x54\x00\x0d\x00\x00"), "application/font-woff"},
-       {"woff2 sample", []byte("\x77\x4f\x46\x32\x00\x01\x00\x00\x00"), "application/font-woff2"},
+       {"woff sample  I", []byte("\x77\x4f\x46\x46\x00\x01\x00\x00\x00\x00\x30\x54\x00\x0d\x00\x00"), "font/woff"},
+       {"woff2 sample", []byte("\x77\x4f\x46\x32\x00\x01\x00\x00\x00"), "font/woff2"},
 }
 
 func TestDetectContentType(t *testing.T) {