about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--Manifest2
-rwxr-xr-xexamples/cat-chunk-proxy.rb65
-rw-r--r--examples/echo.ru3
-rw-r--r--examples/git.ru8
4 files changed, 9 insertions, 69 deletions
diff --git a/Manifest b/Manifest
index fda8533..72ff78d 100644
--- a/Manifest
+++ b/Manifest
@@ -15,7 +15,6 @@ TODO
 TUNING
 bin/unicorn
 bin/unicorn_rails
-examples/cat-chunk-proxy.rb
 examples/echo.ru
 examples/git.ru
 examples/init.sh
@@ -136,5 +135,6 @@ test/unit/test_response.rb
 test/unit/test_server.rb
 test/unit/test_signals.rb
 test/unit/test_socket_helper.rb
+test/unit/test_trailer_parser.rb
 test/unit/test_upload.rb
 test/unit/test_util.rb
diff --git a/examples/cat-chunk-proxy.rb b/examples/cat-chunk-proxy.rb
deleted file mode 100755
index ca775e7..0000000
--- a/examples/cat-chunk-proxy.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/home/ew/bin/ruby
-# I wish I could just use curl --no-buffer -sSfT- http://host:port/, but
-# unfortunately curl will attempt to read stdin in blocking mode,
-# preventing it from getting responses from the server until stdin has
-# been written to.
-#
-# For a patch that enables using curl(1) instead of this script:
-#
-#   http://mid.gmane.org/20090607101700.GB19407@dcvr.yhbt.net
-#
-# Usage: GIT_PROXY_COMMAND=/path/to/here git clone
-# git://host:port/project
-#
-# Where host:port is what the Unicorn server is bound to
-
-require 'socket'
-require 'unicorn'
-require 'unicorn/chunked_reader'
-
-$stdin.sync = $stdout.sync = $stderr.sync = true
-$stdin.binmode
-$stdout.binmode
-
-usage = "#$0 HOST PORT"
-host = ARGV.shift or abort usage
-port = ARGV.shift or abort usage
-s = TCPSocket.new(host, port.to_i)
-s.sync = true
-s.write("PUT / HTTP/1.1\r\n" \
-        "Host: #{host}\r\n" \
-        "Transfer-Encoding: chunked\r\n\r\n")
-buf = s.readpartial(16384)
-while /\r\n\r\n/ !~ buf
-  buf << s.readpartial(16384)
-end
-
-head, body = buf.split(/\r\n\r\n/, 2)
-
-input = fork {
-  $0 = "input #$0"
-  begin
-    loop {
-      $stdin.readpartial(16384, buf)
-      s.write("#{'%x' % buf.size}\r\n#{buf}\r\n")
-    }
-  rescue EOFError,Errno::EPIPE,Errno::EBADF,Errno::EINVAL => e
-  end
-  s.write("0\r\n\r\n")
-}
-
-output = fork {
-  $0 = "output #$0"
-
-  c = Unicorn::ChunkedReader.new
-  c.reopen(s, body)
-  begin
-    loop { $stdout.write(c.readpartial(16384, buf)) }
-  rescue EOFError,Errno::EPIPE,Errno::EBADF,Errno::EINVAL => e
-  end
-}
-
-2.times {
-  pid, status = Process.waitpid2
-  $stderr.write("reaped: #{status.inspect}\n") unless status.success?
-}
diff --git a/examples/echo.ru b/examples/echo.ru
index ebc4d9d..322fe94 100644
--- a/examples/echo.ru
+++ b/examples/echo.ru
@@ -1,9 +1,10 @@
 #\-E none
+#
 # Example application that echoes read data back to the HTTP client.
 # This emulates the old echo protocol people used to run.
 #
 # An example of using this in a client would be to run:
-#   curl -NT- http://host:port/
+#   curl --no-buffer -T- http://host:port/
 #
 # Then type random stuff in your terminal to watch it get echoed back!
 
diff --git a/examples/git.ru b/examples/git.ru
index 3762d3d..59a31c9 100644
--- a/examples/git.ru
+++ b/examples/git.ru
@@ -1,9 +1,13 @@
 #\-E none
+
+# See http://thread.gmane.org/gmane.comp.web.curl.general/10473/raw on
+# how to setup git for this.  A better version of the above patch was
+# accepted and committed on June 15, 2009, so you can pull the latest
+# curl CVS snapshot to try this out.
 require 'unicorn/app/inetd'
 
 use Rack::Lint
-use Rack::Chunked
-# run Unicorn::App::Inetd.new('tee', '/tmp/tee.out')
+use Rack::Chunked # important!
 run Unicorn::App::Inetd.new(
  *%w(git daemon --verbose --inetd --export-all --base-path=/home/ew/unicorn)
 )