1 // Copyright 2013 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
13 var typeFiles
= []string{
17 func loadMimeFile(filename
string) {
18 f
, err
:= os
.Open(filename
)
24 scanner
:= bufio
.NewScanner(f
)
26 fields
:= strings
.Fields(scanner
.Text())
27 if len(fields
) <= 2 || fields
[0][0] != '.' {
30 if fields
[1] == "-" || fields
[2] == "-" {
33 setExtensionType(fields
[0], fields
[1]+"/"+fields
[2])
35 if err
:= scanner
.Err(); err
!= nil {
41 for _
, filename
:= range typeFiles
{
42 loadMimeFile(filename
)
46 func initMimeForTests() map[string]string {
47 typeFiles
= []string{"testdata/test.types.plan9"}
48 return map[string]string{
49 ".t1": "application/test",
50 ".t2": "text/test; charset=utf-8",