myobie-mime-types 1.15.1 → 1.15.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1560 @@
1
+ #--
2
+ # MIME::Types for Ruby
3
+ # Version 1.15
4
+ #
5
+ # Copyright (c) 2002 - 2004 Austin Ziegler
6
+ #
7
+ # $Id$
8
+ #
9
+ # The ChangeLog contains all details on revisions.
10
+ #++
11
+
12
+ # The namespace for MIME applications, tools, and libraries.
13
+ module MIME
14
+ # Reflects a MIME Content-Type which is in invalid format (e.g., it isn't
15
+ # in the form of type/subtype).
16
+ class InvalidContentType < RuntimeError; end
17
+
18
+ # The definition of one MIME content-type.
19
+ #
20
+ # == Usage
21
+ # require 'mime/types'
22
+ #
23
+ # plaintext = MIME::Types['text/plain']
24
+ # print plaintext.media_type # => 'text'
25
+ # print plaintext.sub_type # => 'plain'
26
+ #
27
+ # puts plaintext.extensions.join(" ") # => 'asc txt c cc h hh cpp'
28
+ #
29
+ # puts plaintext.encoding # => 8bit
30
+ # puts plaintext.binary? # => false
31
+ # puts plaintext.ascii? # => true
32
+ # puts plaintext == 'text/plain' # => true
33
+ # puts MIME::Type.simplified('x-appl/x-zip') # => 'appl/zip'
34
+ #
35
+ class Type
36
+ VERSION = '1.15.2'
37
+
38
+ include Comparable
39
+
40
+ MEDIA_TYPE_RE = %r{([-\w.+]+)/([-\w.+]*)}o #:nodoc:
41
+ UNREG_RE = %r{[Xx]-}o #:nodoc:
42
+ ENCODING_RE = %r{(?:base64|7bit|8bit|quoted\-printable)}o #:nodoc:
43
+ PLATFORM_RE = %r|#{RUBY_PLATFORM}|o #:nodoc:
44
+
45
+ SIGNATURES = %w(application/pgp-keys application/pgp
46
+ application/pgp-signature application/pkcs10
47
+ application/pkcs7-mime application/pkcs7-signature
48
+ text/vcard) #:nodoc:
49
+
50
+ IANA_URL = "http://www.iana.org/assignments/media-types/%s/%s"
51
+ RFC_URL = "http://rfc-editor.org/rfc/rfc%s.txt"
52
+ DRAFT_URL = "http://datatracker.ietf.org/public/idindex.cgi?command=id_details&filename=%s"
53
+ LTSW_URL = "http://www.ltsw.se/knbase/internet/%s.htp"
54
+ CONTACT_URL = "http://www.iana.org/assignments/contact-people.htm#%s"
55
+
56
+ # Returns +true+ if the simplified type matches the current
57
+ def like?(other)
58
+ if other.respond_to?(:simplified)
59
+ @simplified == other.simplified
60
+ else
61
+ @simplified == Type.simplified(other)
62
+ end
63
+ end
64
+
65
+ # Compares the MIME::Type against the exact content type or the
66
+ # simplified type (the simplified type will be used if comparing against
67
+ # something that can be treated as a String with #to_s).
68
+ def <=>(other) #:nodoc:
69
+ if other.respond_to?(:content_type)
70
+ @content_type.downcase <=> other.content_type.downcase
71
+ elsif other.respond_to?(:to_s)
72
+ @simplified <=> Type.simplified(other.to_s)
73
+ else
74
+ @content_type.downcase <=> other.downcase
75
+ end
76
+ end
77
+
78
+ # Returns +true+ if the other object is a MIME::Type and the content
79
+ # types match.
80
+ def eql?(other) #:nodoc:
81
+ other.kind_of?(MIME::Type) and self == other
82
+ end
83
+
84
+ # Returns the whole MIME content-type string.
85
+ #
86
+ # text/plain => text/plain
87
+ # x-chemical/x-pdb => x-chemical/x-pdb
88
+ attr_reader :content_type
89
+ # Returns the media type of the simplified MIME type.
90
+ #
91
+ # text/plain => text
92
+ # x-chemical/x-pdb => chemical
93
+ attr_reader :media_type
94
+ # Returns the media type of the unmodified MIME type.
95
+ #
96
+ # text/plain => text
97
+ # x-chemical/x-pdb => x-chemical
98
+ attr_reader :raw_media_type
99
+ # Returns the sub-type of the simplified MIME type.
100
+ #
101
+ # text/plain => plain
102
+ # x-chemical/x-pdb => pdb
103
+ attr_reader :sub_type
104
+ # Returns the media type of the unmodified MIME type.
105
+ #
106
+ # text/plain => plain
107
+ # x-chemical/x-pdb => x-pdb
108
+ attr_reader :raw_sub_type
109
+ # The MIME types main- and sub-label can both start with <tt>x-</tt>,
110
+ # which indicates that it is a non-registered name. Of course, after
111
+ # registration this flag can disappear, adds to the confusing
112
+ # proliferation of MIME types. The simplified string has the <tt>x-</tt>
113
+ # removed and are translated to lowercase.
114
+ #
115
+ # text/plain => text/plain
116
+ # x-chemical/x-pdb => chemical/pdb
117
+ attr_reader :simplified
118
+ # The list of extensions which are known to be used for this MIME::Type.
119
+ # Non-array values will be coerced into an array with #to_a. Array
120
+ # values will be flattened and +nil+ values removed.
121
+ attr_accessor :extensions
122
+ remove_method :extensions= ;
123
+ def extensions=(ext) #:nodoc:
124
+ # COMPAT: no to_a for string in 1.9, so just wrap and flatten
125
+ @extensions = [ext].flatten.compact
126
+ end
127
+
128
+ # The encoding (7bit, 8bit, quoted-printable, or base64) required to
129
+ # transport the data of this content type safely across a network, which
130
+ # roughly corresponds to Content-Transfer-Encoding. A value of +nil+ or
131
+ # <tt>:default</tt> will reset the #encoding to the #default_encoding
132
+ # for the MIME::Type. Raises ArgumentError if the encoding provided is
133
+ # invalid.
134
+ #
135
+ # If the encoding is not provided on construction, this will be either
136
+ # 'quoted-printable' (for text/* media types) and 'base64' for eveything
137
+ # else.
138
+ attr_accessor :encoding
139
+ remove_method :encoding= ;
140
+ def encoding=(enc) #:nodoc:
141
+ if enc.nil? or enc == :default
142
+ @encoding = self.default_encoding
143
+ elsif enc =~ ENCODING_RE
144
+ @encoding = enc
145
+ else
146
+ raise ArgumentError, "The encoding must be nil, :default, base64, 7bit, 8bit, or quoted-printable."
147
+ end
148
+ end
149
+
150
+ # The regexp for the operating system that this MIME::Type is specific
151
+ # to.
152
+ attr_accessor :system
153
+ remove_method :system= ;
154
+ def system=(os) #:nodoc:
155
+ if os.nil? or os.kind_of?(Regexp)
156
+ @system = os
157
+ else
158
+ @system = %r|#{os}|
159
+ end
160
+ end
161
+ # Returns the default encoding for the MIME::Type based on the media
162
+ # type.
163
+ attr_reader :default_encoding
164
+ remove_method :default_encoding
165
+ def default_encoding
166
+ (@media_type == 'text') ? 'quoted-printable' : 'base64'
167
+ end
168
+
169
+ # Returns the media type or types that should be used instead of this
170
+ # media type, if it is obsolete. If there is no replacement media type,
171
+ # or it is not obsolete, +nil+ will be returned.
172
+ attr_reader :use_instead
173
+ remove_method :use_instead
174
+ def use_instead
175
+ return nil unless @obsolete
176
+ @use_instead
177
+ end
178
+
179
+ # Returns +true+ if the media type is obsolete.
180
+ def obsolete?
181
+ @obsolete ? true : false
182
+ end
183
+ # Sets the obsolescence indicator for this media type.
184
+ attr_writer :obsolete
185
+
186
+ # The documentation for this MIME::Type. Documentation about media
187
+ # types will be found on a media type definition as a comment.
188
+ # Documentation will be found through #docs.
189
+ attr_accessor :docs
190
+ remove_method :docs= ;
191
+ def docs=(d)
192
+ if d
193
+ a = d.scan(%r{use-instead:#{MEDIA_TYPE_RE}})
194
+
195
+ if a.empty?
196
+ @use_instead = nil
197
+ else
198
+ @use_instead = a.map { |el| "#{el[0]}/#{el[1]}" }
199
+ end
200
+ end
201
+ end
202
+
203
+ # The encoded URL list for this MIME::Type. See #urls for
204
+ attr_accessor :url
205
+ # The decoded URL list for this MIME::Type.
206
+ # The special URL value IANA will be translated into:
207
+ # http://www.iana.org/assignments/media-types/<mediatype>/<subtype>
208
+ #
209
+ # The special URL value RFC### will be translated into:
210
+ # http://www.rfc-editor.org/rfc/rfc###.txt
211
+ #
212
+ # The special URL value DRAFT:name will be translated into:
213
+ # https://datatracker.ietf.org/public/idindex.cgi?
214
+ # command=id_detail&filename=<name>
215
+ #
216
+ # The special URL value LTSW will be translated into:
217
+ # http://www.ltsw.se/knbase/internet/<mediatype>.htp
218
+ #
219
+ # The special URL value [token] will be translated into:
220
+ # http://www.iana.org/assignments/contact-people.htm#<token>
221
+ #
222
+ # These values will be accessible through #url, which always returns an
223
+ # array.
224
+ def urls
225
+ @url.map { |el|
226
+ case el
227
+ when %r{^IANA$}
228
+ IANA_URL % [ @media_type, @sub_type ]
229
+ when %r{^RFC(\d+)$}
230
+ RFC_URL % $1
231
+ when %r{^DRAFT:(.+)$}
232
+ DRAFT_URL % $1
233
+ when %r{^LTSW$}
234
+ LTSW_URL % @media_type
235
+ when %r{^\[([^\]]+)\]}
236
+ CONTACT_URL % $1
237
+ else
238
+ el
239
+ end
240
+ }
241
+ end
242
+
243
+ class << self
244
+ # The MIME types main- and sub-label can both start with <tt>x-</tt>,
245
+ # which indicates that it is a non-registered name. Of course, after
246
+ # registration this flag can disappear, adds to the confusing
247
+ # proliferation of MIME types. The simplified string has the
248
+ # <tt>x-</tt> removed and are translated to lowercase.
249
+ def simplified(content_type)
250
+ matchdata = MEDIA_TYPE_RE.match(content_type)
251
+
252
+ if matchdata.nil?
253
+ simplified = nil
254
+ else
255
+ media_type = matchdata.captures[0].downcase.gsub(UNREG_RE, '')
256
+ subtype = matchdata.captures[1].downcase.gsub(UNREG_RE, '')
257
+ simplified = "#{media_type}/#{subtype}"
258
+ end
259
+ simplified
260
+ end
261
+
262
+ # Creates a MIME::Type from an array in the form of:
263
+ # [type-name, [extensions], encoding, system]
264
+ #
265
+ # +extensions+, +encoding+, and +system+ are optional.
266
+ #
267
+ # MIME::Type.from_array("application/x-ruby", ['rb'], '8bit')
268
+ # MIME::Type.from_array(["application/x-ruby", ['rb'], '8bit'])
269
+ #
270
+ # These are equivalent to:
271
+ #
272
+ # MIME::Type.new('application/x-ruby') do |t|
273
+ # t.extensions = %w(rb)
274
+ # t.encoding = '8bit'
275
+ # end
276
+ def from_array(*args) #:yields MIME::Type.new:
277
+ # Dereferences the array one level, if necessary.
278
+ args = args[0] if args[0].kind_of?(Array)
279
+
280
+ if args.size.between?(1, 8)
281
+ m = MIME::Type.new(args[0]) do |t|
282
+ t.extensions = args[1] if args.size > 1
283
+ t.encoding = args[2] if args.size > 2
284
+ t.system = args[3] if args.size > 3
285
+ t.obsolete = args[4] if args.size > 4
286
+ t.docs = args[5] if args.size > 5
287
+ t.url = args[6] if args.size > 6
288
+ t.registered = args[7] if args.size > 7
289
+ end
290
+ yield m if block_given?
291
+ else
292
+ raise ArgumentError, "Array provided must contain between one and eight elements."
293
+ end
294
+ m
295
+ end
296
+
297
+ # Creates a MIME::Type from a hash. Keys are case-insensitive,
298
+ # dashes may be replaced with underscores, and the internal Symbol
299
+ # of the lowercase-underscore version can be used as well. That is,
300
+ # Content-Type can be provided as content-type, Content_Type,
301
+ # content_type, or :content_type.
302
+ #
303
+ # Known keys are <tt>Content-Type</tt>,
304
+ # <tt>Content-Transfer-Encoding</tt>, <tt>Extensions</tt>, and
305
+ # <tt>System</tt>.
306
+ #
307
+ # MIME::Type.from_hash('Content-Type' => 'text/x-yaml',
308
+ # 'Content-Transfer-Encoding' => '8bit',
309
+ # 'System' => 'linux',
310
+ # 'Extensions' => ['yaml', 'yml'])
311
+ #
312
+ # This is equivalent to:
313
+ #
314
+ # MIME::Type.new('text/x-yaml') do |t|
315
+ # t.encoding = '8bit'
316
+ # t.system = 'linux'
317
+ # t.extensions = ['yaml', 'yml']
318
+ # end
319
+ def from_hash(hash) #:yields MIME::Type.new:
320
+ type = {}
321
+ hash.each_pair do |k, v|
322
+ type[k.to_s.tr('-A-Z', '_a-z').to_sym] = v
323
+ end
324
+
325
+ m = MIME::Type.new(type[:content_type]) do |t|
326
+ t.extensions = type[:extensions]
327
+ t.encoding = type[:content_transfer_encoding]
328
+ t.system = type[:system]
329
+ t.obsolete = type[:obsolete]
330
+ t.docs = type[:docs]
331
+ t.url = type[:url]
332
+ t.registered = type[:registered]
333
+ end
334
+
335
+ yield m if block_given?
336
+ m
337
+ end
338
+
339
+ # Essentially a copy constructor.
340
+ #
341
+ # MIME::Type.from_mime_type(plaintext)
342
+ #
343
+ # is equivalent to:
344
+ #
345
+ # MIME::Type.new(plaintext.content_type.dup) do |t|
346
+ # t.extensions = plaintext.extensions.dup
347
+ # t.system = plaintext.system.dup
348
+ # t.encoding = plaintext.encoding.dup
349
+ # end
350
+ def from_mime_type(mime_type) #:yields the new MIME::Type:
351
+ m = MIME::Type.new(mime_type.content_type.dup) do |t|
352
+ t.extensions = mime_type.extensions.dup
353
+ t.system = mime_type.system.dup
354
+ t.encoding = mime_type.encoding.dup
355
+ end
356
+
357
+ yield m if block_given?
358
+ end
359
+ end
360
+
361
+ # Builds a MIME::Type object from the provided MIME Content Type value
362
+ # (e.g., 'text/plain' or 'applicaton/x-eruby'). The constructed object
363
+ # is yielded to an optional block for additional configuration, such as
364
+ # associating extensions and encoding information.
365
+ def initialize(content_type) #:yields self:
366
+ matchdata = MEDIA_TYPE_RE.match(content_type)
367
+
368
+ if matchdata.nil?
369
+ raise InvalidContentType, "Invalid Content-Type provided ('#{content_type}')"
370
+ end
371
+
372
+ @content_type = content_type
373
+ @raw_media_type = matchdata.captures[0]
374
+ @raw_sub_type = matchdata.captures[1]
375
+
376
+ @simplified = MIME::Type.simplified(@content_type)
377
+ matchdata = MEDIA_TYPE_RE.match(@simplified)
378
+ @media_type = matchdata.captures[0]
379
+ @sub_type = matchdata.captures[1]
380
+
381
+ self.extensions = nil
382
+ self.encoding = :default
383
+ self.system = nil
384
+ self.registered = true
385
+
386
+ yield self if block_given?
387
+ end
388
+
389
+ # MIME content-types which are not regestered by IANA nor defined in
390
+ # RFCs are required to start with <tt>x-</tt>. This counts as well for
391
+ # a new media type as well as a new sub-type of an existing media
392
+ # type. If either the media-type or the content-type begins with
393
+ # <tt>x-</tt>, this method will return +false+.
394
+ def registered?
395
+ if (@raw_media_type =~ UNREG_RE) || (@raw_sub_type =~ UNREG_RE)
396
+ false
397
+ else
398
+ @registered
399
+ end
400
+ end
401
+ attr_writer :registered #:nodoc:
402
+
403
+ # MIME types can be specified to be sent across a network in particular
404
+ # formats. This method returns +true+ when the MIME type encoding is set
405
+ # to <tt>base64</tt>.
406
+ def binary?
407
+ @encoding == 'base64'
408
+ end
409
+
410
+ # MIME types can be specified to be sent across a network in particular
411
+ # formats. This method returns +false+ when the MIME type encoding is
412
+ # set to <tt>base64</tt>.
413
+ def ascii?
414
+ not binary?
415
+ end
416
+
417
+ # Returns +true+ when the simplified MIME type is in the list of known
418
+ # digital signatures.
419
+ def signature?
420
+ SIGNATURES.include?(@simplified.downcase)
421
+ end
422
+
423
+ # Returns +true+ if the MIME::Type is specific to an operating system.
424
+ def system?
425
+ not @system.nil?
426
+ end
427
+
428
+ # Returns +true+ if the MIME::Type is specific to the current operating
429
+ # system as represented by RUBY_PLATFORM.
430
+ def platform?
431
+ system? and (RUBY_PLATFORM =~ @system)
432
+ end
433
+
434
+ # Returns +true+ if the MIME::Type specifies an extension list,
435
+ # indicating that it is a complete MIME::Type.
436
+ def complete?
437
+ not @extensions.empty?
438
+ end
439
+
440
+ # Returns the MIME type as a string.
441
+ def to_s
442
+ @content_type
443
+ end
444
+
445
+ # Returns the MIME type as a string for implicit conversions.
446
+ def to_str
447
+ @content_type
448
+ end
449
+
450
+ # Returns the MIME type as an array suitable for use with
451
+ # MIME::Type.from_array.
452
+ def to_a
453
+ [ @content_type, @extensions, @encoding, @system, @obsolete, @docs,
454
+ @url, registered? ]
455
+ end
456
+
457
+ # Returns the MIME type as an array suitable for use with
458
+ # MIME::Type.from_hash.
459
+ def to_hash
460
+ { 'Content-Type' => @content_type,
461
+ 'Content-Transfer-Encoding' => @encoding,
462
+ 'Extensions' => @extensions,
463
+ 'System' => @system,
464
+ 'Obsolete' => @obsolete,
465
+ 'Docs' => @docs,
466
+ 'URL' => @url,
467
+ 'Registered' => registered?,
468
+ }
469
+ end
470
+ end
471
+
472
+ # = MIME::Types
473
+ # MIME types are used in MIME-compliant communications, as in e-mail or
474
+ # HTTP traffic, to indicate the type of content which is transmitted.
475
+ # MIME::Types provides the ability for detailed information about MIME
476
+ # entities (provided as a set of MIME::Type objects) to be determined and
477
+ # used programmatically. There are many types defined by RFCs and vendors,
478
+ # so the list is long but not complete; don't hesitate to ask to add
479
+ # additional information. This library follows the IANA collection of MIME
480
+ # types (see below for reference).
481
+ #
482
+ # == Description
483
+ # MIME types are used in MIME entities, as in email or HTTP traffic. It is
484
+ # useful at times to have information available about MIME types (or,
485
+ # inversely, about files). A MIME::Type stores the known information about
486
+ # one MIME type.
487
+ #
488
+ # == Usage
489
+ # require 'mime/types'
490
+ #
491
+ # plaintext = MIME::Types['text/plain']
492
+ # print plaintext.media_type # => 'text'
493
+ # print plaintext.sub_type # => 'plain'
494
+ #
495
+ # puts plaintext.extensions.join(" ") # => 'asc txt c cc h hh cpp'
496
+ #
497
+ # puts plaintext.encoding # => 8bit
498
+ # puts plaintext.binary? # => false
499
+ # puts plaintext.ascii? # => true
500
+ # puts plaintext.obsolete? # => false
501
+ # puts plaintext.registered? # => true
502
+ # puts plaintext == 'text/plain' # => true
503
+ # puts MIME::Type.simplified('x-appl/x-zip') # => 'appl/zip'
504
+ #
505
+ # This module is built to conform to the MIME types of RFCs 2045 and 2231.
506
+ # It follows the official IANA registry at
507
+ # http://www.iana.org/assignments/media-types/ and
508
+ # ftp://ftp.iana.org/assignments/media-types with some unofficial types
509
+ # added from the the collection at
510
+ # http://www.ltsw.se/knbase/internet/mime.htp
511
+ #
512
+ # This is originally based on Perl MIME::Types by Mark Overmeer.
513
+ #
514
+ # = Author
515
+ # Copyright:: Copyright (c) 2002 - 2006 by Austin Ziegler
516
+ # <austin@rubyforge.org>
517
+ # Version:: 1.15
518
+ # Based On:: Perl
519
+ # MIME::Types[http://search.cpan.org/author/MARKOV/MIME-Types-1.15/MIME/Types.pm],
520
+ # Copyright (c) 2001 - 2005 by Mark Overmeer
521
+ # <mimetypes@overmeer.net>.
522
+ # Licence:: Ruby's, Perl Artistic, or GPL version 2 (or later)
523
+ # See Also:: http://www.iana.org/assignments/media-types/
524
+ # http://www.ltsw.se/knbase/internet/mime.htp
525
+ #
526
+ class Types
527
+ # The released version of Ruby MIME::Types
528
+ VERSION = '1.15'
529
+
530
+ # The data version.
531
+ attr_reader :data_version
532
+
533
+ def initialize(data_version = nil)
534
+ @type_variants = Hash.new { |h, k| h[k] = [] }
535
+ @extension_index = Hash.new { |h, k| h[k] = [] }
536
+ end
537
+
538
+ def add_type_variant(mime_type) #:nodoc:
539
+ @type_variants[mime_type.simplified] << mime_type
540
+ end
541
+
542
+ def index_extensions(mime_type) #:nodoc:
543
+ mime_type.extensions.each { |ext| @extension_index[ext] << mime_type }
544
+ end
545
+
546
+ @__types__ = self.new(VERSION)
547
+
548
+ # Returns a list of MIME::Type objects, which may be empty. The optional
549
+ # flag parameters are :complete (finds only complete MIME::Type objects)
550
+ # and :platform (finds only MIME::Types for the current platform). It is
551
+ # possible for multiple matches to be returned for either type (in the
552
+ # example below, 'text/plain' returns two values -- one for the general
553
+ # case, and one for VMS systems.
554
+ #
555
+ # puts "\nMIME::Types['text/plain']"
556
+ # MIME::Types['text/plain'].each { |t| puts t.to_a.join(", ") }
557
+ #
558
+ # puts "\nMIME::Types[/^image/, :complete => true]"
559
+ # MIME::Types[/^image/, :complete => true].each do |t|
560
+ # puts t.to_a.join(", ")
561
+ # end
562
+ def [](type_id, flags = {})
563
+ if type_id.kind_of?(Regexp)
564
+ matches = []
565
+ @type_variants.each_key do |k|
566
+ matches << @type_variants[k] if k =~ type_id
567
+ end
568
+ matches.flatten!
569
+ elsif type_id.kind_of?(MIME::Type)
570
+ matches = [type_id]
571
+ else
572
+ matches = @type_variants[MIME::Type.simplified(type_id)]
573
+ end
574
+
575
+ matches.delete_if { |e| not e.complete? } if flags[:complete]
576
+ matches.delete_if { |e| not e.platform? } if flags[:platform]
577
+ matches
578
+ end
579
+
580
+ # Return the list of MIME::Types which belongs to the file based on its
581
+ # filename extension. If +platform+ is +true+, then only file types that
582
+ # are specific to the current platform will be returned.
583
+ #
584
+ # puts "MIME::Types.type_for('citydesk.xml')
585
+ # => "#{MIME::Types.type_for('citydesk.xml')}"
586
+ # puts "MIME::Types.type_for('citydesk.gif')
587
+ # => "#{MIME::Types.type_for('citydesk.gif')}"
588
+ def type_for(filename, platform = false)
589
+ ext = filename.chomp.downcase.gsub(/.*\./o, '')
590
+ list = @extension_index[ext]
591
+ list.delete_if { |e| not e.platform? } if platform
592
+ list
593
+ end
594
+
595
+ # A synonym for MIME::Types.type_for
596
+ def of(filename, platform = false)
597
+ type_for(filename, platform)
598
+ end
599
+
600
+ # Add one or more MIME::Type objects to the set of known types. Each
601
+ # type should be experimental (e.g., 'application/x-ruby'). If the type
602
+ # is already known, a warning will be displayed.
603
+ #
604
+ # <b>Please inform the maintainer of this module when registered types
605
+ # are missing.</b>
606
+ def add(*types)
607
+ types.each do |mime_type|
608
+ if @type_variants.include?(mime_type.simplified)
609
+ if @type_variants[mime_type.simplified].include?(mime_type)
610
+ warn "Type #{mime_type} already registered as a variant of #{mime_type.simplified}."
611
+ end
612
+ end
613
+ add_type_variant(mime_type)
614
+ index_extensions(mime_type)
615
+ end
616
+ end
617
+
618
+ class <<self
619
+ def add_type_variant(mime_type) #:nodoc:
620
+ @__types__.add_type_variant(mime_type)
621
+ end
622
+
623
+ def index_extensions(mime_type) #:nodoc:
624
+ @__types__.index_extensions(mime_type)
625
+ end
626
+
627
+ # Returns a list of MIME::Type objects, which may be empty. The
628
+ # optional flag parameters are :complete (finds only complete
629
+ # MIME::Type objects) and :platform (finds only MIME::Types for the
630
+ # current platform). It is possible for multiple matches to be
631
+ # returned for either type (in the example below, 'text/plain' returns
632
+ # two values -- one for the general case, and one for VMS systems.
633
+ #
634
+ # puts "\nMIME::Types['text/plain']"
635
+ # MIME::Types['text/plain'].each { |t| puts t.to_a.join(", ") }
636
+ #
637
+ # puts "\nMIME::Types[/^image/, :complete => true]"
638
+ # MIME::Types[/^image/, :complete => true].each do |t|
639
+ # puts t.to_a.join(", ")
640
+ # end
641
+ def [](type_id, flags = {})
642
+ @__types__[type_id, flags]
643
+ end
644
+
645
+ # Return the list of MIME::Types which belongs to the file based on
646
+ # its filename extension. If +platform+ is +true+, then only file
647
+ # types that are specific to the current platform will be returned.
648
+ #
649
+ # puts "MIME::Types.type_for('citydesk.xml')
650
+ # => "#{MIME::Types.type_for('citydesk.xml')}"
651
+ # puts "MIME::Types.type_for('citydesk.gif')
652
+ # => "#{MIME::Types.type_for('citydesk.gif')}"
653
+ def type_for(filename, platform = false)
654
+ @__types__.type_for(filename, platform)
655
+ end
656
+
657
+ # A synonym for MIME::Types.type_for
658
+ def of(filename, platform = false)
659
+ @__types__.type_for(filename, platform)
660
+ end
661
+
662
+ # Add one or more MIME::Type objects to the set of known types. Each
663
+ # type should be experimental (e.g., 'application/x-ruby'). If the
664
+ # type is already known, a warning will be displayed.
665
+ #
666
+ # <b>Please inform the maintainer of this module when registered types
667
+ # are missing.</b>
668
+ def add(*types)
669
+ @__types__.add(*types)
670
+ end
671
+ end
672
+ end
673
+ end
674
+
675
+ # Build the type list
676
+ data_mime_type = <<MIME_TYPES
677
+ # What follows is the compiled list of known media types, IANA-registered
678
+ # ones first, one per line.
679
+ #
680
+ # [*][!][os:]mt/st[<ws>@ext][<ws>:enc][<ws>'url-list][<ws>=docs]
681
+ #
682
+ # == *
683
+ # An unofficial MIME type. This should be used if an only if the MIME type
684
+ # is not properly specified.
685
+ #
686
+ # == !
687
+ # An obsolete MIME type.
688
+ #
689
+ # == os:
690
+ # Platform-specific MIME type definition.
691
+ #
692
+ # == mt
693
+ # The media type.
694
+ #
695
+ # == st
696
+ # The media subtype.
697
+ #
698
+ # == <ws>@ext
699
+ # The list of comma-separated extensions.
700
+ #
701
+ # == <ws>:enc
702
+ # The encoding.
703
+ #
704
+ # == <ws>'url-list
705
+ # The list of comma-separated URLs.
706
+ #
707
+ # == <ws>=docs
708
+ # The documentation string.
709
+ #
710
+ # That is, everything except the media type and the subtype is optional.
711
+ #
712
+ # -- Austin Ziegler, 2006.02.12
713
+
714
+ # Registered: application/*
715
+ !application/xhtml-voice+xml 'DRAFT:draft-mccobb-xplusv-media-type
716
+ application/CSTAdata+xml 'IANA,[Ecma International Helpdesk]
717
+ application/EDI-Consent 'RFC1767
718
+ application/EDI-X12 'RFC1767
719
+ application/EDIFACT 'RFC1767
720
+ application/activemessage 'IANA,[Shapiro]
721
+ application/andrew-inset 'IANA,[Borenstein]
722
+ application/applefile :base64 'IANA,[Faltstrom]
723
+ application/atom+xml 'RFC4287
724
+ application/atomicmail 'IANA,[Borenstein]
725
+ application/batch-SMTP 'RFC2442
726
+ application/beep+xml 'RFC3080
727
+ application/cals-1840 'RFC1895
728
+ application/ccxml+xml 'DRAFT:draft-froumentin-voice-mediatypes
729
+ application/cnrp+xml 'RFCCNRP
730
+ application/commonground 'IANA,[Glazer]
731
+ application/conference-info+xml 'DRAFT:draft-ietf-sipping-conference-package
732
+ application/cpl+xml 'RFC3880
733
+ application/csta+xml 'IANA,[Ecma International Helpdesk]
734
+ application/cybercash 'IANA,[Eastlake]
735
+ application/dca-rft 'IANA,[Campbell]
736
+ application/dec-dx 'IANA,[Campbell]
737
+ application/dialog-info+xml 'DRAFT:draft-ietf-sipping-dialog-package
738
+ application/dicom 'RFC3240
739
+ application/dns 'RFC4027
740
+ application/dvcs 'RFC3029
741
+ application/ecmascript 'DRAFT:draft-hoehrmann-script-types
742
+ application/epp+xml 'RFC3730
743
+ application/eshop 'IANA,[Katz]
744
+ application/fastinfoset 'IANA,[ITU-T ASN.1 Rapporteur]
745
+ application/fastsoap 'IANA,[ITU-T ASN.1 Rapporteur]
746
+ application/fits 'RFC4047
747
+ application/font-tdpfr @pfr 'RFC3073
748
+ application/http 'RFC2616
749
+ application/hyperstudio @stk 'IANA,[Domino]
750
+ application/iges 'IANA,[Parks]
751
+ application/im-iscomposing+xml 'RFC3994
752
+ application/index 'RFC2652
753
+ application/index.cmd 'RFC2652
754
+ application/index.obj 'RFC2652
755
+ application/index.response 'RFC2652
756
+ application/index.vnd 'RFC2652
757
+ application/iotp 'RFC2935
758
+ application/ipp 'RFC2910
759
+ application/isup 'RFC3204
760
+ application/javascript 'DRAFT:draft-hoehrmann-script-types
761
+ application/kpml-request+xml 'DRAFT:draft-ietf-sipping-kpml
762
+ application/kpml-response+xml 'DRAFT:draft-ietf-sipping-kpml
763
+ application/mac-binhex40 @hqx :8bit 'IANA,[Faltstrom]
764
+ application/macwriteii 'IANA,[Lindner]
765
+ application/marc 'RFC2220
766
+ application/mathematica 'IANA,[Van Nostern]
767
+ application/mbox 'DRAFT:draft-hall-mime-app-mbox
768
+ application/mikey 'RFC3830
769
+ application/mp4 'DRAFT:draft-lim-mpeg4-mime
770
+ application/mpeg4-generic 'RFC3640
771
+ application/mpeg4-iod 'DRAFT:draft-lim-mpeg4-mime
772
+ application/mpeg4-iod-xmt 'DRAFT:draft-lim-mpeg4-mime
773
+ application/msword @doc,dot :base64 'IANA,[Lindner]
774
+ application/news-message-id 'RFC1036,[Spencer]
775
+ application/news-transmission 'RFC1036,[Spencer]
776
+ application/nss 'IANA,[Hammer]
777
+ application/ocsp-request 'RFC2560
778
+ application/ocsp-response 'RFC2560
779
+ application/octet-stream @bin,dms,lha,lzh,exe,class,ani,pgp :base64 'RFC2045,RFC2046
780
+ application/oda @oda 'RFC2045,RFC2046
781
+ application/ogg @ogg 'RFC3534
782
+ application/parityfec 'RFC3009
783
+ application/pdf @pdf :base64 'RFC3778
784
+ application/pgp-encrypted :7bit 'RFC3156
785
+ application/pgp-keys :7bit 'RFC3156
786
+ application/pgp-signature @sig :base64 'RFC3156
787
+ application/pidf+xml 'IANA,RFC3863
788
+ application/pkcs10 @p10 'RFC2311
789
+ application/pkcs7-mime @p7m,p7c 'RFC2311
790
+ application/pkcs7-signature @p7s 'RFC2311
791
+ application/pkix-cert @cer 'RFC2585
792
+ application/pkix-crl @crl 'RFC2585
793
+ application/pkix-pkipath @pkipath 'DRAFT:draft-ietf-tls-rfc3546bis
794
+ application/pkixcmp @pki 'RFC2510
795
+ application/pls+xml 'DRAFT:draft-froumentin-voice-mediatypes
796
+ application/poc-settings+xml 'DRAFT:draft-garcia-sipping-poc-isb-am
797
+ application/postscript @ai,eps,ps :8bit 'RFC2045,RFC2046
798
+ application/prs.alvestrand.titrax-sheet 'IANA,[Alvestrand]
799
+ application/prs.cww @cw,cww 'IANA,[Rungchavalnont]
800
+ application/prs.nprend @rnd,rct 'IANA,[Doggett]
801
+ application/prs.plucker 'IANA,[Janssen]
802
+ application/qsig 'RFC3204
803
+ application/rdf+xml @rdf 'RFC3870
804
+ application/reginfo+xml 'RFC3680
805
+ application/remote-printing 'IANA,RFC1486,[Rose]
806
+ application/resource-lists+xml 'DRAFT:draft-ietf-simple-xcap-list-usage
807
+ application/riscos 'IANA,[Smith]
808
+ application/rlmi+xml 'DRAFT:draft-ietf-simple-event-list
809
+ application/rls-services+xml 'DRAFT:draft-ietf-simple-xcap-list-usage
810
+ application/rtf @rtf 'IANA,[Lindner]
811
+ application/rtx 'DRAFT:draft-ietf-avt-rtp-retransmission
812
+ application/samlassertion+xml 'IANA,[OASIS Security Services Technical Committee (SSTC)]
813
+ application/samlmetadata+xml 'IANA,[OASIS Security Services Technical Committee (SSTC)]
814
+ application/sbml+xml 'RFC3823
815
+ application/sdp 'RFC2327
816
+ application/set-payment 'IANA,[Korver]
817
+ application/set-payment-initiation 'IANA,[Korver]
818
+ application/set-registration 'IANA,[Korver]
819
+ application/set-registration-initiation 'IANA,[Korver]
820
+ application/sgml @sgml 'RFC1874
821
+ application/sgml-open-catalog @soc 'IANA,[Grosso]
822
+ application/shf+xml 'RFC4194
823
+ application/sieve @siv 'RFC3028
824
+ application/simple-filter+xml 'DRAFT:draft-ietf-simple-filter-format
825
+ application/simple-message-summary 'RFC3842
826
+ application/slate 'IANA,[Crowley]
827
+ application/soap+fastinfoset 'IANA,[ITU-T ASN.1 Rapporteur]
828
+ application/soap+xml 'RFC3902
829
+ application/spirits-event+xml 'RFC3910
830
+ application/srgs 'DRAFT:draft-froumentin-voice-mediatypes
831
+ application/srgs+xml 'DRAFT:draft-froumentin-voice-mediatypes
832
+ application/ssml+xml 'DRAFT:draft-froumentin-voice-mediatypes
833
+ application/timestamp-query 'RFC3161
834
+ application/timestamp-reply 'RFC3161
835
+ application/tve-trigger 'IANA,[Welsh]
836
+ application/vemmi 'RFC2122
837
+ application/vnd.3M.Post-it-Notes 'IANA,[O'Brien]
838
+ application/vnd.3gpp.pic-bw-large @plb 'IANA,[Meredith]
839
+ application/vnd.3gpp.pic-bw-small @psb 'IANA,[Meredith]
840
+ application/vnd.3gpp.pic-bw-var @pvb 'IANA,[Meredith]
841
+ application/vnd.3gpp.sms @sms 'IANA,[Meredith]
842
+ application/vnd.FloGraphIt 'IANA,[Floersch]
843
+ application/vnd.Kinar @kne,knp,sdf 'IANA,[Thakkar]
844
+ application/vnd.Mobius.DAF 'IANA,[Kabayama]
845
+ application/vnd.Mobius.DIS 'IANA,[Kabayama]
846
+ application/vnd.Mobius.MBK 'IANA,[Devasia]
847
+ application/vnd.Mobius.MQY 'IANA,[Devasia]
848
+ application/vnd.Mobius.MSL 'IANA,[Kabayama]
849
+ application/vnd.Mobius.PLC 'IANA,[Kabayama]
850
+ application/vnd.Mobius.TXF 'IANA,[Kabayama]
851
+ application/vnd.Quark.QuarkXPress @qxd,qxt,qwd,qwt,qxl,qxb :8bit 'IANA,[Scheidler]
852
+ application/vnd.RenLearn.rlprint 'IANA,[Wick]
853
+ application/vnd.accpac.simply.aso 'IANA,[Leow]
854
+ application/vnd.accpac.simply.imp 'IANA,[Leow]
855
+ application/vnd.acucobol 'IANA,[Lubin]
856
+ application/vnd.acucorp @atc,acutc :7bit 'IANA,[Lubin]
857
+ application/vnd.adobe.xfdf @xfdf 'IANA,[Perelman]
858
+ application/vnd.aether.imp 'IANA,[Moskowitz]
859
+ application/vnd.amiga.ami @ami 'IANA,[Blumberg]
860
+ application/vnd.apple.installer+xml 'IANA,[Bierman]
861
+ application/vnd.audiograph 'IANA,[Slusanschi]
862
+ application/vnd.autopackage 'IANA,[Hearn]
863
+ application/vnd.blueice.multipass @mpm 'IANA,[Holmstrom]
864
+ application/vnd.bmi 'IANA,[Gotoh]
865
+ application/vnd.businessobjects 'IANA,[Imoucha]
866
+ application/vnd.cinderella @cdy 'IANA,[Kortenkamp]
867
+ application/vnd.claymore 'IANA,[Simpson]
868
+ application/vnd.commerce-battelle 'IANA,[Applebaum]
869
+ application/vnd.commonspace 'IANA,[Chandhok]
870
+ application/vnd.contact.cmsg 'IANA,[Patz]
871
+ application/vnd.cosmocaller @cmc 'IANA,[Dellutri]
872
+ application/vnd.criticaltools.wbs+xml @wbs 'IANA,[Spiller]
873
+ application/vnd.ctc-posml 'IANA,[Kohlhepp]
874
+ application/vnd.cups-postscript 'IANA,[Sweet]
875
+ application/vnd.cups-raster 'IANA,[Sweet]
876
+ application/vnd.cups-raw 'IANA,[Sweet]
877
+ application/vnd.curl @curl 'IANA,[Byrnes]
878
+ application/vnd.cybank 'IANA,[Helmee]
879
+ application/vnd.data-vision.rdz @rdz 'IANA,[Fields]
880
+ application/vnd.dna 'IANA,[Searcy]
881
+ application/vnd.dpgraph 'IANA,[Parker]
882
+ application/vnd.dreamfactory @dfac 'IANA,[Appleton]
883
+ application/vnd.dxr 'IANA,[Duffy]
884
+ application/vnd.ecdis-update 'IANA,[Buettgenbach]
885
+ application/vnd.ecowin.chart 'IANA,[Olsson]
886
+ application/vnd.ecowin.filerequest 'IANA,[Olsson]
887
+ application/vnd.ecowin.fileupdate 'IANA,[Olsson]
888
+ application/vnd.ecowin.series 'IANA,[Olsson]
889
+ application/vnd.ecowin.seriesrequest 'IANA,[Olsson]
890
+ application/vnd.ecowin.seriesupdate 'IANA,[Olsson]
891
+ application/vnd.enliven 'IANA,[Santinelli]
892
+ application/vnd.epson.esf 'IANA,[Hoshina]
893
+ application/vnd.epson.msf 'IANA,[Hoshina]
894
+ application/vnd.epson.quickanime 'IANA,[Gu]
895
+ application/vnd.epson.salt 'IANA,[Nagatomo]
896
+ application/vnd.epson.ssf 'IANA,[Hoshina]
897
+ application/vnd.ericsson.quickcall 'IANA,[Tidwell]
898
+ application/vnd.eudora.data 'IANA,[Resnick]
899
+ application/vnd.fdf 'IANA,[Zilles]
900
+ application/vnd.ffsns 'IANA,[Holstage]
901
+ application/vnd.fints 'IANA,[Hammann]
902
+ application/vnd.fluxtime.clip 'IANA,[Winter]
903
+ application/vnd.framemaker 'IANA,[Wexler]
904
+ application/vnd.fsc.weblaunch @fsc :7bit 'IANA,[D.Smith]
905
+ application/vnd.fujitsu.oasys 'IANA,[Togashi]
906
+ application/vnd.fujitsu.oasys2 'IANA,[Togashi]
907
+ application/vnd.fujitsu.oasys3 'IANA,[Okudaira]
908
+ application/vnd.fujitsu.oasysgp 'IANA,[Sugimoto]
909
+ application/vnd.fujitsu.oasysprs 'IANA,[Ogita]
910
+ application/vnd.fujixerox.ddd 'IANA,[Onda]
911
+ application/vnd.fujixerox.docuworks 'IANA,[Taguchi]
912
+ application/vnd.fujixerox.docuworks.binder 'IANA,[Matsumoto]
913
+ application/vnd.fut-misnet 'IANA,[Pruulmann]
914
+ application/vnd.genomatix.tuxedo @txd 'IANA,[Frey]
915
+ application/vnd.grafeq 'IANA,[Tupper]
916
+ application/vnd.groove-account 'IANA,[Joseph]
917
+ application/vnd.groove-help 'IANA,[Joseph]
918
+ application/vnd.groove-identity-message 'IANA,[Joseph]
919
+ application/vnd.groove-injector 'IANA,[Joseph]
920
+ application/vnd.groove-tool-message 'IANA,[Joseph]
921
+ application/vnd.groove-tool-template 'IANA,[Joseph]
922
+ application/vnd.groove-vcard 'IANA,[Joseph]
923
+ application/vnd.hbci @hbci,hbc,kom,upa,pkd,bpd 'IANA,[Hammann]
924
+ application/vnd.hcl-bireports 'IANA,[Serres]
925
+ application/vnd.hhe.lesson-player @les 'IANA,[Jones]
926
+ application/vnd.hp-HPGL @plt,hpgl 'IANA,[Pentecost]
927
+ application/vnd.hp-PCL 'IANA,[Pentecost]
928
+ application/vnd.hp-PCLXL 'IANA,[Pentecost]
929
+ application/vnd.hp-hpid 'IANA,[Gupta]
930
+ application/vnd.hp-hps 'IANA,[Aubrey]
931
+ application/vnd.httphone 'IANA,[Lefevre]
932
+ application/vnd.hzn-3d-crossword 'IANA,[Minnis]
933
+ application/vnd.ibm.MiniPay 'IANA,[Herzberg]
934
+ application/vnd.ibm.afplinedata 'IANA,[Buis]
935
+ application/vnd.ibm.electronic-media @emm 'IANA,[Tantlinger]
936
+ application/vnd.ibm.modcap 'IANA,[Hohensee]
937
+ application/vnd.ibm.rights-management @irm 'IANA,[Tantlinger]
938
+ application/vnd.ibm.secure-container @sc 'IANA,[Tantlinger]
939
+ application/vnd.informix-visionary 'IANA,[Gales]
940
+ application/vnd.intercon.formnet 'IANA,[Gurak]
941
+ application/vnd.intertrust.digibox 'IANA,[Tomasello]
942
+ application/vnd.intertrust.nncp 'IANA,[Tomasello]
943
+ application/vnd.intu.qbo 'IANA,[Scratchley]
944
+ application/vnd.intu.qfx 'IANA,[Scratchley]
945
+ application/vnd.ipunplugged.rcprofile @rcprofile 'IANA,[Ersson]
946
+ application/vnd.irepository.package+xml @irp 'IANA,[Knowles]
947
+ application/vnd.is-xpr 'IANA,[Natarajan]
948
+ application/vnd.japannet-directory-service 'IANA,[Fujii]
949
+ application/vnd.japannet-jpnstore-wakeup 'IANA,[Yoshitake]
950
+ application/vnd.japannet-payment-wakeup 'IANA,[Fujii]
951
+ application/vnd.japannet-registration 'IANA,[Yoshitake]
952
+ application/vnd.japannet-registration-wakeup 'IANA,[Fujii]
953
+ application/vnd.japannet-setstore-wakeup 'IANA,[Yoshitake]
954
+ application/vnd.japannet-verification 'IANA,[Yoshitake]
955
+ application/vnd.japannet-verification-wakeup 'IANA,[Fujii]
956
+ application/vnd.jisp @jisp 'IANA,[Deckers]
957
+ application/vnd.kahootz 'IANA,[Macdonald]
958
+ application/vnd.kde.karbon @karbon 'IANA,[Faure]
959
+ application/vnd.kde.kchart @chrt 'IANA,[Faure]
960
+ application/vnd.kde.kformula @kfo 'IANA,[Faure]
961
+ application/vnd.kde.kivio @flw 'IANA,[Faure]
962
+ application/vnd.kde.kontour @kon 'IANA,[Faure]
963
+ application/vnd.kde.kpresenter @kpr,kpt 'IANA,[Faure]
964
+ application/vnd.kde.kspread @ksp 'IANA,[Faure]
965
+ application/vnd.kde.kword @kwd,kwt 'IANA,[Faure]
966
+ application/vnd.kenameaapp @htke 'IANA,[DiGiorgio-Haag]
967
+ application/vnd.kidspiration @kia 'IANA,[Bennett]
968
+ application/vnd.koan 'IANA,[Cole]
969
+ application/vnd.liberty-request+xml 'IANA,[McDowell]
970
+ application/vnd.llamagraphics.life-balance.desktop @lbd 'IANA,[White]
971
+ application/vnd.llamagraphics.life-balance.exchange+xml @lbe 'IANA,[White]
972
+ application/vnd.lotus-1-2-3 @wks,123 'IANA,[Wattenberger]
973
+ application/vnd.lotus-approach 'IANA,[Wattenberger]
974
+ application/vnd.lotus-freelance 'IANA,[Wattenberger]
975
+ application/vnd.lotus-notes 'IANA,[Laramie]
976
+ application/vnd.lotus-organizer 'IANA,[Wattenberger]
977
+ application/vnd.lotus-screencam 'IANA,[Wattenberger]
978
+ application/vnd.lotus-wordpro 'IANA,[Wattenberger]
979
+ application/vnd.marlin.drm.mdcf 'IANA,[Ellison]
980
+ application/vnd.mcd @mcd 'IANA,[Gotoh]
981
+ application/vnd.mediastation.cdkey 'IANA,[Flurry]
982
+ application/vnd.meridian-slingshot 'IANA,[Wedel]
983
+ application/vnd.mfmp @mfm 'IANA,[Ikeda]
984
+ application/vnd.micrografx.flo @flo 'IANA,[Prevo]
985
+ application/vnd.micrografx.igx @igx 'IANA,[Prevo]
986
+ application/vnd.mif @mif 'IANA,[Wexler]
987
+ application/vnd.minisoft-hp3000-save 'IANA,[Bartram]
988
+ application/vnd.mitsubishi.misty-guard.trustweb 'IANA,[Tanaka]
989
+ application/vnd.mophun.application @mpn 'IANA,[Wennerstrom]
990
+ application/vnd.mophun.certificate @mpc 'IANA,[Wennerstrom]
991
+ application/vnd.motorola.flexsuite 'IANA,[Patton]
992
+ application/vnd.motorola.flexsuite.adsi 'IANA,[Patton]
993
+ application/vnd.motorola.flexsuite.fis 'IANA,[Patton]
994
+ application/vnd.motorola.flexsuite.gotap 'IANA,[Patton]
995
+ application/vnd.motorola.flexsuite.kmr 'IANA,[Patton]
996
+ application/vnd.motorola.flexsuite.ttc 'IANA,[Patton]
997
+ application/vnd.motorola.flexsuite.wem 'IANA,[Patton]
998
+ application/vnd.mozilla.xul+xml @xul 'IANA,[McDaniel]
999
+ application/vnd.ms-artgalry @cil 'IANA,[Slawson]
1000
+ application/vnd.ms-asf @asf 'IANA,[Fleischman]
1001
+ application/vnd.ms-cab-compressed @cab 'IANA,[Scarborough]
1002
+ application/vnd.ms-excel @xls,xlt :base64 'IANA,[Gill]
1003
+ application/vnd.ms-fontobject 'IANA,[Scarborough]
1004
+ application/vnd.ms-ims 'IANA,[Ledoux]
1005
+ application/vnd.ms-lrm @lrm 'IANA,[Ledoux]
1006
+ application/vnd.ms-powerpoint @ppt,pps,pot :base64 'IANA,[Gill]
1007
+ application/vnd.ms-project @mpp :base64 'IANA,[Gill]
1008
+ application/vnd.ms-tnef :base64 'IANA,[Gill]
1009
+ application/vnd.ms-works :base64 'IANA,[Gill]
1010
+ application/vnd.ms-wpl @wpl :base64 'IANA,[Plastina]
1011
+ application/vnd.mseq @mseq 'IANA,[Le Bodic]
1012
+ application/vnd.msign 'IANA,[Borcherding]
1013
+ application/vnd.music-niff 'IANA,[Butler]
1014
+ application/vnd.musician 'IANA,[Adams]
1015
+ application/vnd.nervana @ent,entity,req,request,bkm,kcm 'IANA,[Judkins]
1016
+ application/vnd.netfpx 'IANA,[Mutz]
1017
+ application/vnd.noblenet-directory 'IANA,[Solomon]
1018
+ application/vnd.noblenet-sealer 'IANA,[Solomon]
1019
+ application/vnd.noblenet-web 'IANA,[Solomon]
1020
+ application/vnd.nokia.landmark+wbxml 'IANA,[Nokia]
1021
+ application/vnd.nokia.landmark+xml 'IANA,[Nokia]
1022
+ application/vnd.nokia.landmarkcollection+xml 'IANA,[Nokia]
1023
+ application/vnd.nokia.radio-preset @rpst 'IANA,[Nokia]
1024
+ application/vnd.nokia.radio-presets @rpss 'IANA,[Nokia]
1025
+ application/vnd.novadigm.EDM 'IANA,[Swenson]
1026
+ application/vnd.novadigm.EDX 'IANA,[Swenson]
1027
+ application/vnd.novadigm.EXT 'IANA,[Swenson]
1028
+ application/vnd.obn 'IANA,[Hessling]
1029
+ application/vnd.omads-email+xml 'IANA,[OMA Data Synchronization Working Group]
1030
+ application/vnd.omads-file+xml 'IANA,[OMA Data Synchronization Working Group]
1031
+ application/vnd.omads-folder+xml 'IANA,[OMA Data Synchronization Working Group]
1032
+ application/vnd.osa.netdeploy 'IANA,[Klos]
1033
+ application/vnd.osgi.dp 'IANA,[Kriens]
1034
+ application/vnd.palm @prc,pdb,pqa,oprc :base64 'IANA,[Peacock]
1035
+ application/vnd.paos.xml 'IANA,[Kemp]
1036
+ application/vnd.pg.format 'IANA,[Gandert]
1037
+ application/vnd.pg.osasli 'IANA,[Gandert]
1038
+ application/vnd.piaccess.application-licence 'IANA,[Maneos]
1039
+ application/vnd.picsel @efif 'IANA,[Naccarato]
1040
+ application/vnd.powerbuilder6 'IANA,[Guy]
1041
+ application/vnd.powerbuilder6-s 'IANA,[Guy]
1042
+ application/vnd.powerbuilder7 'IANA,[Shilts]
1043
+ application/vnd.powerbuilder7-s 'IANA,[Shilts]
1044
+ application/vnd.powerbuilder75 'IANA,[Shilts]
1045
+ application/vnd.powerbuilder75-s 'IANA,[Shilts]
1046
+ application/vnd.preminet 'IANA,[Tenhunen]
1047
+ application/vnd.previewsystems.box 'IANA,[Smolgovsky]
1048
+ application/vnd.proteus.magazine 'IANA,[Hoch]
1049
+ application/vnd.publishare-delta-tree 'IANA,[Ben-Kiki]
1050
+ application/vnd.pvi.ptid1 @pti,ptid 'IANA,[Lamb]
1051
+ application/vnd.pwg-multiplexed 'RFC3391
1052
+ application/vnd.pwg-xhtml-print+xml 'IANA,[Wright]
1053
+ application/vnd.rapid 'IANA,[Szekely]
1054
+ application/vnd.ruckus.download 'IANA,[Harris]
1055
+ application/vnd.s3sms 'IANA,[Tarkkala]
1056
+ application/vnd.sealed.doc @sdoc,sdo,s1w 'IANA,[Petersen]
1057
+ application/vnd.sealed.eml @seml,sem 'IANA,[Petersen]
1058
+ application/vnd.sealed.mht @smht,smh 'IANA,[Petersen]
1059
+ application/vnd.sealed.net 'IANA,[Lambert]
1060
+ application/vnd.sealed.ppt @sppt,spp,s1p 'IANA,[Petersen]
1061
+ application/vnd.sealed.xls @sxls,sxl,s1e 'IANA,[Petersen]
1062
+ application/vnd.sealedmedia.softseal.html @stml,stm,s1h 'IANA,[Petersen]
1063
+ application/vnd.sealedmedia.softseal.pdf @spdf,spd,s1a 'IANA,[Petersen]
1064
+ application/vnd.seemail @see 'IANA,[Webb]
1065
+ application/vnd.sema 'IANA,[Hansson]
1066
+ application/vnd.shana.informed.formdata 'IANA,[Selzler]
1067
+ application/vnd.shana.informed.formtemplate 'IANA,[Selzler]
1068
+ application/vnd.shana.informed.interchange 'IANA,[Selzler]
1069
+ application/vnd.shana.informed.package 'IANA,[Selzler]
1070
+ application/vnd.smaf @mmf 'IANA,[Takahashi]
1071
+ application/vnd.sss-cod 'IANA,[Dani]
1072
+ application/vnd.sss-dtf 'IANA,[Bruno]
1073
+ application/vnd.sss-ntf 'IANA,[Bruno]
1074
+ application/vnd.street-stream 'IANA,[Levitt]
1075
+ application/vnd.sus-calendar @sus,susp 'IANA,[Niedfeldt]
1076
+ application/vnd.svd 'IANA,[Becker]
1077
+ application/vnd.swiftview-ics 'IANA,[Widener]
1078
+ application/vnd.syncml.+xml 'IANA,[OMA Data Synchronization Working Group]
1079
+ application/vnd.syncml.ds.notification 'IANA,[OMA Data Synchronization Working Group]
1080
+ application/vnd.triscape.mxs 'IANA,[Simonoff]
1081
+ application/vnd.trueapp 'IANA,[Hepler]
1082
+ application/vnd.truedoc 'IANA,[Chase]
1083
+ application/vnd.ufdl 'IANA,[Manning]
1084
+ application/vnd.uiq.theme 'IANA,[Ocock]
1085
+ application/vnd.uplanet.alert 'IANA,[Martin]
1086
+ application/vnd.uplanet.alert-wbxml 'IANA,[Martin]
1087
+ application/vnd.uplanet.bearer-choice 'IANA,[Martin]
1088
+ application/vnd.uplanet.bearer-choice-wbxml 'IANA,[Martin]
1089
+ application/vnd.uplanet.cacheop 'IANA,[Martin]
1090
+ application/vnd.uplanet.cacheop-wbxml 'IANA,[Martin]
1091
+ application/vnd.uplanet.channel 'IANA,[Martin]
1092
+ application/vnd.uplanet.channel-wbxml 'IANA,[Martin]
1093
+ application/vnd.uplanet.list 'IANA,[Martin]
1094
+ application/vnd.uplanet.list-wbxml 'IANA,[Martin]
1095
+ application/vnd.uplanet.listcmd 'IANA,[Martin]
1096
+ application/vnd.uplanet.listcmd-wbxml 'IANA,[Martin]
1097
+ application/vnd.uplanet.signal 'IANA,[Martin]
1098
+ application/vnd.vcx 'IANA,[T.Sugimoto]
1099
+ application/vnd.vectorworks 'IANA,[Pharr]
1100
+ application/vnd.vidsoft.vidconference @vsc :8bit 'IANA,[Hess]
1101
+ application/vnd.visio @vsd,vst,vsw,vss 'IANA,[Sandal]
1102
+ application/vnd.visionary @vis 'IANA,[Aravindakumar]
1103
+ application/vnd.vividence.scriptfile 'IANA,[Risher]
1104
+ application/vnd.vsf 'IANA,[Rowe]
1105
+ application/vnd.wap.sic @sic 'IANA,[WAP-Forum]
1106
+ application/vnd.wap.slc @slc 'IANA,[WAP-Forum]
1107
+ application/vnd.wap.wbxml @wbxml 'IANA,[Stark]
1108
+ application/vnd.wap.wmlc @wmlc 'IANA,[Stark]
1109
+ application/vnd.wap.wmlscriptc @wmlsc 'IANA,[Stark]
1110
+ application/vnd.webturbo @wtb 'IANA,[Rehem]
1111
+ application/vnd.wordperfect @wpd 'IANA,[Scarborough]
1112
+ application/vnd.wqd @wqd 'IANA,[Bostrom]
1113
+ application/vnd.wrq-hp3000-labelled 'IANA,[Bartram]
1114
+ application/vnd.wt.stf 'IANA,[Wohler]
1115
+ application/vnd.wv.csp+wbxml @wv 'IANA,[Salmi]
1116
+ application/vnd.wv.csp+xml :8bit 'IANA,[Ingimundarson]
1117
+ application/vnd.wv.ssp+xml :8bit 'IANA,[Ingimundarson]
1118
+ application/vnd.xara 'IANA,[Matthewman]
1119
+ application/vnd.xfdl 'IANA,[Manning]
1120
+ application/vnd.yamaha.hv-dic @hvd 'IANA,[Yamamoto]
1121
+ application/vnd.yamaha.hv-script @hvs 'IANA,[Yamamoto]
1122
+ application/vnd.yamaha.hv-voice @hvp 'IANA,[Yamamoto]
1123
+ application/vnd.yamaha.smaf-audio @saf 'IANA,[Shinoda]
1124
+ application/vnd.yamaha.smaf-phrase @spf 'IANA,[Shinoda]
1125
+ application/vnd.yellowriver-custom-menu 'IANA,[Yellow]
1126
+ application/vnd.zzazz.deck+xml 'IANA,[Hewett]
1127
+ application/voicexml+xml 'DRAFT:draft-froumentin-voice-mediatypes
1128
+ application/watcherinfo+xml @wif 'RFC3858
1129
+ application/whoispp-query 'RFC2957
1130
+ application/whoispp-response 'RFC2958
1131
+ application/wita 'IANA,[Campbell]
1132
+ application/wordperfect5.1 @wp5,wp 'IANA,[Lindner]
1133
+ application/x400-bp 'RFC1494
1134
+ application/xcap-att+xml 'DRAFT:draft-ietf-simple-xcap
1135
+ application/xcap-caps+xml 'DRAFT:draft-ietf-simple-xcap
1136
+ application/xcap-el+xml 'DRAFT:draft-ietf-simple-xcap
1137
+ application/xcap-error+xml 'DRAFT:draft-ietf-simple-xcap
1138
+ application/xhtml+xml @xhtml :8bit 'RFC3236
1139
+ application/xml @xml :8bit 'RFC3023
1140
+ application/xml-dtd :8bit 'RFC3023
1141
+ application/xml-external-parsed-entity 'RFC3023
1142
+ application/xmpp+xml 'RFC3923
1143
+ application/xop+xml 'IANA,[Nottingham]
1144
+ application/xv+xml 'DRAFT:draft-mccobb-xv-media-type
1145
+ application/zip @zip :base64 'IANA,[Lindner]
1146
+
1147
+ # Registered: audio/*
1148
+ !audio/vnd.qcelp 'IANA,RFC3625 =use-instead:audio/QCELP
1149
+ audio/32kadpcm 'RFC2421,RFC2422
1150
+ audio/3gpp @3gpp 'RFC3839,DRAFT:draft-gellens-bucket
1151
+ audio/3gpp2 'DRAFT:draft-garudadri-avt-3gpp2-mime
1152
+ audio/AMR @amr :base64 'RFC3267
1153
+ audio/AMR-WB @awb :base64 'RFC3267
1154
+ audio/BV16 'RFC4298
1155
+ audio/BV32 'RFC4298
1156
+ audio/CN 'RFC3389
1157
+ audio/DAT12 'RFC3190
1158
+ audio/DVI4 'RFC3555
1159
+ audio/EVRC @evc 'RFC3558
1160
+ audio/EVRC-QCP 'RFC3625
1161
+ audio/EVRC0 'RFC3558
1162
+ audio/G722 'RFC3555
1163
+ audio/G7221 'RFC3047
1164
+ audio/G723 'RFC3555
1165
+ audio/G726-16 'RFC3555
1166
+ audio/G726-24 'RFC3555
1167
+ audio/G726-32 'RFC3555
1168
+ audio/G726-40 'RFC3555
1169
+ audio/G728 'RFC3555
1170
+ audio/G729 'RFC3555
1171
+ audio/G729D 'RFC3555
1172
+ audio/G729E 'RFC3555
1173
+ audio/GSM 'RFC3555
1174
+ audio/GSM-EFR 'RFC3555
1175
+ audio/L16 @l16 'RFC3555
1176
+ audio/L20 'RFC3190
1177
+ audio/L24 'RFC3190
1178
+ audio/L8 'RFC3555
1179
+ audio/LPC 'RFC3555
1180
+ audio/MP4A-LATM 'RFC3016
1181
+ audio/MPA 'RFC3555
1182
+ audio/PCMA 'RFC3555
1183
+ audio/PCMU 'RFC3555
1184
+ audio/QCELP @qcp 'RFC3555'RFC3625
1185
+ audio/RED 'RFC3555
1186
+ audio/SMV @smv 'RFC3558
1187
+ audio/SMV-QCP 'RFC3625
1188
+ audio/SMV0 'RFC3558
1189
+ audio/VDVI 'RFC3555
1190
+ audio/VMR-WB 'DRAFT:draft-ietf-avt-rtp-vmr-wb,DRAFT:draft-ietf-avt-rtp-vmr-wb-extension
1191
+ audio/ac3 'RFC4184
1192
+ audio/amr-wb+ 'DRAFT:draft-ietf-avt-rtp-amrwbplus
1193
+ audio/basic @au,snd :base64 'RFC2045,RFC2046
1194
+ audio/clearmode 'RFC4040
1195
+ audio/dsr-es201108 'RFC3557
1196
+ audio/dsr-es202050 'RFC4060
1197
+ audio/dsr-es202211 'RFC4060
1198
+ audio/dsr-es202212 'RFC4060
1199
+ audio/iLBC 'RFC3952
1200
+ audio/mp4 'DRAFT:draft-lim-mpeg4-mime
1201
+ audio/mpa-robust 'RFC3119
1202
+ audio/mpeg @mpga,mp2,mp3 :base64 'RFC3003
1203
+ audio/mpeg4-generic 'RFC3640
1204
+ audio/parityfec 'RFC3009
1205
+ audio/prs.sid @sid,psid 'IANA,[Walleij]
1206
+ audio/rtx 'DRAFT:draft-ietf-avt-rtp-retransmission
1207
+ audio/t140c 'DRAFT:draft-ietf-avt-audio-t140c
1208
+ audio/telephone-event 'RFC2833
1209
+ audio/tone 'RFC2833
1210
+ audio/vnd.3gpp.iufp 'IANA,[Belling]
1211
+ audio/vnd.audiokoz 'IANA,[DeBarros]
1212
+ audio/vnd.cisco.nse 'IANA,[Kumar]
1213
+ audio/vnd.cmles.radio-events 'IANA,[Goulet]
1214
+ audio/vnd.cns.anp1 'IANA,[McLaughlin]
1215
+ audio/vnd.cns.inf1 'IANA,[McLaughlin]
1216
+ audio/vnd.digital-winds @eol :7bit 'IANA,[Strazds]
1217
+ audio/vnd.dlna.adts 'IANA,[Heredia]
1218
+ audio/vnd.everad.plj @plj 'IANA,[Cicelsky]
1219
+ audio/vnd.lucent.voice @lvp 'IANA,[Vaudreuil]
1220
+ audio/vnd.nokia.mobile-xmf @mxmf 'IANA,[Nokia Corporation]
1221
+ audio/vnd.nortel.vbk @vbk 'IANA,[Parsons]
1222
+ audio/vnd.nuera.ecelp4800 @ecelp4800 'IANA,[Fox]
1223
+ audio/vnd.nuera.ecelp7470 @ecelp7470 'IANA,[Fox]
1224
+ audio/vnd.nuera.ecelp9600 @ecelp9600 'IANA,[Fox]
1225
+ audio/vnd.octel.sbc 'IANA,[Vaudreuil]
1226
+ audio/vnd.rhetorex.32kadpcm 'IANA,[Vaudreuil]
1227
+ audio/vnd.sealedmedia.softseal.mpeg @smp3,smp,s1m 'IANA,[Petersen]
1228
+ audio/vnd.vmx.cvsd 'IANA,[Vaudreuil]
1229
+
1230
+ # Registered: image/*
1231
+ image/cgm 'IANA =Computer Graphics Metafile [Francis]
1232
+ image/fits 'RFC4047
1233
+ image/g3fax 'RFC1494
1234
+ image/gif @gif :base64 'RFC2045,RFC2046
1235
+ image/ief @ief :base64 'RFC1314 =Image Exchange Format
1236
+ image/jp2 @jp2 :base64 'IANA,RFC3745
1237
+ image/jpeg @jpeg,jpg,jpe :base64 'RFC2045,RFC2046
1238
+ image/jpm @jpm :base64 'IANA,RFC3745
1239
+ image/jpx @jpx :base64 'IANA,RFC3745
1240
+ image/naplps 'IANA,[Ferber]
1241
+ image/png @png :base64 'IANA,[Randers-Pehrson]
1242
+ image/prs.btif 'IANA,[Simon]
1243
+ image/prs.pti 'IANA,[Laun]
1244
+ image/t38 'RFC3362
1245
+ image/tiff @tiff,tif :base64 'RFC3302 =Tag Image File Format
1246
+ image/tiff-fx 'RFC3950 =Tag Image File Format Fax eXtended
1247
+ image/vnd.adobe.photoshop 'IANA,[Scarborough]
1248
+ image/vnd.cns.inf2 'IANA,[McLaughlin]
1249
+ image/vnd.djvu @djvu,djv 'IANA,[Bottou]
1250
+ image/vnd.dwg @dwg 'IANA,[Moline]
1251
+ image/vnd.dxf 'IANA,[Moline]
1252
+ image/vnd.fastbidsheet 'IANA,[Becker]
1253
+ image/vnd.fpx 'IANA,[Spencer]
1254
+ image/vnd.fst 'IANA,[Fuldseth]
1255
+ image/vnd.fujixerox.edmics-mmr 'IANA,[Onda]
1256
+ image/vnd.fujixerox.edmics-rlc 'IANA,[Onda]
1257
+ image/vnd.globalgraphics.pgb @pgb 'IANA,[Bailey]
1258
+ image/vnd.microsoft.icon @ico 'IANA,[Butcher]
1259
+ image/vnd.mix 'IANA,[Reddy]
1260
+ image/vnd.ms-modi @mdi 'IANA,[Vaughan]
1261
+ image/vnd.net-fpx 'IANA,[Spencer]
1262
+ image/vnd.sealed.png @spng,spn,s1n 'IANA,[Petersen]
1263
+ image/vnd.sealedmedia.softseal.gif @sgif,sgi,s1g 'IANA,[Petersen]
1264
+ image/vnd.sealedmedia.softseal.jpg @sjpg,sjp,s1j 'IANA,[Petersen]
1265
+ image/vnd.svf 'IANA,[Moline]
1266
+ image/vnd.wap.wbmp @wbmp 'IANA,[Stark]
1267
+ image/vnd.xiff 'IANA,[S.Martin]
1268
+
1269
+ # Registered: message/*
1270
+ message/CPIM 'RFC3862
1271
+ message/delivery-status 'RFC1894
1272
+ message/disposition-notification 'RFC2298
1273
+ message/external-body :8bit 'RFC2046
1274
+ message/http 'RFC2616
1275
+ message/news :8bit 'RFC1036,[H.Spencer]
1276
+ message/partial :8bit 'RFC2046
1277
+ message/rfc822 :8bit 'RFC2046
1278
+ message/s-http 'RFC2660
1279
+ message/sip 'RFC3261
1280
+ message/sipfrag 'RFC3420
1281
+ message/tracking-status 'RFC3886
1282
+
1283
+ # Registered: model/*
1284
+ model/iges @igs,iges 'IANA,[Parks]
1285
+ model/mesh @msh,mesh,silo 'RFC2077
1286
+ model/vnd.dwf 'IANA,[Pratt]
1287
+ model/vnd.flatland.3dml 'IANA,[Powers]
1288
+ model/vnd.gdl 'IANA,[Babits]
1289
+ model/vnd.gs-gdl 'IANA,[Babits]
1290
+ model/vnd.gtw 'IANA,[Ozaki]
1291
+ model/vnd.mts 'IANA,[Rabinovitch]
1292
+ model/vnd.parasolid.transmit.binary @x_b,xmt_bin 'IANA,[Parasolid]
1293
+ model/vnd.parasolid.transmit.text @x_t,xmt_txt :quoted-printable 'IANA,[Parasolid]
1294
+ model/vnd.vtu 'IANA,[Rabinovitch]
1295
+ model/vrml @wrl,vrml 'RFC2077
1296
+
1297
+ # Registered: multipart/*
1298
+ multipart/alternative :8bit 'RFC2045,RFC2046
1299
+ multipart/appledouble :8bit 'IANA,[Faltstrom]
1300
+ multipart/byteranges 'RFC2068
1301
+ multipart/digest :8bit 'RFC2045,RFC2046
1302
+ multipart/encrypted 'RFC1847
1303
+ multipart/form-data 'RFC2388
1304
+ multipart/header-set 'IANA,[Crocker]
1305
+ multipart/mixed :8bit 'RFC2045,RFC2046
1306
+ multipart/parallel :8bit 'RFC2045,RFC2046
1307
+ multipart/related 'RFC2387
1308
+ multipart/report 'RFC1892
1309
+ multipart/signed 'RFC1847
1310
+ multipart/voice-message 'RFC2421,RFC2423
1311
+
1312
+ # Registered: text/*
1313
+ !text/ecmascript 'DRAFT:draft-hoehrmann-script-types
1314
+ !text/javascript 'DRAFT:draft-hoehrmann-script-types
1315
+ text/calendar 'RFC2445
1316
+ text/css @css :8bit 'RFC2318
1317
+ text/csv @csv :8bit 'RFC4180
1318
+ text/directory 'RFC2425
1319
+ text/dns 'RFC4027
1320
+ text/enriched 'RFC1896
1321
+ text/html @html,htm,htmlx,shtml,htx :8bit 'RFC2854
1322
+ text/parityfec 'RFC3009
1323
+ text/plain @txt,asc,c,cc,h,hh,cpp,hpp,dat,hlp 'RFC2046,RFC3676
1324
+ text/prs.fallenstein.rst @rst 'IANA,[Fallenstein]
1325
+ text/prs.lines.tag 'IANA,[Lines]
1326
+ text/RED 'RFC4102
1327
+ text/rfc822-headers 'RFC1892
1328
+ text/richtext @rtx :8bit 'RFC2045,RFC2046
1329
+ text/rtf @rtf :8bit 'IANA,[Lindner]
1330
+ text/rtx 'DRAFT:draft-ietf-avt-rtp-retransmission
1331
+ text/sgml @sgml,sgm 'RFC1874
1332
+ text/t140 'RFC4103
1333
+ text/tab-separated-values @tsv 'IANA,[Lindner]
1334
+ text/troff @t,tr,roff,troff :8bit 'DRAFT:draft-lilly-text-troff
1335
+ text/uri-list 'RFC2483
1336
+ text/vnd.abc 'IANA,[Allen]
1337
+ text/vnd.curl 'IANA,[Byrnes]
1338
+ text/vnd.DMClientScript 'IANA,[Bradley]
1339
+ text/vnd.esmertec.theme-descriptor 'IANA,[Eilemann]
1340
+ text/vnd.fly 'IANA,[Gurney]
1341
+ text/vnd.fmi.flexstor 'IANA,[Hurtta]
1342
+ text/vnd.in3d.3dml 'IANA,[Powers]
1343
+ text/vnd.in3d.spot 'IANA,[Powers]
1344
+ text/vnd.IPTC.NewsML '[IPTC]
1345
+ text/vnd.IPTC.NITF '[IPTC]
1346
+ text/vnd.latex-z 'IANA,[Lubos]
1347
+ text/vnd.motorola.reflex 'IANA,[Patton]
1348
+ text/vnd.ms-mediapackage 'IANA,[Nelson]
1349
+ text/vnd.net2phone.commcenter.command @ccc 'IANA,[Xie]
1350
+ text/vnd.sun.j2me.app-descriptor @jad :8bit 'IANA,[G.Adams]
1351
+ text/vnd.wap.si @si 'IANA,[WAP-Forum]
1352
+ text/vnd.wap.sl @sl 'IANA,[WAP-Forum]
1353
+ text/vnd.wap.wml @wml 'IANA,[Stark]
1354
+ text/vnd.wap.wmlscript @wmls 'IANA,[Stark]
1355
+ text/xml @xml,dtd :8bit 'RFC3023
1356
+ text/xml-external-parsed-entity 'RFC3023
1357
+ vms:text/plain @doc :8bit
1358
+
1359
+ # Registered: video/*
1360
+ video/3gpp @3gp,3gpp 'RFC3839,DRAFT:draft-gellens-mime-bucket
1361
+ video/3gpp-tt 'DRAFT:draft-ietf-avt-rtp-3gpp-timed-text
1362
+ video/3gpp2 'DRAFT:draft-garudadri-avt-3gpp2-mime
1363
+ video/BMPEG 'RFC3555
1364
+ video/BT656 'RFC3555
1365
+ video/CelB 'RFC3555
1366
+ video/DV 'RFC3189
1367
+ video/H261 'RFC3555
1368
+ video/H263 'RFC3555
1369
+ video/H263-1998 'RFC3555
1370
+ video/H263-2000 'RFC3555
1371
+ video/H264 'RFC3984
1372
+ video/JPEG 'RFC3555
1373
+ video/MJ2 @mj2,mjp2 'RFC3745
1374
+ video/MP1S 'RFC3555
1375
+ video/MP2P 'RFC3555
1376
+ video/MP2T 'RFC3555
1377
+ video/mp4 'DRAFT:draft-lim-mpeg4-mime
1378
+ video/MP4V-ES 'RFC3016
1379
+ video/mpeg @mp2,mpe,mp3g,mpg :base64 'RFC2045,RFC2046
1380
+ video/mpeg4-generic 'RFC3640
1381
+ video/MPV 'RFC3555
1382
+ video/nv 'RFC3555
1383
+ video/parityfec 'RFC3009
1384
+ video/pointer 'RFC2862
1385
+ video/quicktime @qt,mov :base64 'IANA,[Lindner]
1386
+ video/raw 'RFC4175
1387
+ video/rtx 'DRAFT:draft-ietf-avt-rtp-retransmission
1388
+ video/SMPTE292M 'RFC3497
1389
+ video/vnd.dlna.mpeg-tts 'IANA,[Heredia]
1390
+ video/vnd.fvt 'IANA,[Fuldseth]
1391
+ video/vnd.motorola.video 'IANA,[McGinty]
1392
+ video/vnd.motorola.videop 'IANA,[McGinty]
1393
+ video/vnd.mpegurl @mxu,m4u :8bit 'IANA,[Recktenwald]
1394
+ video/vnd.nokia.interleaved-multimedia @nim 'IANA,[Kangaslampi]
1395
+ video/vnd.objectvideo @mp4 'IANA,[Clark]
1396
+ video/vnd.sealed.mpeg1 @s11 'IANA,[Petersen]
1397
+ video/vnd.sealed.mpeg4 @smpg,s14 'IANA,[Petersen]
1398
+ video/vnd.sealed.swf @sswf,ssw 'IANA,[Petersen]
1399
+ video/vnd.sealedmedia.softseal.mov @smov,smo,s1q 'IANA,[Petersen]
1400
+ video/vnd.vivo @viv,vivo 'IANA,[Wolfe]
1401
+
1402
+ # Unregistered: application/*
1403
+ !application/x-troff 'LTSW =use-instead:text/troff
1404
+ application/x-bcpio @bcpio 'LTSW
1405
+ application/x-compressed @z,Z :base64 'LTSW
1406
+ application/x-cpio @cpio :base64 'LTSW
1407
+ application/x-csh @csh :8bit 'LTSW
1408
+ application/x-dvi @dvi :base64 'LTSW
1409
+ application/x-gtar @gtar,tgz,tbz2,tbz :base64 'LTSW
1410
+ application/x-gzip @gz :base64 'LTSW
1411
+ application/x-hdf @hdf 'LTSW
1412
+ application/x-java-archive @jar 'LTSW
1413
+ application/x-java-jnlp-file @jnlp 'LTSW
1414
+ application/x-java-serialized-object @ser 'LTSW
1415
+ application/x-java-vm @class 'LTSW
1416
+ application/x-latex @ltx,latex :8bit 'LTSW
1417
+ application/x-mif @mif 'LTSW
1418
+ application/x-rtf 'LTSW =use-instead:application/rtf
1419
+ application/x-sh @sh 'LTSW
1420
+ application/x-shar @shar 'LTSW
1421
+ application/x-stuffit @sit :base64 'LTSW
1422
+ application/x-sv4cpio @sv4cpio :base64 'LTSW
1423
+ application/x-sv4crc @sv4crc :base64 'LTSW
1424
+ application/x-tar @tar :base64 'LTSW
1425
+ application/x-tcl @tcl :8bit 'LTSW
1426
+ application/x-tex @tex :8bit
1427
+ application/x-texinfo @texinfo,texi :8bit
1428
+ application/x-troff-man @man :8bit 'LTSW
1429
+ application/x-troff-me @me 'LTSW
1430
+ application/x-troff-ms @ms 'LTSW
1431
+ application/x-ustar @ustar :base64 'LTSW
1432
+ application/x-wais-source @src 'LTSW
1433
+ mac:application/x-mac @bin :base64
1434
+ *!application/cals1840 'LTSW =use-instead:application/cals-1840
1435
+ *!application/remote_printing 'LTSW =use-instead:application/remote-printing
1436
+ *!application/x-u-star 'LTSW =use-instead:application/x-ustar
1437
+ *!application/x400.bp 'LTSW =use-instead:application/x400-bp
1438
+ *application/acad 'LTSW
1439
+ *application/clariscad 'LTSW
1440
+ *application/drafting 'LTSW
1441
+ *application/dxf 'LTSW
1442
+ *application/excel @xls,xlt 'LTSW
1443
+ *application/fractals 'LTSW
1444
+ *application/i-deas 'LTSW
1445
+ *application/macbinary 'LTSW
1446
+ *application/netcdf @nc,cdf 'LTSW
1447
+ *application/powerpoint @ppt,pps,pot :base64 'LTSW
1448
+ *application/pro_eng 'LTSW
1449
+ *application/set 'LTSW
1450
+ *application/SLA 'LTSW
1451
+ *application/solids 'LTSW
1452
+ *application/STEP 'LTSW
1453
+ *application/vda 'LTSW
1454
+ *application/word @doc,dot 'LTSW
1455
+
1456
+ # Unregistered: audio/*
1457
+ audio/x-aiff @aif,aifc,aiff :base64
1458
+ audio/x-midi @mid,midi,kar :base64
1459
+ audio/x-pn-realaudio @rm,ram :base64
1460
+ audio/x-pn-realaudio-plugin @rpm
1461
+ audio/x-realaudio @ra :base64
1462
+ audio/x-wav @wav :base64
1463
+
1464
+ # Unregistered: image/*
1465
+ *image/vnd.dgn @dgn =use-instead:image/x-vnd.dgn
1466
+ image/x-bmp @bmp
1467
+ image/x-cmu-raster @ras
1468
+ image/x-paintshoppro @psp,pspimage :base64
1469
+ image/x-pict
1470
+ image/x-portable-anymap @pnm :base64
1471
+ image/x-portable-bitmap @pbm :base64
1472
+ image/x-portable-graymap @pgm :base64
1473
+ image/x-portable-pixmap @ppm :base64
1474
+ image/x-rgb @rgb :base64
1475
+ image/x-targa @tga
1476
+ image/x-vnd.dgn @dgn
1477
+ image/x-win-bmp
1478
+ image/x-xbitmap @xbm :7bit
1479
+ image/x-xbm @xbm :7bit
1480
+ image/x-xpixmap @xpm :8bit
1481
+ image/x-xwindowdump @xwd :base64
1482
+ *!image/cmu-raster =use-instead:image/x-cmu-raster
1483
+ *!image/vnd.net.fpx =use-instead:image/vnd.net-fpx
1484
+ *image/bmp @bmp
1485
+ *image/targa @tga
1486
+
1487
+ # Unregistered: multipart/*
1488
+ multipart/x-gzip
1489
+ multipart/x-mixed-replace
1490
+ multipart/x-tar
1491
+ multipart/x-ustar
1492
+ multipart/x-www-form-urlencoded
1493
+ multipart/x-zip
1494
+ *!multipart/parallel =use-instead:multipart/parallel
1495
+
1496
+ # Unregistered: text/*
1497
+ *text/comma-separated-values @csv :8bit
1498
+ *text/vnd.flatland.3dml =use-instead:model/vnd.flatland.3dml
1499
+ text/x-vnd.flatland.3dml =use-instead:model/vnd.flatland.3dml
1500
+ text/x-setext @etx
1501
+ text/x-vcalendar @vcs :8bit
1502
+ text/x-vcard @vcf :8bit
1503
+ text/x-yaml @yaml,yml :8bit
1504
+
1505
+ # Unregistered: video/*
1506
+ *video/dl @dl :base64
1507
+ *video/gl @gl :base64
1508
+ video/x-msvideo @avi :base64
1509
+ video/x-sgi-movie @movie :base64
1510
+
1511
+ # Unregistered: other/*
1512
+ x-chemical/x-pdb @pdb
1513
+ x-chemical/x-xyz @xyz
1514
+ x-conference/x-cooltalk @ice
1515
+ x-drawing/dwf @dwf
1516
+ x-world/x-vrml @wrl,vrml
1517
+ MIME_TYPES
1518
+
1519
+ _re = %r{
1520
+ ^
1521
+ ([*])? # 0: Unregistered?
1522
+ (!)? # 1: Obsolete?
1523
+ (?:(\w+):)? # 2: Platform marker
1524
+ #{MIME::Type::MEDIA_TYPE_RE} # 3,4: Media type
1525
+ (?:\s@([^\s]+))? # 5: Extensions
1526
+ (?:\s:(#{MIME::Type::ENCODING_RE}))? # 6: Encoding
1527
+ (?:\s'(.+))? # 7: URL list
1528
+ (?:\s=(.+))? # 8: Documentation
1529
+ $
1530
+ }x
1531
+
1532
+ #COMPAT: each_line instead of each is safer
1533
+ data_mime_type.each_line do |i|
1534
+ item = i.chomp.strip.gsub(%r{#.*}o, '')
1535
+ next if item.empty?
1536
+
1537
+ m = _re.match(item).captures
1538
+
1539
+ unregistered, obsolete, platform, mediatype, subtype, extensions,
1540
+ encoding, urls, docs = *m
1541
+
1542
+ extensions &&= extensions.split(/,/)
1543
+ urls &&= urls.split(/,/)
1544
+
1545
+ mime_type = MIME::Type.new("#{mediatype}/#{subtype}") do |t|
1546
+ t.extensions = extensions
1547
+ t.encoding = encoding
1548
+ t.system = platform
1549
+ t.obsolete = obsolete
1550
+ t.registered = false if unregistered
1551
+ t.docs = docs
1552
+ t.url = urls
1553
+ end
1554
+
1555
+ MIME::Types.add_type_variant(mime_type)
1556
+ MIME::Types.index_extensions(mime_type)
1557
+ end
1558
+
1559
+ _re = nil
1560
+ data_mime_type = nil