about summary refs log tree commit homepage
path: root/test/rails/app-2.3.3.1/app/controllers/foo_controller.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-07-20 12:09:41 -0700
committerEric Wong <normalperson@yhbt.net>2009-07-20 12:09:41 -0700
commitfefbed6c37e1b8b4213a7b8fe8ecc58809ebc05d (patch)
treedcee0a005e09061a07e8c9191304ccf520b68f72 /test/rails/app-2.3.3.1/app/controllers/foo_controller.rb
parenta8dfa694d76b9600d9cfdef624e15d5d9d730aee (diff)
downloadunicorn-fefbed6c37e1b8b4213a7b8fe8ecc58809ebc05d.tar.gz
Diffstat (limited to 'test/rails/app-2.3.3.1/app/controllers/foo_controller.rb')
-rw-r--r--test/rails/app-2.3.3.1/app/controllers/foo_controller.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/rails/app-2.3.3.1/app/controllers/foo_controller.rb b/test/rails/app-2.3.3.1/app/controllers/foo_controller.rb
new file mode 100644
index 0000000..261669c
--- /dev/null
+++ b/test/rails/app-2.3.3.1/app/controllers/foo_controller.rb
@@ -0,0 +1,34 @@
+require 'digest/sha1'
+class FooController < ApplicationController
+  def index
+    render :text => "FOO\n"
+  end
+
+  def xcookie
+    cookies["foo"] = "cookie-#$$-#{session[:gotta_use_the_session_in_2_3]}"
+    render :text => ""
+  end
+
+  def xnotice
+    flash[:notice] = "session #$$"
+    render :text => ""
+  end
+
+  def xpost
+    if request.post?
+      digest = Digest::SHA1.new
+      out = "params: #{params.inspect}\n"
+      if file = params[:file]
+        loop do
+          buf = file.read(4096) or break
+          digest.update(buf)
+        end
+        out << "sha1: #{digest.to_s}\n"
+      end
+      headers['content-type'] = 'text/plain'
+      render :text => out
+    else
+      render :status => 403, :text => "need post\n"
+    end
+  end
+end