mongrel 0.3.12 → 0.3.12.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. data/Rakefile +1 -1
  2. data/bin/mongrel_rails +12 -6
  3. data/doc/rdoc/classes/Class.src/M000001.html +10 -10
  4. data/doc/rdoc/classes/Class.src/M000002.html +46 -46
  5. data/doc/rdoc/classes/Class.src/M000003.html +7 -7
  6. data/doc/rdoc/classes/Class.src/M000004.html +6 -6
  7. data/doc/rdoc/classes/IO.src/M000005.html +5 -5
  8. data/doc/rdoc/classes/IO.src/M000006.html +5 -5
  9. data/doc/rdoc/classes/Kernel.src/M000025.html +5 -5
  10. data/doc/rdoc/classes/Kernel.src/M000026.html +11 -11
  11. data/doc/rdoc/classes/Mongrel.html +1 -0
  12. data/doc/rdoc/classes/Mongrel/Command/Base.src/M000030.html +1 -1
  13. data/doc/rdoc/classes/Mongrel/Configurator.src/M000099.html +10 -10
  14. data/doc/rdoc/classes/Mongrel/Configurator.src/M000100.html +9 -9
  15. data/doc/rdoc/classes/Mongrel/Configurator.src/M000101.html +4 -4
  16. data/doc/rdoc/classes/Mongrel/Configurator.src/M000102.html +18 -18
  17. data/doc/rdoc/classes/Mongrel/Configurator.src/M000103.html +5 -5
  18. data/doc/rdoc/classes/Mongrel/Configurator.src/M000104.html +16 -16
  19. data/doc/rdoc/classes/Mongrel/Configurator.src/M000105.html +19 -19
  20. data/doc/rdoc/classes/Mongrel/Configurator.src/M000106.html +4 -4
  21. data/doc/rdoc/classes/Mongrel/Configurator.src/M000107.html +10 -11
  22. data/doc/rdoc/classes/Mongrel/Configurator.src/M000108.html +5 -5
  23. data/doc/rdoc/classes/Mongrel/Configurator.src/M000109.html +8 -8
  24. data/doc/rdoc/classes/Mongrel/Configurator.src/M000110.html +7 -7
  25. data/doc/rdoc/classes/Mongrel/Configurator.src/M000111.html +4 -4
  26. data/doc/rdoc/classes/Mongrel/Configurator.src/M000112.html +14 -13
  27. data/doc/rdoc/classes/Mongrel/Configurator.src/M000113.html +5 -33
  28. data/doc/rdoc/classes/Mongrel/Configurator.src/M000114.html +33 -5
  29. data/doc/rdoc/classes/Mongrel/Configurator.src/M000115.html +18 -0
  30. data/doc/rdoc/classes/Mongrel/Const.html +11 -1
  31. data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000116.html +5 -5
  32. data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000117.html +18 -0
  33. data/doc/rdoc/classes/Mongrel/HeaderOut.html +0 -185
  34. data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000072.html +4 -4
  35. data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000073.html +4 -4
  36. data/doc/rdoc/classes/Mongrel/HttpParser.src/M000054.html +3 -1
  37. data/doc/rdoc/classes/Mongrel/{StopServer.html → HttpParserError.html} +5 -11
  38. data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000118.html +15 -7
  39. data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000119.html +7 -7
  40. data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000120.html +7 -19
  41. data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000121.html +32 -0
  42. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000075.html +12 -12
  43. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000076.html +6 -6
  44. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000077.html +11 -11
  45. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000078.html +8 -8
  46. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000079.html +8 -8
  47. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000080.html +9 -9
  48. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000081.html +4 -4
  49. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000082.html +6 -6
  50. data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000083.html +4 -4
  51. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000064.html +10 -10
  52. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000065.html +51 -50
  53. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000066.html +10 -10
  54. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000067.html +45 -45
  55. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000068.html +14 -14
  56. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000069.html +4 -4
  57. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000070.html +8 -8
  58. data/doc/rdoc/classes/Mongrel/HttpServer.src/M000071.html +4 -4
  59. data/doc/rdoc/classes/ObjectTracker.src/M000019.html +20 -22
  60. data/doc/rdoc/classes/RequestLog/Access.src/M000122.html +19 -0
  61. data/doc/rdoc/classes/RequestLog/Files.src/{M000121.html → M000123.html} +5 -5
  62. data/doc/rdoc/classes/RequestLog/Objects.src/{M000122.html → M000124.html} +5 -5
  63. data/doc/rdoc/classes/RequestLog/Params.src/{M000123.html → M000125.html} +5 -5
  64. data/doc/rdoc/classes/Stats.html +1 -1
  65. data/doc/rdoc/classes/Stats.src/M000012.html +2 -2
  66. data/doc/rdoc/created.rid +1 -1
  67. data/doc/rdoc/files/ext/http11/http11_c.html +1 -1
  68. data/doc/rdoc/files/lib/mongrel/command_rb.html +1 -1
  69. data/doc/rdoc/files/lib/mongrel/debug_rb.html +1 -1
  70. data/doc/rdoc/files/lib/mongrel/handlers_rb.html +1 -1
  71. data/doc/rdoc/files/lib/mongrel/stats_rb.html +1 -1
  72. data/doc/rdoc/files/lib/mongrel_rb.html +1 -1
  73. data/examples/random_thrash.rb +19 -0
  74. data/ext/http11/http11.c +57 -12
  75. data/ext/http11/http11_parser.c +58 -52
  76. data/lib/mongrel.rb +37 -10
  77. data/lib/mongrel/command.rb +1 -1
  78. data/lib/mongrel/debug.rb +39 -125
  79. data/lib/mongrel/handlers.rb +2 -2
  80. data/lib/mongrel/rails.rb +2 -1
  81. data/lib/mongrel/stats.rb +2 -2
  82. data/test/test_configurator.rb +2 -2
  83. data/test/test_debug.rb +2 -4
  84. data/test/test_http11.rb +76 -7
  85. data/test/test_stats.rb +6 -4
  86. data/test/test_uriclassifier.rb +0 -14
  87. metadata +12 -24
  88. data/doc/rdoc/classes/Mongrel/CGIWrapper.html +0 -383
  89. data/doc/rdoc/classes/Mongrel/Configurator.html +0 -563
  90. data/doc/rdoc/classes/Mongrel/Error404Handler.html +0 -171
  91. data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000115.html +0 -18
  92. data/doc/rdoc/classes/Mongrel/HttpHandler.html +0 -152
  93. data/doc/rdoc/classes/Mongrel/HttpRequest.html +0 -222
  94. data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000117.html +0 -28
  95. data/doc/rdoc/classes/Mongrel/HttpResponse.html +0 -371
  96. data/doc/rdoc/classes/Mongrel/URIClassifier.html +0 -301
  97. data/doc/rdoc/classes/RequestLog.html +0 -113
  98. data/doc/rdoc/classes/RequestLog/Files.html +0 -144
  99. data/doc/rdoc/classes/RequestLog/Objects.html +0 -144
  100. data/doc/rdoc/classes/RequestLog/Params.html +0 -144
  101. data/doc/rdoc/fr_class_index.html +0 -60
  102. data/doc/rdoc/fr_file_index.html +0 -40
  103. data/doc/rdoc/fr_method_index.html +0 -149
  104. data/doc/rdoc/index.html +0 -24
  105. data/lib/http11.bundle +0 -0
@@ -52,7 +52,7 @@ module Mongrel
52
52
  @opt.on_tail("--version", "Show version") do
53
53
  @done_validating = true
54
54
  if VERSION
55
- puts "Version #{VERSION}"
55
+ puts "Version #{MONGREL_VERSION}"
56
56
  end
57
57
  end
58
58
 
@@ -43,7 +43,6 @@ end
43
43
 
44
44
  module ObjectTracker
45
45
  @active_objects = nil
46
- @live_object_tracking = true
47
46
 
48
47
  def ObjectTracker.configure
49
48
  @active_objects = Set.new
@@ -53,45 +52,32 @@ module ObjectTracker
53
52
  end
54
53
  end
55
54
 
56
-
57
- def ObjectTracker.start
58
- @live_object_tracking = true
59
- end
60
-
61
- def ObjectTracker.stop
62
- @live_object_tracking = false
63
- end
64
-
65
55
  def ObjectTracker.sample
66
- Class.stopit do
67
- ospace = Set.new
68
- counts = {}
69
-
70
- # Strings can't be tracked easily and are so numerous that they drown out all else
71
- # so we just ignore them in the counts.
72
- ObjectSpace.each_object do |obj|
73
- if not obj.kind_of? String
74
- ospace << obj.object_id
75
- counts[obj.class] ||= 0
76
- counts[obj.class] += 1
77
- end
78
- end
79
-
80
- dead_objects = @active_objects - ospace
81
- new_objects = ospace - @active_objects
82
- live_objects = ospace & @active_objects
83
-
84
- MongrelDbg::trace(:objects, "COUNTS: #{dead_objects.length},#{new_objects.length},#{live_objects.length}")
85
-
86
- if MongrelDbg::tracing? :objects
87
- top_20 = counts.sort{|a,b| b[1] <=> a[1]}[0..20]
88
- MongrelDbg::trace(:objects,"TOP 20: #{top_20.inspect}")
89
- end
90
-
91
- @active_objects = live_objects + new_objects
92
-
93
- [@active_objects, top_20]
56
+ ospace = Set.new
57
+ counts = {}
58
+
59
+ # Strings can't be tracked easily and are so numerous that they drown out all else
60
+ # so we just ignore them in the counts.
61
+ ObjectSpace.each_object do |obj|
62
+ ospace << obj.object_id
63
+ counts[obj.class] ||= 0
64
+ counts[obj.class] += 1
65
+ end
66
+
67
+ dead_objects = @active_objects - ospace
68
+ new_objects = ospace - @active_objects
69
+ live_objects = ospace & @active_objects
70
+
71
+ MongrelDbg::trace(:objects, "COUNTS: #{dead_objects.length},#{new_objects.length},#{live_objects.length}")
72
+
73
+ if MongrelDbg::tracing? :objects
74
+ top_20 = counts.sort{|a,b| b[1] <=> a[1]}[0..20]
75
+ MongrelDbg::trace(:objects,"TOP 20: #{top_20.inspect}")
94
76
  end
77
+
78
+ @active_objects = live_objects + new_objects
79
+
80
+ [@active_objects, top_20]
95
81
  end
96
82
 
97
83
  end
@@ -123,102 +109,31 @@ module Kernel
123
109
  end
124
110
 
125
111
  def log_open_files
126
- Class.stopit do
127
- open_counts = {}
128
- $open_files.each do |f,args|
129
- open_counts[args] ||= 0
130
- open_counts[args] += 1
131
- end
132
- MongrelDbg::trace(:files, open_counts.to_yaml)
112
+ open_counts = {}
113
+ $open_files.each do |f,args|
114
+ open_counts[args] ||= 0
115
+ open_counts[args] += 1
133
116
  end
117
+ MongrelDbg::trace(:files, open_counts.to_yaml)
134
118
  end
135
119
  end
136
120
 
137
121
 
138
122
 
139
- class Class
140
- alias_method :orig_new, :new
141
-
142
- @@count = 0
143
- @@stopit = false
144
- @@class_caller_count = Hash.new{|hash,key| hash[key] = Hash.new(0)}
145
-
146
- def new(*arg,&blk)
147
- unless @@stopit
148
- @@stopit = true
149
- @@count += 1
150
- @@class_caller_count[self][caller.join("\n\t")] += 1
151
- @@stopit = false
152
- end
153
- orig_new(*arg,&blk)
154
- end
155
-
156
-
157
- def Class.report_object_creations(out=$stderr, more_than=20)
158
- Class.stopit do
159
- out.puts "Number of objects created = #{@@count}"
160
-
161
- total = Hash.new(0)
162
-
163
- @@class_caller_count.each_key do |klass|
164
- caller_count = @@class_caller_count[klass]
165
- caller_count.each_value do |count|
166
- total[klass] += count
167
- end
168
- end
169
-
170
- klass_list = total.keys.sort{|klass_a, klass_b|
171
- a = total[klass_a]
172
- b = total[klass_b]
173
- if a != b
174
- -1* (a <=> b)
175
- else
176
- klass_a.to_s <=> klass_b.to_s
177
- end
178
- }
179
-
180
- below_count = 0
181
-
182
- klass_list.each do |klass|
183
- below_calls = 0
184
- if total[klass] > more_than
185
- out.puts "#{total[klass]}\t#{klass} objects created."
186
- caller_count = @@class_caller_count[ klass]
187
- caller_count.keys.sort_by{|call| -1*caller_count[call]}.each do |call|
188
- if caller_count[call] > more_than
189
- out.puts "\t** #{caller_count[call]} #{klass} objects AT:"
190
- out.puts "\t#{call}\n\n"
191
- else
192
- below_calls += 1
193
- end
194
- end
195
- out.puts "\t#{below_calls} more objects had calls less that #{more_than} limit.\n\n" if below_calls > 0
196
- else
197
- below_count += 1
198
- end
199
- end
200
-
201
- out.puts "\t** #{below_count} More objects were created but the count was below the #{more_than} limit." if below_count > 0
202
- end
203
- end
123
+ module RequestLog
204
124
 
205
- def Class.reset_object_creations
206
- Class.stopit do
207
- @@count = 0
208
- @@class_caller_count = Hash.new{|hash,key| hash[key] = Hash.new(0)}
125
+ # Just logs whatever requests it gets to STDERR (which ends up in the mongrel
126
+ # log when daemonized).
127
+ class Access < GemPlugin::Plugin "/handlers"
128
+ include Mongrel::HttpHandlerPlugin
129
+
130
+ def process(request,response)
131
+ p = request.params
132
+ STDERR.puts "#{p['REMOTE_ADDR']} - [#{Mongrel::HttpServer.httpdate(Time.now)}] \"#{p['REQUEST_METHOD']} #{p["REQUEST_URI"]} HTTP/1.1\""
209
133
  end
210
134
  end
135
+
211
136
 
212
- def Class.stopit
213
- @@stopit = true
214
- yield
215
- @@stopit = false
216
- end
217
-
218
- end
219
-
220
-
221
- module RequestLog
222
137
  class Files < GemPlugin::Plugin "/handlers"
223
138
  include Mongrel::HttpHandlerPlugin
224
139
 
@@ -253,7 +168,6 @@ end
253
168
 
254
169
 
255
170
  END {
256
- open("log/mongrel_debug/object_tracking.log", "w") {|f| Class.report_object_creations(f) }
257
171
  MongrelDbg::trace(:files, "FILES OPEN AT EXIT")
258
172
  log_open_files
259
173
  }
@@ -169,7 +169,7 @@ module Mongrel
169
169
  ext = req[dot_at .. -1]
170
170
  if MIME_TYPES[ext]
171
171
  stat = File.stat(req)
172
- response.header[Const::CONTENT_TYPE] = MIME_TYPES[ext]
172
+ response.header[Const::CONTENT_TYPE] = MIME_TYPES[ext] || "text"
173
173
  # TODO: Confirm this works for rfc 1123
174
174
  response.header[Const::LAST_MODIFIED] = HttpServer.httpdate(stat.mtime)
175
175
  # TODO that this is a valid way to calculate an etag
@@ -187,7 +187,7 @@ module Mongrel
187
187
  else
188
188
  File.open(req, "rb") { |f| response.socket.write(f.read) }
189
189
  end
190
- rescue EOFError,Errno::ECONNRESET,Errno::EPIPE
190
+ rescue EOFError,Errno::ECONNRESET,Errno::EPIPE,Errno::EINVAL
191
191
  # ignore these since it means the client closed off early
192
192
  end
193
193
  else
@@ -132,7 +132,8 @@ module Mongrel
132
132
 
133
133
  $orig_dollar_quote = $".clone
134
134
  ENV['RAILS_ENV'] = ops[:environment]
135
- require "#{ops[:cwd]}/config/environment"
135
+ env_location = "#{ops[:cwd]}/config/environment"
136
+ require env_location
136
137
  require 'dispatcher'
137
138
  require 'mongrel/rails'
138
139
 
@@ -38,8 +38,8 @@ class Stats
38
38
  end
39
39
 
40
40
  # Dump this Stats object with an optional additional message.
41
- def dump(msg = "")
42
- STDERR.puts "[#{@name}] #{msg} : SUM=#@sum, SUMSQ=#@sumsq, N=#@n, MEAN=#{mean}, SD=#{sd}, MIN=#@min, MAX=#@max"
41
+ def dump(msg = "", out=STDERR)
42
+ out.puts "[#{@name}] #{msg} : SUM=#@sum, SUMSQ=#@sumsq, N=#@n, MEAN=#{mean}, SD=#{sd}, MIN=#@min, MAX=#@max"
43
43
  end
44
44
 
45
45
  # Calculates and returns the mean for the data passed so far.
@@ -29,12 +29,12 @@ class ConfiguratorTest < Test::Unit::TestCase
29
29
  # 2 in front should run, but the sentinel shouldn't since dirhandler processes the request
30
30
  uri "/", :handler => plugin("/handlers/testplugin")
31
31
  uri "/", :handler => plugin("/handlers/testplugin")
32
- uri "/", :handler => Mongrel::DirHandler.new(".", load_mime_map("examples/mime.yaml"))
32
+ uri "/", :handler => Mongrel::DirHandler.new(".")
33
33
  uri "/", :handler => plugin("/handlers/testplugin")
34
34
 
35
35
  uri "/test", :handler => plugin("/handlers/testplugin")
36
36
  uri "/test", :handler => plugin("/handlers/testplugin")
37
- uri "/test", :handler => Mongrel::DirHandler.new(".", load_mime_map("examples/mime.yaml"))
37
+ uri "/test", :handler => Mongrel::DirHandler.new(".")
38
38
  uri "/test", :handler => plugin("/handlers/testplugin")
39
39
  run
40
40
  end
@@ -15,6 +15,8 @@ class MongrelDbgTest < Test::Unit::TestCase
15
15
 
16
16
 
17
17
  def test_tracing_to_log
18
+ out = StringIO.new
19
+
18
20
  MongrelDbg::begin_trace(:rails)
19
21
  MongrelDbg::trace(:rails, "Good stuff")
20
22
  MongrelDbg::end_trace(:rails)
@@ -22,10 +24,6 @@ class MongrelDbgTest < Test::Unit::TestCase
22
24
  assert File.exist?("log/mongrel_debug"), "Didn't make logging directory"
23
25
  assert File.exist?("log/mongrel_debug/rails.log"), "Didn't make the rails.log file"
24
26
  assert File.size("log/mongrel_debug/rails.log") > 0, "Didn't write anything to the log."
25
-
26
- Class.report_object_creations
27
- Class.reset_object_creations
28
- Class.report_object_creations
29
27
  end
30
28
 
31
29
  end
@@ -2,6 +2,7 @@ require 'test/unit'
2
2
  require 'http11'
3
3
  require 'mongrel'
4
4
  require 'benchmark'
5
+ require 'digest/sha1'
5
6
 
6
7
  include Mongrel
7
8
 
@@ -38,17 +39,85 @@ class HttpParserTest < Test::Unit::TestCase
38
39
  assert parser.error?, "Parser SHOULD have error"
39
40
  end
40
41
 
41
- def test_query_parse
42
- puts HttpRequest.query_parse("zed=1&frank=2").inspect
43
- puts HttpRequest.query_parse("zed=1&zed=2&zed=3&frank=11;zed=45").inspect
42
+ # lame random garbage maker
43
+ def rand_data(min, max, readable=true)
44
+ count = min + ((rand(max)+1) *10).to_i
45
+ res = count.to_s + "/"
46
+
47
+ if readable
48
+ res << Digest::SHA1.hexdigest(rand(count * 1000).to_s) * (count / 40)
49
+ else
50
+ res << Digest::SHA1.digest(rand(count * 1000).to_s) * (count / 20)
51
+ end
52
+
53
+ return res
54
+ end
55
+
56
+
57
+ def test_horrible_queries
58
+ parser = HttpParser.new
59
+
60
+ # first verify that large random get requests fail
61
+ 100.times do |c|
62
+ get = "GET /#{rand_data(1024, 1024+(c*1024))} HTTP/1.1\r\n"
63
+ assert_raises Mongrel::HttpParserError do
64
+ parser.execute({}, get)
65
+ parser.reset
66
+ end
67
+ end
68
+
69
+ # then that large header names are caught
70
+ 100.times do |c|
71
+ get = "GET /#{rand_data(10,120)} HTTP/1.1\r\nX-#{rand_data(1024, 1024+(c*1024))}: Test\r\n\r\n"
72
+ assert_raises Mongrel::HttpParserError do
73
+ parser.execute({}, get)
74
+ parser.reset
75
+ end
76
+ end
44
77
 
45
- puts Benchmark.measure {
46
- 10000.times do |i|
47
- g = HttpRequest.query_parse("zed=1&zed=2&zed=3&frank=11").inspect
78
+ # then that large mangled field values are caught
79
+ 100.times do |c|
80
+ get = "GET /#{rand_data(10,120)} HTTP/1.1\r\nX-Test: #{rand_data(1024, 1024+(c*1024), false)}\r\n\r\n"
81
+ assert_raises Mongrel::HttpParserError do
82
+ parser.execute({}, get)
83
+ parser.reset
48
84
  end
49
- }
85
+ end
86
+
87
+ # then large headers are rejected too
88
+ get = "GET /#{rand_data(10,120)} HTTP/1.1\r\n"
89
+ get << "X-Test: test\r\n" * (80 * 1024)
90
+ assert_raises Mongrel::HttpParserError do
91
+ parser.execute({}, get)
92
+ parser.reset
93
+ end
94
+
95
+ # finally just that random garbage gets blocked all the time
96
+ 10.times do |c|
97
+ get = "GET #{rand_data(1024, 1024+(c*1024), false)} #{rand_data(1024, 1024+(c*1024), false)}\r\n\r\n"
98
+ assert_raises Mongrel::HttpParserError do
99
+ parser.execute({}, get)
100
+ parser.reset
101
+ end
102
+ end
103
+
50
104
  end
51
105
 
52
106
 
107
+
108
+ def test_query_parse
109
+ res = HttpRequest.query_parse("zed=1&frank=2")
110
+ assert res["zed"], "didn't get the request right"
111
+ assert res["frank"], "no frank"
112
+ assert_equal "1", res["zed"], "wrong result"
113
+ assert_equal "2", res["frank"], "wrong result"
114
+
115
+ res = HttpRequest.query_parse("zed=1&zed=2&zed=3&frank=11;zed=45")
116
+ assert res["zed"], "didn't get the request right"
117
+ assert res["frank"], "no frank"
118
+ assert_equal 4,res["zed"].length, "wrong number for zed"
119
+ assert_equal "11",res["frank"], "wrong number for frank"
120
+ end
121
+
53
122
  end
54
123
 
@@ -4,13 +4,15 @@ require 'mongrel/stats'
4
4
  class StatsTest < Test::Unit::TestCase
5
5
 
6
6
  def test_sampling_speed
7
+ out = StringIO.new
8
+
7
9
  s = Stats.new("test")
8
10
  t = Stats.new("time")
9
11
 
10
12
  10000.times { s.sample(rand(20)); t.tick }
11
13
 
12
- s.dump("FIRST")
13
- t.dump("FIRST")
14
+ s.dump("FIRST", out)
15
+ t.dump("FIRST", out)
14
16
 
15
17
  old_mean = s.mean
16
18
  old_sd = s.sd
@@ -19,8 +21,8 @@ class StatsTest < Test::Unit::TestCase
19
21
  t.reset
20
22
  10000.times { s.sample(rand(20)); t.tick }
21
23
 
22
- s.dump("SECOND")
23
- t.dump("SECOND")
24
+ s.dump("SECOND", out)
25
+ t.dump("SECOND", out)
24
26
  assert_not_equal old_mean, s.mean
25
27
  assert_not_equal old_mean, s.sd
26
28
  end
@@ -91,20 +91,6 @@ class URIClassifierTest < Test::Unit::TestCase
91
91
  end
92
92
 
93
93
 
94
- def test_performance
95
- count = 8500
96
- u = URIClassifier.new
97
- u.register("stuff",1)
98
-
99
- res = Benchmark.measure { count.times { u.resolve("stuff") } }
100
-
101
- reg_unreg = Benchmark.measure { count.times { u.register("other",1); u.unregister("other"); } }
102
-
103
- puts "\nRESOLVE(#{count}): #{res}"
104
- puts "REG_UNREG(#{count}): #{reg_unreg}"
105
- end
106
-
107
-
108
94
  def test_uri_branching
109
95
  u = URIClassifier.new
110
96
  u.register("/test", 1)
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: mongrel
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.3.12
7
- date: 2006-03-30 00:00:00 -05:00
6
+ version: 0.3.12.1
7
+ date: 2006-04-04 00:00:00 -04:00
8
8
  summary: A small fast HTTP library and server that runs Rails, Camping, and Nitro apps.
9
9
  require_paths:
10
10
  - lib
@@ -38,10 +38,6 @@ files:
38
38
  - doc/rdoc/classes
39
39
  - doc/rdoc/created.rid
40
40
  - doc/rdoc/files
41
- - doc/rdoc/fr_class_index.html
42
- - doc/rdoc/fr_file_index.html
43
- - doc/rdoc/fr_method_index.html
44
- - doc/rdoc/index.html
45
41
  - doc/rdoc/rdoc-style.css
46
42
  - doc/rdoc/classes/Class.html
47
43
  - doc/rdoc/classes/Class.src
@@ -56,7 +52,6 @@ files:
56
52
  - doc/rdoc/classes/ObjectTracker.html
57
53
  - doc/rdoc/classes/ObjectTracker.src
58
54
  - doc/rdoc/classes/RequestLog
59
- - doc/rdoc/classes/RequestLog.html
60
55
  - doc/rdoc/classes/Stats.html
61
56
  - doc/rdoc/classes/Stats.src
62
57
  - doc/rdoc/classes/TCPServer.html
@@ -72,35 +67,28 @@ files:
72
67
  - doc/rdoc/classes/Mongrel/Camping
73
68
  - doc/rdoc/classes/Mongrel/Camping.html
74
69
  - doc/rdoc/classes/Mongrel/Camping.src
75
- - doc/rdoc/classes/Mongrel/CGIWrapper.html
76
70
  - doc/rdoc/classes/Mongrel/CGIWrapper.src
77
71
  - doc/rdoc/classes/Mongrel/Command
78
72
  - doc/rdoc/classes/Mongrel/Command.html
79
- - doc/rdoc/classes/Mongrel/Configurator.html
80
73
  - doc/rdoc/classes/Mongrel/Configurator.src
81
74
  - doc/rdoc/classes/Mongrel/Const.html
82
75
  - doc/rdoc/classes/Mongrel/DirHandler.html
83
76
  - doc/rdoc/classes/Mongrel/DirHandler.src
84
- - doc/rdoc/classes/Mongrel/Error404Handler.html
85
77
  - doc/rdoc/classes/Mongrel/Error404Handler.src
86
78
  - doc/rdoc/classes/Mongrel/HeaderOut.html
87
79
  - doc/rdoc/classes/Mongrel/HeaderOut.src
88
- - doc/rdoc/classes/Mongrel/HttpHandler.html
89
80
  - doc/rdoc/classes/Mongrel/HttpHandler.src
90
81
  - doc/rdoc/classes/Mongrel/HttpHandlerPlugin.html
91
82
  - doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src
92
83
  - doc/rdoc/classes/Mongrel/HttpParser.html
93
84
  - doc/rdoc/classes/Mongrel/HttpParser.src
94
- - doc/rdoc/classes/Mongrel/HttpRequest.html
85
+ - doc/rdoc/classes/Mongrel/HttpParserError.html
95
86
  - doc/rdoc/classes/Mongrel/HttpRequest.src
96
- - doc/rdoc/classes/Mongrel/HttpResponse.html
97
87
  - doc/rdoc/classes/Mongrel/HttpResponse.src
98
88
  - doc/rdoc/classes/Mongrel/HttpServer.html
99
89
  - doc/rdoc/classes/Mongrel/HttpServer.src
100
90
  - doc/rdoc/classes/Mongrel/Rails
101
91
  - doc/rdoc/classes/Mongrel/Rails.html
102
- - doc/rdoc/classes/Mongrel/StopServer.html
103
- - doc/rdoc/classes/Mongrel/URIClassifier.html
104
92
  - doc/rdoc/classes/Mongrel/URIClassifier.src
105
93
  - doc/rdoc/classes/Mongrel/Camping/CampingHandler.html
106
94
  - doc/rdoc/classes/Mongrel/Camping/CampingHandler.src
@@ -149,14 +137,15 @@ files:
149
137
  - doc/rdoc/classes/Mongrel/Configurator.src/M000112.html
150
138
  - doc/rdoc/classes/Mongrel/Configurator.src/M000113.html
151
139
  - doc/rdoc/classes/Mongrel/Configurator.src/M000114.html
140
+ - doc/rdoc/classes/Mongrel/Configurator.src/M000115.html
152
141
  - doc/rdoc/classes/Mongrel/DirHandler.src/M000058.html
153
142
  - doc/rdoc/classes/Mongrel/DirHandler.src/M000059.html
154
143
  - doc/rdoc/classes/Mongrel/DirHandler.src/M000060.html
155
144
  - doc/rdoc/classes/Mongrel/DirHandler.src/M000061.html
156
145
  - doc/rdoc/classes/Mongrel/DirHandler.src/M000062.html
157
146
  - doc/rdoc/classes/Mongrel/DirHandler.src/M000063.html
158
- - doc/rdoc/classes/Mongrel/Error404Handler.src/M000115.html
159
147
  - doc/rdoc/classes/Mongrel/Error404Handler.src/M000116.html
148
+ - doc/rdoc/classes/Mongrel/Error404Handler.src/M000117.html
160
149
  - doc/rdoc/classes/Mongrel/HeaderOut.src/M000072.html
161
150
  - doc/rdoc/classes/Mongrel/HeaderOut.src/M000073.html
162
151
  - doc/rdoc/classes/Mongrel/HttpHandler.src/M000074.html
@@ -169,10 +158,10 @@ files:
169
158
  - doc/rdoc/classes/Mongrel/HttpParser.src/M000055.html
170
159
  - doc/rdoc/classes/Mongrel/HttpParser.src/M000056.html
171
160
  - doc/rdoc/classes/Mongrel/HttpParser.src/M000057.html
172
- - doc/rdoc/classes/Mongrel/HttpRequest.src/M000117.html
173
161
  - doc/rdoc/classes/Mongrel/HttpRequest.src/M000118.html
174
162
  - doc/rdoc/classes/Mongrel/HttpRequest.src/M000119.html
175
163
  - doc/rdoc/classes/Mongrel/HttpRequest.src/M000120.html
164
+ - doc/rdoc/classes/Mongrel/HttpRequest.src/M000121.html
176
165
  - doc/rdoc/classes/Mongrel/HttpResponse.src/M000075.html
177
166
  - doc/rdoc/classes/Mongrel/HttpResponse.src/M000076.html
178
167
  - doc/rdoc/classes/Mongrel/HttpResponse.src/M000077.html
@@ -215,15 +204,14 @@ files:
215
204
  - doc/rdoc/classes/ObjectTracker.src/M000017.html
216
205
  - doc/rdoc/classes/ObjectTracker.src/M000018.html
217
206
  - doc/rdoc/classes/ObjectTracker.src/M000019.html
218
- - doc/rdoc/classes/RequestLog/Files.html
207
+ - doc/rdoc/classes/RequestLog/Access.src
219
208
  - doc/rdoc/classes/RequestLog/Files.src
220
- - doc/rdoc/classes/RequestLog/Objects.html
221
209
  - doc/rdoc/classes/RequestLog/Objects.src
222
- - doc/rdoc/classes/RequestLog/Params.html
223
210
  - doc/rdoc/classes/RequestLog/Params.src
224
- - doc/rdoc/classes/RequestLog/Files.src/M000121.html
225
- - doc/rdoc/classes/RequestLog/Objects.src/M000122.html
226
- - doc/rdoc/classes/RequestLog/Params.src/M000123.html
211
+ - doc/rdoc/classes/RequestLog/Access.src/M000122.html
212
+ - doc/rdoc/classes/RequestLog/Files.src/M000123.html
213
+ - doc/rdoc/classes/RequestLog/Objects.src/M000124.html
214
+ - doc/rdoc/classes/RequestLog/Params.src/M000125.html
227
215
  - doc/rdoc/classes/Stats.src/M000009.html
228
216
  - doc/rdoc/classes/Stats.src/M000010.html
229
217
  - doc/rdoc/classes/Stats.src/M000011.html
@@ -257,7 +245,6 @@ files:
257
245
  - test/test_stats.rb
258
246
  - test/test_uriclassifier.rb
259
247
  - test/test_ws.rb
260
- - lib/http11.bundle
261
248
  - lib/mongrel
262
249
  - lib/mongrel.rb
263
250
  - lib/mongrel/camping.rb
@@ -285,6 +272,7 @@ files:
285
272
  - examples/builder.rb
286
273
  - examples/mongrel_simple_ctrl.rb
287
274
  - examples/mongrel_simple_service.rb
275
+ - examples/random_thrash.rb
288
276
  - examples/simpletest.rb
289
277
  - examples/webrick_compare.rb
290
278
  - examples/camping/blog.rb