diff options
author | Blake Mizerany <blake.mizerany@gmail.com> | 2010-06-29 23:12:46 -0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2010-06-29 23:59:24 -0700 |
commit | 8c8534046c5ce25ad58cde5b71bc4a189e7fb7a8 (patch) | |
tree | e2443cb9a07d906791c13aeb6ea9737a95776fb2 /benchmark | |
parent | f8ca6b383c1cac95ba9a9bcddfe66cc62b09558b (diff) | |
download | android-node-v8-8c8534046c5ce25ad58cde5b71bc4a189e7fb7a8.tar.gz android-node-v8-8c8534046c5ce25ad58cde5b71bc4a189e7fb7a8.tar.bz2 android-node-v8-8c8534046c5ce25ad58cde5b71bc4a189e7fb7a8.zip |
fix whitespace errors
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/http_simple.js | 4 | ||||
-rw-r--r-- | benchmark/http_simple.rb | 28 |
2 files changed, 16 insertions, 16 deletions
diff --git a/benchmark/http_simple.js b/benchmark/http_simple.js index 74e44961b5..446b3b33f4 100644 --- a/benchmark/http_simple.js +++ b/benchmark/http_simple.js @@ -28,7 +28,7 @@ http.createServer(function (req, res) { if (command == "bytes") { var n = parseInt(arg, 10) if (n <= 0) - throw "bytes called with n <= 0" + throw "bytes called with n <= 0" if (stored[n] === undefined) { console.log("create stored[n]"); stored[n] = ""; @@ -64,7 +64,7 @@ http.createServer(function (req, res) { var content_length = body.length.toString(); - res.writeHead( status + res.writeHead( status , { "Content-Type": "text/plain" , "Content-Length": content_length } diff --git a/benchmark/http_simple.rb b/benchmark/http_simple.rb index ee33f57f1d..e9a44fa9fd 100644 --- a/benchmark/http_simple.rb +++ b/benchmark/http_simple.rb @@ -7,45 +7,45 @@ end def wait(seconds) n = (seconds / 0.01).to_i - n.times do + n.times do sleep(0.01) - #File.read(DIR + '/yahoo.html') + #File.read(DIR + '/yahoo.html') end end class SimpleApp @@responses = {} - + def initialize @count = 0 end - + def deferred?(env) false end - + def call(env) path = env['PATH_INFO'] || env['REQUEST_URI'] commands = path.split('/') - + @count += 1 if commands.include?('periodical_activity') and @count % 10 != 1 return [200, {'Content-Type'=>'text/plain'}, "quick response!\r\n"] end - + if commands.include?('fibonacci') n = commands.last.to_i raise "fibonacci called with n <= 0" if n <= 0 body = (1..n).to_a.map { |i| fib(i).to_s }.join(' ') status = 200 - + elsif commands.include?('wait') n = commands.last.to_f raise "wait called with n <= 0" if n <= 0 wait(n) body = "waited about #{n} seconds" status = 200 - + elsif commands.include?('bytes') n = commands.last.to_i raise "bytes called with n <= 0" if n <= 0 @@ -56,17 +56,17 @@ class SimpleApp n = 20 * 1024; body = @@responses[n] || "C"*n status = 200 - + elsif commands.include?('test_post_length') input_body = "" while chunk = env['rack.input'].read(512) - input_body << chunk + input_body << chunk end if env['CONTENT_LENGTH'].to_i == input_body.length body = "Content-Length matches input length" status = 200 else - body = "Content-Length doesn't matches input length! + body = "Content-Length doesn't matches input length! content_length = #{env['CONTENT_LENGTH'].to_i} input_body.length = #{input_body.length}" status = 500 @@ -75,7 +75,7 @@ class SimpleApp status = 404 body = "Undefined url" end - + body += "\r\n" headers = {'Content-Type' => 'text/plain', 'Content-Length' => body.length.to_s } [status, headers, [body]] @@ -90,6 +90,6 @@ if $0 == __FILE__ require 'thin' require 'ebb' # Rack::Handler::Mongrel.run(SimpleApp.new, :Port => 8000) - Thin::Server.start("0.0.0.0", 8000, SimpleApp.new) + Thin::Server.start("0.0.0.0", 8000, SimpleApp.new) # Ebb::start_server(SimpleApp.new, :port => 8000) end |