mongrel 1.1.2-java

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of mongrel might be problematic. Click here for more details.

Files changed (73) hide show
  1. data.tar.gz.sig +1 -0
  2. data/CHANGELOG +12 -0
  3. data/COPYING +55 -0
  4. data/LICENSE +55 -0
  5. data/Manifest +69 -0
  6. data/README +74 -0
  7. data/TODO +5 -0
  8. data/bin/mongrel_rails +283 -0
  9. data/examples/builder.rb +29 -0
  10. data/examples/camping/README +3 -0
  11. data/examples/camping/blog.rb +294 -0
  12. data/examples/camping/tepee.rb +149 -0
  13. data/examples/httpd.conf +474 -0
  14. data/examples/mime.yaml +3 -0
  15. data/examples/mongrel.conf +9 -0
  16. data/examples/mongrel_simple_ctrl.rb +92 -0
  17. data/examples/mongrel_simple_service.rb +116 -0
  18. data/examples/monitrc +57 -0
  19. data/examples/random_thrash.rb +19 -0
  20. data/examples/simpletest.rb +52 -0
  21. data/examples/webrick_compare.rb +20 -0
  22. data/ext/http11/ext_help.h +14 -0
  23. data/ext/http11/extconf.rb +6 -0
  24. data/ext/http11/http11.c +402 -0
  25. data/ext/http11/http11_parser.c +1221 -0
  26. data/ext/http11/http11_parser.h +49 -0
  27. data/ext/http11/http11_parser.java.rl +170 -0
  28. data/ext/http11/http11_parser.rl +152 -0
  29. data/ext/http11/http11_parser_common.rl +54 -0
  30. data/ext/http11_java/Http11Service.java +13 -0
  31. data/ext/http11_java/org/jruby/mongrel/Http11.java +266 -0
  32. data/ext/http11_java/org/jruby/mongrel/Http11Parser.java +572 -0
  33. data/lib/http11.jar +0 -0
  34. data/lib/mongrel.rb +355 -0
  35. data/lib/mongrel/camping.rb +107 -0
  36. data/lib/mongrel/cgi.rb +181 -0
  37. data/lib/mongrel/command.rb +222 -0
  38. data/lib/mongrel/configurator.rb +388 -0
  39. data/lib/mongrel/const.rb +110 -0
  40. data/lib/mongrel/debug.rb +203 -0
  41. data/lib/mongrel/gems.rb +22 -0
  42. data/lib/mongrel/handlers.rb +468 -0
  43. data/lib/mongrel/header_out.rb +28 -0
  44. data/lib/mongrel/http_request.rb +155 -0
  45. data/lib/mongrel/http_response.rb +163 -0
  46. data/lib/mongrel/init.rb +10 -0
  47. data/lib/mongrel/mime_types.yml +616 -0
  48. data/lib/mongrel/rails.rb +185 -0
  49. data/lib/mongrel/stats.rb +89 -0
  50. data/lib/mongrel/tcphack.rb +18 -0
  51. data/lib/mongrel/uri_classifier.rb +76 -0
  52. data/mongrel-public_cert.pem +20 -0
  53. data/mongrel.gemspec +263 -0
  54. data/setup.rb +1585 -0
  55. data/test/mime.yaml +3 -0
  56. data/test/mongrel.conf +1 -0
  57. data/test/test_cgi_wrapper.rb +26 -0
  58. data/test/test_command.rb +86 -0
  59. data/test/test_conditional.rb +107 -0
  60. data/test/test_configurator.rb +87 -0
  61. data/test/test_debug.rb +25 -0
  62. data/test/test_handlers.rb +103 -0
  63. data/test/test_http11.rb +156 -0
  64. data/test/test_redirect_handler.rb +44 -0
  65. data/test/test_request_progress.rb +99 -0
  66. data/test/test_response.rb +127 -0
  67. data/test/test_stats.rb +35 -0
  68. data/test/test_uriclassifier.rb +261 -0
  69. data/test/test_ws.rb +115 -0
  70. data/test/testhelp.rb +66 -0
  71. data/tools/trickletest.rb +45 -0
  72. metadata +186 -0
  73. metadata.gz.sig +4 -0
@@ -0,0 +1,28 @@
1
+ module Mongrel
2
+ # This class implements a simple way of constructing the HTTP headers dynamically
3
+ # via a Hash syntax. Think of it as a write-only Hash. Refer to HttpResponse for
4
+ # information on how this is used.
5
+ #
6
+ # One consequence of this write-only nature is that you can write multiple headers
7
+ # by just doing them twice (which is sometimes needed in HTTP), but that the normal
8
+ # semantics for Hash (where doing an insert replaces) is not there.
9
+ class HeaderOut
10
+ attr_reader :out
11
+ attr_accessor :allowed_duplicates
12
+
13
+ def initialize(out)
14
+ @sent = {}
15
+ @allowed_duplicates = {"Set-Cookie" => true, "Set-Cookie2" => true,
16
+ "Warning" => true, "WWW-Authenticate" => true}
17
+ @out = out
18
+ end
19
+
20
+ # Simply writes "#{key}: #{value}" to an output buffer.
21
+ def[]=(key,value)
22
+ if not @sent.has_key?(key) or @allowed_duplicates.has_key?(key)
23
+ @sent[key] = true
24
+ @out.write(Const::HEADER_FORMAT % [key, value])
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,155 @@
1
+
2
+ module Mongrel
3
+ #
4
+ # When a handler is found for a registered URI then this class is constructed
5
+ # and passed to your HttpHandler::process method. You should assume that
6
+ # *one* handler processes all requests. Included in the HttpRequest is a
7
+ # HttpRequest.params Hash that matches common CGI params, and a HttpRequest.body
8
+ # which is a string containing the request body (raw for now).
9
+ #
10
+ # The HttpRequest.initialize method will convert any request that is larger than
11
+ # Const::MAX_BODY into a Tempfile and use that as the body. Otherwise it uses
12
+ # a StringIO object. To be safe, you should assume it works like a file.
13
+ #
14
+ # The HttpHandler.request_notify system is implemented by having HttpRequest call
15
+ # HttpHandler.request_begins, HttpHandler.request_progress, HttpHandler.process during
16
+ # the IO processing. This adds a small amount of overhead but lets you implement
17
+ # finer controlled handlers and filters.
18
+ #
19
+ class HttpRequest
20
+ attr_reader :body, :params
21
+
22
+ # You don't really call this. It's made for you.
23
+ # Main thing it does is hook up the params, and store any remaining
24
+ # body data into the HttpRequest.body attribute.
25
+ def initialize(params, socket, dispatchers)
26
+ @params = params
27
+ @socket = socket
28
+ @dispatchers = dispatchers
29
+ content_length = @params[Const::CONTENT_LENGTH].to_i
30
+ remain = content_length - @params.http_body.length
31
+
32
+ # tell all dispatchers the request has begun
33
+ @dispatchers.each do |dispatcher|
34
+ dispatcher.request_begins(@params)
35
+ end unless @dispatchers.nil? || @dispatchers.empty?
36
+
37
+ # Some clients (like FF1.0) report 0 for body and then send a body. This will probably truncate them but at least the request goes through usually.
38
+ if remain <= 0
39
+ # we've got everything, pack it up
40
+ @body = StringIO.new
41
+ @body.write @params.http_body
42
+ update_request_progress(0, content_length)
43
+ elsif remain > 0
44
+ # must read more data to complete body
45
+ if remain > Const::MAX_BODY
46
+ # huge body, put it in a tempfile
47
+ @body = Tempfile.new(Const::MONGREL_TMP_BASE)
48
+ @body.binmode
49
+ else
50
+ # small body, just use that
51
+ @body = StringIO.new
52
+ end
53
+
54
+ @body.write @params.http_body
55
+ read_body(remain, content_length)
56
+ end
57
+
58
+ @body.rewind if @body
59
+ end
60
+
61
+ # updates all dispatchers about our progress
62
+ def update_request_progress(clen, total)
63
+ return if @dispatchers.nil? || @dispatchers.empty?
64
+ @dispatchers.each do |dispatcher|
65
+ dispatcher.request_progress(@params, clen, total)
66
+ end
67
+ end
68
+ private :update_request_progress
69
+
70
+ # Does the heavy lifting of properly reading the larger body requests in
71
+ # small chunks. It expects @body to be an IO object, @socket to be valid,
72
+ # and will set @body = nil if the request fails. It also expects any initial
73
+ # part of the body that has been read to be in the @body already.
74
+ def read_body(remain, total)
75
+ begin
76
+ # write the odd sized chunk first
77
+ @params.http_body = read_socket(remain % Const::CHUNK_SIZE)
78
+
79
+ remain -= @body.write(@params.http_body)
80
+
81
+ update_request_progress(remain, total)
82
+
83
+ # then stream out nothing but perfectly sized chunks
84
+ until remain <= 0 or @socket.closed?
85
+ # ASSUME: we are writing to a disk and these writes always write the requested amount
86
+ @params.http_body = read_socket(Const::CHUNK_SIZE)
87
+ remain -= @body.write(@params.http_body)
88
+
89
+ update_request_progress(remain, total)
90
+ end
91
+ rescue Object => e
92
+ STDERR.puts "#{Time.now}: Error reading HTTP body: #{e.inspect}"
93
+ STDERR.puts e.backtrace.join("\n")
94
+ # any errors means we should delete the file, including if the file is dumped
95
+ @socket.close rescue nil
96
+ @body.delete if @body.class == Tempfile
97
+ @body = nil # signals that there was a problem
98
+ end
99
+ end
100
+
101
+ def read_socket(len)
102
+ if !@socket.closed?
103
+ data = @socket.read(len)
104
+ if !data
105
+ raise "Socket read return nil"
106
+ elsif data.length != len
107
+ raise "Socket read returned insufficient data: #{data.length}"
108
+ else
109
+ data
110
+ end
111
+ else
112
+ raise "Socket already closed when reading."
113
+ end
114
+ end
115
+
116
+ # Performs URI escaping so that you can construct proper
117
+ # query strings faster. Use this rather than the cgi.rb
118
+ # version since it's faster. (Stolen from Camping).
119
+ def self.escape(s)
120
+ s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/n) {
121
+ '%'+$1.unpack('H2'*$1.size).join('%').upcase
122
+ }.tr(' ', '+')
123
+ end
124
+
125
+
126
+ # Unescapes a URI escaped string. (Stolen from Camping).
127
+ def self.unescape(s)
128
+ s.tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/n){
129
+ [$1.delete('%')].pack('H*')
130
+ }
131
+ end
132
+
133
+ # Parses a query string by breaking it up at the '&'
134
+ # and ';' characters. You can also use this to parse
135
+ # cookies by changing the characters used in the second
136
+ # parameter (which defaults to '&;'.
137
+ def self.query_parse(qs, d = '&;')
138
+ params = {}
139
+ (qs||'').split(/[#{d}] */n).inject(params) { |h,p|
140
+ k, v=unescape(p).split('=',2)
141
+ if cur = params[k]
142
+ if cur.class == Array
143
+ params[k] << v
144
+ else
145
+ params[k] = [cur, v]
146
+ end
147
+ else
148
+ params[k] = v
149
+ end
150
+ }
151
+
152
+ return params
153
+ end
154
+ end
155
+ end
@@ -0,0 +1,163 @@
1
+ module Mongrel
2
+ # Writes and controls your response to the client using the HTTP/1.1 specification.
3
+ # You use it by simply doing:
4
+ #
5
+ # response.start(200) do |head,out|
6
+ # head['Content-Type'] = 'text/plain'
7
+ # out.write("hello\n")
8
+ # end
9
+ #
10
+ # The parameter to start is the response code--which Mongrel will translate for you
11
+ # based on HTTP_STATUS_CODES. The head parameter is how you write custom headers.
12
+ # The out parameter is where you write your body. The default status code for
13
+ # HttpResponse.start is 200 so the above example is redundant.
14
+ #
15
+ # As you can see, it's just like using a Hash and as you do this it writes the proper
16
+ # header to the output on the fly. You can even intermix specifying headers and
17
+ # writing content. The HttpResponse class with write the things in the proper order
18
+ # once the HttpResponse.block is ended.
19
+ #
20
+ # You may also work the HttpResponse object directly using the various attributes available
21
+ # for the raw socket, body, header, and status codes. If you do this you're on your own.
22
+ # A design decision was made to force the client to not pipeline requests. HTTP/1.1
23
+ # pipelining really kills the performance due to how it has to be handled and how
24
+ # unclear the standard is. To fix this the HttpResponse gives a "Connection: close"
25
+ # header which forces the client to close right away. The bonus for this is that it
26
+ # gives a pretty nice speed boost to most clients since they can close their connection
27
+ # immediately.
28
+ #
29
+ # One additional caveat is that you don't have to specify the Content-length header
30
+ # as the HttpResponse will write this for you based on the out length.
31
+ class HttpResponse
32
+ attr_reader :socket
33
+ attr_reader :body
34
+ attr_writer :body
35
+ attr_reader :header
36
+ attr_reader :status
37
+ attr_writer :status
38
+ attr_reader :body_sent
39
+ attr_reader :header_sent
40
+ attr_reader :status_sent
41
+
42
+ def initialize(socket)
43
+ @socket = socket
44
+ @body = StringIO.new
45
+ @status = 404
46
+ @reason = nil
47
+ @header = HeaderOut.new(StringIO.new)
48
+ @header[Const::DATE] = Time.now.httpdate
49
+ @body_sent = false
50
+ @header_sent = false
51
+ @status_sent = false
52
+ end
53
+
54
+ # Receives a block passing it the header and body for you to work with.
55
+ # When the block is finished it writes everything you've done to
56
+ # the socket in the proper order. This lets you intermix header and
57
+ # body content as needed. Handlers are able to modify pretty much
58
+ # any part of the request in the chain, and can stop further processing
59
+ # by simple passing "finalize=true" to the start method. By default
60
+ # all handlers run and then mongrel finalizes the request when they're
61
+ # all done.
62
+ def start(status=200, finalize=false, reason=nil)
63
+ @status = status.to_i
64
+ @reason = reason
65
+ yield @header, @body
66
+ finished if finalize
67
+ end
68
+
69
+ # Primarily used in exception handling to reset the response output in order to write
70
+ # an alternative response. It will abort with an exception if you have already
71
+ # sent the header or the body. This is pretty catastrophic actually.
72
+ def reset
73
+ if @body_sent
74
+ raise "You have already sent the request body."
75
+ elsif @header_sent
76
+ raise "You have already sent the request headers."
77
+ else
78
+ @header.out.truncate(0)
79
+ @body.close
80
+ @body = StringIO.new
81
+ end
82
+ end
83
+
84
+ def send_status(content_length=@body.length)
85
+ if not @status_sent
86
+ @header['Content-Length'] = content_length if content_length and @status != 304
87
+ write(Const::STATUS_FORMAT % [@status, @reason || HTTP_STATUS_CODES[@status]])
88
+ @status_sent = true
89
+ end
90
+ end
91
+
92
+ def send_header
93
+ if not @header_sent
94
+ @header.out.rewind
95
+ write(@header.out.read + Const::LINE_END)
96
+ @header_sent = true
97
+ end
98
+ end
99
+
100
+ def send_body
101
+ if not @body_sent
102
+ @body.rewind
103
+ write(@body.read)
104
+ @body_sent = true
105
+ end
106
+ end
107
+
108
+ # Appends the contents of +path+ to the response stream. The file is opened for binary
109
+ # reading and written in chunks to the socket.
110
+ #
111
+ # Sendfile API support has been removed in 0.3.13.4 due to stability problems.
112
+ def send_file(path, small_file = false)
113
+ if small_file
114
+ File.open(path, "rb") {|f| @socket << f.read }
115
+ else
116
+ File.open(path, "rb") do |f|
117
+ while chunk = f.read(Const::CHUNK_SIZE) and chunk.length > 0
118
+ begin
119
+ write(chunk)
120
+ rescue Object => exc
121
+ break
122
+ end
123
+ end
124
+ end
125
+ end
126
+ @body_sent = true
127
+ end
128
+
129
+ def socket_error(details)
130
+ # ignore these since it means the client closed off early
131
+ @socket.close rescue nil
132
+ done = true
133
+ raise details
134
+ end
135
+
136
+ def write(data)
137
+ @socket.write(data)
138
+ rescue => details
139
+ socket_error(details)
140
+ end
141
+
142
+ # This takes whatever has been done to header and body and then writes it in the
143
+ # proper format to make an HTTP/1.1 response.
144
+ def finished
145
+ send_status
146
+ send_header
147
+ send_body
148
+ end
149
+
150
+ # Used during error conditions to mark the response as "done" so there isn't any more processing
151
+ # sent to the client.
152
+ def done=(val)
153
+ @status_sent = true
154
+ @header_sent = true
155
+ @body_sent = true
156
+ end
157
+
158
+ def done
159
+ (@status_sent and @header_sent and @body_sent)
160
+ end
161
+
162
+ end
163
+ end
@@ -0,0 +1,10 @@
1
+ # Copyright (c) 2005 Zed A. Shaw
2
+ # You can redistribute it and/or modify it under the same terms as Ruby.
3
+ #
4
+ # Additional work donated by contributors. See http://mongrel.rubyforge.org/attributions.html
5
+ # for more information.
6
+
7
+ require 'mongrel/gems'
8
+ Mongrel::Gems.require 'gem_plugin'
9
+
10
+ # File is just a stub that makes sure the mongrel_plugins gem is loaded and ready
@@ -0,0 +1,616 @@
1
+ ---
2
+ .a: application/octet-stream
3
+ .abc: text/vnd.abc
4
+ .acgi: text/html
5
+ .afl: video/animaflex
6
+ .ai: application/postscript
7
+ .aif: audio/aiff
8
+ .aifc: audio/aiff
9
+ .aiff: audio/aiff
10
+ .aip: text/x-audiosoft-intra
11
+ .ani: application/x-navi-animation
12
+ .aps: application/mime
13
+ .arc: application/octet-stream
14
+ .arj: application/octet-stream
15
+ .art: image/x-jg
16
+ .asf: video/x-ms-asf
17
+ .asm: text/x-asm
18
+ .asp: text/asp
19
+ .asr: video/x-ms-asf
20
+ .asx: video/x-ms-asf
21
+ .atom: application/atom+xml
22
+ .au: audio/basic
23
+ .au: audio/x-au
24
+ .avi: video/avi
25
+ .avs: video/avs-video
26
+ .axs: application/olescript
27
+ .bas: text/plain
28
+ .bcpio: application/x-bcpio
29
+ .bin: application/octet-stream
30
+ .bm: image/bmp
31
+ .bmp: image/bmp
32
+ .boo: application/book
33
+ .book: application/book
34
+ .boz: application/x-bzip2
35
+ .bsh: application/x-bsh
36
+ .bz2: application/x-bzip2
37
+ .bz: application/x-bzip
38
+ .c: text/plain
39
+ .cat: application/octet-stream
40
+ .cc: text/plain
41
+ .ccad: application/clariscad
42
+ .cco: application/x-cocoa
43
+ .cdf: application/cdf
44
+ .cer: application/x-x509-ca-cert
45
+ .cha: application/x-chat
46
+ .chat: application/x-chat
47
+ .class: application/java
48
+ .class: application/octet-stream
49
+ .clp: application/x-msclip
50
+ .cmx: image/x-cmx
51
+ .cod: image/cis-cod
52
+ .com: application/octet-stream
53
+ .com: text/plain
54
+ .conf: text/plain
55
+ .cpio: application/x-cpio
56
+ .cpp: text/x-c
57
+ .cpt: application/x-cpt
58
+ .crd: application/x-mscardfile
59
+ .crl: application/pkcs-crl
60
+ .crl: application/pkix-crl
61
+ .crt: application/x-x509-ca-cert
62
+ .csh: application/x-csh
63
+ .csh: text/x-script.csh
64
+ .css: text/css
65
+ .cxx: text/plain
66
+ .dcr: application/x-director
67
+ .deb: application/octet-stream
68
+ .deepv: application/x-deepv
69
+ .def: text/plain
70
+ .der: application/x-x509-ca-cert
71
+ .dhh: application/david-heinemeier-hansson
72
+ .dif: video/x-dv
73
+ .dir: application/x-director
74
+ .dl: video/dl
75
+ .dll: application/octet-stream
76
+ .dmg: application/octet-stream
77
+ .dms: application/octet-stream
78
+ .doc: application/msword
79
+ .dp: application/commonground
80
+ .drw: application/drafting
81
+ .dump: application/octet-stream
82
+ .dv: video/x-dv
83
+ .dvi: application/x-dvi
84
+ .dwg: application/acad
85
+ .dwg: image/x-dwg
86
+ .dxf: application/dxf
87
+ .dxf: image/x-dwg
88
+ .dxr: application/x-director
89
+ .ear: application/java-archive
90
+ .el: text/x-script.elisp
91
+ .elc: application/x-bytecode.elisp (compiled elisp)
92
+ .elc: application/x-elc
93
+ .env: application/x-envoy
94
+ .eot: application/octet-stream
95
+ .eps: application/postscript
96
+ .es: application/x-esrehber
97
+ .etx: text/x-setext
98
+ .evy: application/envoy
99
+ .evy: application/x-envoy
100
+ .exe: application/octet-stream
101
+ .f77: text/x-fortran
102
+ .f90: text/plain
103
+ .f90: text/x-fortran
104
+ .f: text/x-fortran
105
+ .fdf: application/vnd.fdf
106
+ .fif: application/fractals
107
+ .fif: image/fif
108
+ .fli: video/fli
109
+ .fli: video/x-fli
110
+ .flo: image/florian
111
+ .flr: x-world/x-vrml
112
+ .flv: video/x-flv
113
+ .flx: text/vnd.fmi.flexstor
114
+ .fmf: video/x-atomic3d-feature
115
+ .for: text/plain
116
+ .for: text/x-fortran
117
+ .fpx: image/vnd.fpx
118
+ .fpx: image/vnd.net-fpx
119
+ .frl: application/freeloader
120
+ .funk: audio/make
121
+ .g3: image/g3fax
122
+ .g: text/plain
123
+ .gif: image/gif
124
+ .gl: video/gl
125
+ .gl: video/x-gl
126
+ .gsd: audio/x-gsm
127
+ .gsm: audio/x-gsm
128
+ .gsp: application/x-gsp
129
+ .gss: application/x-gss
130
+ .gtar: application/x-gtar
131
+ .gz: application/x-compressed
132
+ .gzip: application/x-gzip
133
+ .h: text/plain
134
+ .hdf: application/x-hdf
135
+ .help: application/x-helpfile
136
+ .hgl: application/vnd.hp-hpgl
137
+ .hh: text/plain
138
+ .hlb: text/x-script
139
+ .hlp: application/hlp
140
+ .hpg: application/vnd.hp-hpgl
141
+ .hpgl: application/vnd.hp-hpgl
142
+ .hqx: application/binhex
143
+ .hta: application/hta
144
+ .htc: text/x-component
145
+ .htm: text/html
146
+ .html: text/html
147
+ .htmls: text/html
148
+ .htt: text/webviewhtml
149
+ .htx: text/html
150
+ .ico: image/x-icon
151
+ .idc: text/plain
152
+ .ief: image/ief
153
+ .iefs: image/ief
154
+ .iges: application/iges
155
+ .igs: application/iges
156
+ .iii: application/x-iphone
157
+ .ima: application/x-ima
158
+ .imap: application/x-httpd-imap
159
+ .img: application/octet-stream
160
+ .inf: application/inf
161
+ .ins: application/x-internet-signup
162
+ .ins: application/x-internett-signup
163
+ .ip: application/x-ip2
164
+ .iso: application/octet-stream
165
+ .isp: application/x-internet-signup
166
+ .isu: video/x-isvideo
167
+ .it: audio/it
168
+ .iv: application/x-inventor
169
+ .ivr: i-world/i-vrml
170
+ .ivy: application/x-livescreen
171
+ .jam: audio/x-jam
172
+ .jar: application/java-archive
173
+ .jardiff: application/x-java-archive-diff
174
+ .jav: text/plain
175
+ .jav: text/x-java-source
176
+ .java: text/plain
177
+ .java: text/x-java-source
178
+ .jcm: application/x-java-commerce
179
+ .jfif-tbnl: image/jpeg
180
+ .jfif: image/jpeg
181
+ .jfif: image/pipeg
182
+ .jfif: image/pjpeg
183
+ .jng: image/x-jng
184
+ .jnlp: application/x-java-jnlp-file
185
+ .jpe: image/jpeg
186
+ .jpeg: image/jpeg
187
+ .jpg: image/jpeg
188
+ .jps: image/x-jps
189
+ .js: application/x-javascript
190
+ .js: text/javascript
191
+ .jut: image/jutvision
192
+ .kar: audio/midi
193
+ .kar: music/x-karaoke
194
+ .ksh: application/x-ksh
195
+ .ksh: text/x-script.ksh
196
+ .la: audio/nspaudio
197
+ .la: audio/x-nspaudio
198
+ .lam: audio/x-liveaudio
199
+ .latex: application/x-latex
200
+ .lha: application/lha
201
+ .lha: application/octet-stream
202
+ .lha: application/x-lha
203
+ .lhx: application/octet-stream
204
+ .list: text/plain
205
+ .lma: audio/nspaudio
206
+ .lma: audio/x-nspaudio
207
+ .log: text/plain
208
+ .lsf: video/x-la-asf
209
+ .lsp: application/x-lisp
210
+ .lsp: text/x-script.lisp
211
+ .lst: text/plain
212
+ .lsx: text/x-la-asf
213
+ .lsx: video/x-la-asf
214
+ .ltx: application/x-latex
215
+ .lzh: application/octet-stream
216
+ .lzh: application/x-lzh
217
+ .lzx: application/lzx
218
+ .lzx: application/octet-stream
219
+ .lzx: application/x-lzx
220
+ .m13: application/x-msmediaview
221
+ .m14: application/x-msmediaview
222
+ .m1v: video/mpeg
223
+ .m2a: audio/mpeg
224
+ .m2v: video/mpeg
225
+ .m3u: audio/x-mpegurl
226
+ .m: text/x-m
227
+ .man: application/x-troff-man
228
+ .map: application/x-navimap
229
+ .mar: text/plain
230
+ .mbd: application/mbedlet
231
+ .mc: application/x-magic-cap-package-1.0
232
+ .mcd: application/mcad
233
+ .mcd: application/x-mathcad
234
+ .mcf: image/vasa
235
+ .mcf: text/mcf
236
+ .mcp: application/netmc
237
+ .mdb: application/x-msaccess
238
+ .me: application/x-troff-me
239
+ .mht: message/rfc822
240
+ .mhtml: message/rfc822
241
+ .mid: audio/mid
242
+ .mid: audio/midi
243
+ .mid: audio/x-mid
244
+ .mid: audio/x-midi
245
+ .midi: audio/midi
246
+ .midi: audio/x-mid
247
+ .midi: audio/x-midi
248
+ .mif: application/x-frame
249
+ .mif: application/x-mif
250
+ .mime: message/rfc822
251
+ .mime: www/mime
252
+ .mjf: audio/x-vnd.audioexplosion.mjuicemediafile
253
+ .mjpg: video/x-motion-jpeg
254
+ .mm: application/base64
255
+ .mm: application/x-meme
256
+ .mme: application/base64
257
+ .mml: text/mathml
258
+ .mng: video/x-mng
259
+ .mod: audio/mod
260
+ .moov: video/quicktime
261
+ .mov: video/quicktime
262
+ .movie: video/x-sgi-movie
263
+ .mp2: audio/mpeg
264
+ .mp3: audio/mpeg
265
+ .mpa: audio/mpeg
266
+ .mpc: application/x-project
267
+ .mpe: video/mpeg
268
+ .mpeg: video/mpeg
269
+ .mpg: video/mpeg
270
+ .mpga: audio/mpeg
271
+ .mpp: application/vnd.ms-project
272
+ .mpt: application/x-project
273
+ .mpv2: video/mpeg
274
+ .mpv: application/x-project
275
+ .mpx: application/x-project
276
+ .mrc: application/marc
277
+ .ms: application/x-troff-ms
278
+ .msi: application/octet-stream
279
+ .msm: application/octet-stream
280
+ .msp: application/octet-stream
281
+ .mv: video/x-sgi-movie
282
+ .mvb: application/x-msmediaview
283
+ .my: audio/make
284
+ .mzz: application/x-vnd.audioexplosion.mzz
285
+ .nap: image/naplps
286
+ .naplps: image/naplps
287
+ .nc: application/x-netcdf
288
+ .ncm: application/vnd.nokia.configuration-message
289
+ .nif: image/x-niff
290
+ .niff: image/x-niff
291
+ .nix: application/x-mix-transfer
292
+ .nsc: application/x-conference
293
+ .nvd: application/x-navidoc
294
+ .nws: message/rfc822
295
+ .o: application/octet-stream
296
+ .oda: application/oda
297
+ .omc: application/x-omc
298
+ .omcd: application/x-omcdatamaker
299
+ .omcr: application/x-omcregerator
300
+ .p10: application/pkcs10
301
+ .p10: application/x-pkcs10
302
+ .p12: application/pkcs-12
303
+ .p12: application/x-pkcs12
304
+ .p7a: application/x-pkcs7-signature
305
+ .p7b: application/x-pkcs7-certificates
306
+ .p7c: application/pkcs7-mime
307
+ .p7c: application/x-pkcs7-mime
308
+ .p7m: application/pkcs7-mime
309
+ .p7m: application/x-pkcs7-mime
310
+ .p7r: application/x-pkcs7-certreqresp
311
+ .p7s: application/pkcs7-signature
312
+ .p7s: application/x-pkcs7-signature
313
+ .p: text/x-pascal
314
+ .part: application/pro_eng
315
+ .pas: text/pascal
316
+ .pbm: image/x-portable-bitmap
317
+ .pcl: application/vnd.hp-pcl
318
+ .pcl: application/x-pcl
319
+ .pct: image/x-pict
320
+ .pcx: image/x-pcx
321
+ .pdb: application/x-pilot
322
+ .pdf: application/pdf
323
+ .pem: application/x-x509-ca-cert
324
+ .pfunk: audio/make
325
+ .pfunk: audio/make.my.funk
326
+ .pfx: application/x-pkcs12
327
+ .pgm: image/x-portable-graymap
328
+ .pgm: image/x-portable-greymap
329
+ .pic: image/pict
330
+ .pict: image/pict
331
+ .pkg: application/x-newton-compatible-pkg
332
+ .pko: application/vnd.ms-pki.pko
333
+ .pko: application/ynd.ms-pkipko
334
+ .pl: application/x-perl
335
+ .pl: text/plain
336
+ .pl: text/x-script.perl
337
+ .plx: application/x-pixclscript
338
+ .pm4: application/x-pagemaker
339
+ .pm5: application/x-pagemaker
340
+ .pm: application/x-perl
341
+ .pm: image/x-xpixmap
342
+ .pm: text/x-script.perl-module
343
+ .pma: application/x-perfmon
344
+ .pmc: application/x-perfmon
345
+ .pml: application/x-perfmon
346
+ .pmr: application/x-perfmon
347
+ .pmw: application/x-perfmon
348
+ .png: image/png
349
+ .pnm: application/x-portable-anymap
350
+ .pnm: image/x-portable-anymap
351
+ .pot,: application/vnd.ms-powerpoint
352
+ .pot: application/mspowerpoint
353
+ .pot: application/vnd.ms-powerpoint
354
+ .pov: model/x-pov
355
+ .ppa: application/vnd.ms-powerpoint
356
+ .ppm: image/x-portable-pixmap
357
+ .pps: application/mspowerpoint
358
+ .ppt: application/mspowerpoint
359
+ .ppz: application/mspowerpoint
360
+ .prc: application/x-pilot
361
+ .pre: application/x-freelance
362
+ .prf: application/pics-rules
363
+ .prt: application/pro_eng
364
+ .ps: application/postscript
365
+ .psd: application/octet-stream
366
+ .pub: application/x-mspublisher
367
+ .pvu: paleovu/x-pv
368
+ .pwz: application/vnd.ms-powerpoint
369
+ .py: text/x-script.phyton
370
+ .pyc: applicaiton/x-bytecode.python
371
+ .qcp: audio/vnd.qcelp
372
+ .qd3: x-world/x-3dmf
373
+ .qd3d: x-world/x-3dmf
374
+ .qif: image/x-quicktime
375
+ .qt: video/quicktime
376
+ .qtc: video/x-qtc
377
+ .qti: image/x-quicktime
378
+ .qtif: image/x-quicktime
379
+ .ra: audio/x-pn-realaudio
380
+ .ra: audio/x-pn-realaudio-plugin
381
+ .ra: audio/x-realaudio
382
+ .ram: audio/x-pn-realaudio
383
+ .rar: application/x-rar-compressed
384
+ .ras: application/x-cmu-raster
385
+ .ras: image/cmu-raster
386
+ .ras: image/x-cmu-raster
387
+ .rast: image/cmu-raster
388
+ .rexx: text/x-script.rexx
389
+ .rf: image/vnd.rn-realflash
390
+ .rgb: image/x-rgb
391
+ .rm: application/vnd.rn-realmedia
392
+ .rm: audio/x-pn-realaudio
393
+ .rmi: audio/mid
394
+ .rmm: audio/x-pn-realaudio
395
+ .rmp: audio/x-pn-realaudio
396
+ .rmp: audio/x-pn-realaudio-plugin
397
+ .rng: application/ringing-tones
398
+ .rng: application/vnd.nokia.ringing-tone
399
+ .rnx: application/vnd.rn-realplayer
400
+ .roff: application/x-troff
401
+ .rp: image/vnd.rn-realpix
402
+ .rpm: application/x-redhat-package-manager
403
+ .rpm: audio/x-pn-realaudio-plugin
404
+ .rss: text/xml
405
+ .rt: text/richtext
406
+ .rt: text/vnd.rn-realtext
407
+ .rtf: application/rtf
408
+ .rtf: application/x-rtf
409
+ .rtf: text/richtext
410
+ .rtx: application/rtf
411
+ .rtx: text/richtext
412
+ .run: application/x-makeself
413
+ .rv: video/vnd.rn-realvideo
414
+ .s3m: audio/s3m
415
+ .s: text/x-asm
416
+ .saveme: application/octet-stream
417
+ .sbk: application/x-tbook
418
+ .scd: application/x-msschedule
419
+ .scm: application/x-lotusscreencam
420
+ .scm: text/x-script.guile
421
+ .scm: text/x-script.scheme
422
+ .scm: video/x-scm
423
+ .sct: text/scriptlet
424
+ .sdml: text/plain
425
+ .sdp: application/sdp
426
+ .sdp: application/x-sdp
427
+ .sdr: application/sounder
428
+ .sea: application/sea
429
+ .sea: application/x-sea
430
+ .set: application/set
431
+ .setpay: application/set-payment-initiation
432
+ .setreg: application/set-registration-initiation
433
+ .sgm: text/sgml
434
+ .sgm: text/x-sgml
435
+ .sgml: text/sgml
436
+ .sgml: text/x-sgml
437
+ .sh: application/x-bsh
438
+ .sh: application/x-sh
439
+ .sh: application/x-shar
440
+ .sh: text/x-script.sh
441
+ .shar: application/x-bsh
442
+ .shar: application/x-shar
443
+ .shtml: text/html
444
+ .shtml: text/x-server-parsed-html
445
+ .sid: audio/x-psid
446
+ .sit: application/x-sit
447
+ .sit: application/x-stuffit
448
+ .skd: application/x-koan
449
+ .skm: application/x-koan
450
+ .skp: application/x-koan
451
+ .skt: application/x-koan
452
+ .sl: application/x-seelogo
453
+ .smi: application/smil
454
+ .smil: application/smil
455
+ .snd: audio/basic
456
+ .snd: audio/x-adpcm
457
+ .sol: application/solids
458
+ .spc: application/x-pkcs7-certificates
459
+ .spc: text/x-speech
460
+ .spl: application/futuresplash
461
+ .spr: application/x-sprite
462
+ .sprite: application/x-sprite
463
+ .src: application/x-wais-source
464
+ .ssi: text/x-server-parsed-html
465
+ .ssm: application/streamingmedia
466
+ .sst: application/vnd.ms-pki.certstore
467
+ .sst: application/vnd.ms-pkicertstore
468
+ .step: application/step
469
+ .stl: application/sla
470
+ .stl: application/vnd.ms-pki.stl
471
+ .stl: application/vnd.ms-pkistl
472
+ .stl: application/x-navistyle
473
+ .stm: text/html
474
+ .stp: application/step
475
+ .sv4cpio: application/x-sv4cpio
476
+ .sv4crc: application/x-sv4crc
477
+ .svf: image/vnd.dwg
478
+ .svf: image/x-dwg
479
+ .svg: image/svg+xml
480
+ .svr: application/x-world
481
+ .svr: x-world/x-svr
482
+ .swf: application/x-shockwave-flash
483
+ .t: application/x-troff
484
+ .talk: text/x-speech
485
+ .tar: application/x-tar
486
+ .tbk: application/toolbook
487
+ .tbk: application/x-tbook
488
+ .tcl: application/x-tcl
489
+ .tcl: text/x-script.tcl
490
+ .tcsh: text/x-script.tcsh
491
+ .tex: application/x-tex
492
+ .texi: application/x-texinfo
493
+ .texinfo: application/x-texinfo
494
+ .text: application/plain
495
+ .text: text/plain
496
+ .tgz: application/gnutar
497
+ .tgz: application/x-compressed
498
+ .tif: image/tiff
499
+ .tiff: image/tiff
500
+ .tk: application/x-tcl
501
+ .tr: application/x-troff
502
+ .trm: application/x-msterminal
503
+ .tsi: audio/tsp-audio
504
+ .tsp: application/dsptype
505
+ .tsp: audio/tsplayer
506
+ .tsv: text/tab-separated-values
507
+ .turbot: image/florian
508
+ .txt: text/plain
509
+ .uil: text/x-uil
510
+ .uls: text/iuls
511
+ .uni: text/uri-list
512
+ .unis: text/uri-list
513
+ .unv: application/i-deas
514
+ .uri: text/uri-list
515
+ .uris: text/uri-list
516
+ .ustar: application/x-ustar
517
+ .ustar: multipart/x-ustar
518
+ .uu: application/octet-stream
519
+ .uu: text/x-uuencode
520
+ .uue: text/x-uuencode
521
+ .vcd: application/x-cdlink
522
+ .vcf: text/x-vcard
523
+ .vcs: text/x-vcalendar
524
+ .vda: application/vda
525
+ .vdo: video/vdo
526
+ .vew: application/groupwise
527
+ .viv: video/vivo
528
+ .viv: video/vnd.vivo
529
+ .vivo: video/vivo
530
+ .vivo: video/vnd.vivo
531
+ .vmd: application/vocaltec-media-desc
532
+ .vmf: application/vocaltec-media-file
533
+ .voc: audio/voc
534
+ .voc: audio/x-voc
535
+ .vos: video/vosaic
536
+ .vox: audio/voxware
537
+ .vqe: audio/x-twinvq-plugin
538
+ .vqf: audio/x-twinvq
539
+ .vql: audio/x-twinvq-plugin
540
+ .vrml: application/x-vrml
541
+ .vrml: model/vrml
542
+ .vrml: x-world/x-vrml
543
+ .vrt: x-world/x-vrt
544
+ .vsd: application/x-visio
545
+ .vst: application/x-visio
546
+ .vsw: application/x-visio
547
+ .w60: application/wordperfect6.0
548
+ .w61: application/wordperfect6.1
549
+ .w6w: application/msword
550
+ .war: application/java-archive
551
+ .wav: audio/wav
552
+ .wav: audio/x-wav
553
+ .wb1: application/x-qpro
554
+ .wbmp: image/vnd.wap.wbmp
555
+ .wbmp: image/vnd.wap.wbmp
556
+ .wcm: application/vnd.ms-works
557
+ .wdb: application/vnd.ms-works
558
+ .web: application/vnd.xara
559
+ .wiz: application/msword
560
+ .wk1: application/x-123
561
+ .wks: application/vnd.ms-works
562
+ .wmf: application/x-msmetafile
563
+ .wmf: windows/metafile
564
+ .wml: text/vnd.wap.wml
565
+ .wmlc: application/vnd.wap.wmlc
566
+ .wmls: text/vnd.wap.wmlscript
567
+ .wmlsc: application/vnd.wap.wmlscriptc
568
+ .wmv: video/x-ms-wmv
569
+ .word: application/msword
570
+ .wp5: application/wordperfect
571
+ .wp6: application/wordperfect
572
+ .wp: application/wordperfect
573
+ .wpd: application/wordperfect
574
+ .wps: application/vnd.ms-works
575
+ .wq1: application/x-lotus
576
+ .wri: application/mswrite
577
+ .wrl: application/x-world
578
+ .wsc: text/scriplet
579
+ .wsrc: application/x-wais-source
580
+ .wtk: application/x-wintalk
581
+ .x-png: image/png
582
+ .xaf: x-world/x-vrml
583
+ .xbm: image/xbm
584
+ .xdr: video/x-amt-demorun
585
+ .xgz: xgl/drawing
586
+ .xhtml: application/xhtml+xml
587
+ .xif: image/vnd.xiff
588
+ .xl: application/excel
589
+ .xla: application/excel
590
+ .xlb: application/excel
591
+ .xlc: application/excel
592
+ .xld: application/excel
593
+ .xlk: application/excel
594
+ .xll: application/excel
595
+ .xlm: application/excel
596
+ .xls: application/excel
597
+ .xlt: application/excel
598
+ .xlv: application/excel
599
+ .xlw: application/excel
600
+ .xm: audio/xm
601
+ .xml: text/xml
602
+ .xmz: xgl/movie
603
+ .xof: x-world/x-vrml
604
+ .xpi: application/x-xpinstall
605
+ .xpix: application/x-vnd.ls-xpix
606
+ .xpm: image/x-xpixmap
607
+ .xpm: image/xpm
608
+ .xsl: application/xslt+xml
609
+ .xsr: video/x-amt-showrun
610
+ .xwd: image/x-xwd
611
+ .xwd: image/x-xwindowdump
612
+ .xyz: chemical/x-pdb
613
+ .z: application/x-compressed
614
+ .zip: application/zip
615
+ .zoo: application/octet-stream
616
+ .zsh: text/x-script.zsh