~john-koepi/ubuntu/trusty/golang/default

« back to all changes in this revision

Viewing changes to src/pkg/mime/mediatype.go

  • Committer: Bazaar Package Importer
  • Author(s): Ondřej Surý
  • Date: 2011-08-03 17:04:59 UTC
  • mfrom: (14.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110803170459-wzd99m3567y80ila
Tags: 1:59-1
* Imported Upstream version 59
* Refresh patches to a new release
* Fix FTBFS on ARM (Closes: #634270)
* Update version.bash to work with Debian packaging and not hg
  repository

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
}
32
32
 
33
33
// ParseMediaType parses a media type value and any optional
34
 
// parameters, per RFC 1531.  Media types are the values in
35
 
// Content-Type and Content-Disposition headers (RFC 2183).  On
36
 
// success, ParseMediaType returns the media type converted to
37
 
// lowercase and trimmed of white space and a non-nil params.  On
38
 
// error, it returns an empty string and a nil params.
 
34
// parameters, per RFC 1521.  Media types are the values in
 
35
// Content-Type and Content-Disposition headers (RFC 2183).
 
36
// On success, ParseMediaType returns the media type converted
 
37
// to lowercase and trimmed of white space. The returned params
 
38
// is always a non-nil map. Params maps from the lowercase
 
39
// attribute to the attribute value with its case preserved.
 
40
// On error, it returns an empty string and a nil params.
39
41
func ParseMediaType(v string) (mediatype string, params map[string]string) {
40
42
        i := strings.Index(v, ";")
41
43
        if i == -1 {
132
134
}
133
135
 
134
136
func decode2231Enc(v string) string {
135
 
        sv := strings.Split(v, "'", 3)
 
137
        sv := strings.SplitN(v, "'", 3)
136
138
        if len(sv) != 3 {
137
139
                return ""
138
140
        }
211
213
        rest = rest[1:] // consume semicolon
212
214
        rest = strings.TrimLeftFunc(rest, unicode.IsSpace)
213
215
        param, rest = consumeToken(rest)
 
216
        param = strings.ToLower(param)
214
217
        if param == "" {
215
218
                return "", "", v
216
219
        }