about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-05-05 16:42:26 -0700
committerEric Wong <normalperson@yhbt.net>2011-05-05 16:42:26 -0700
commit77a951c5da518dda471282635c98f3b572ca15db (patch)
tree7e87f472c615c6e5522d5a5efc79fe4c5cb7bd18 /t
parent733cb68e444a6f324bb1ffda3839da98ef010c74 (diff)
downloadunicorn-77a951c5da518dda471282635c98f3b572ca15db.tar.gz
Rainbows! wants to be able to lower this eventually...
Diffstat (limited to 't')
-rw-r--r--t/t0019-max_header_len.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/t/t0019-max_header_len.sh b/t/t0019-max_header_len.sh
new file mode 100644
index 0000000..5ce1c69
--- /dev/null
+++ b/t/t0019-max_header_len.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+. ./test-lib.sh
+t_plan 5 "max_header_len setting (only intended for Rainbows!)"
+
+t_begin "setup and start" && {
+        unicorn_setup
+        req='GET / HTTP/1.0\r\n\r\n'
+        len=$(printf "$req" | wc -c)
+        echo Unicorn::HttpParser.max_header_len = $len >> $unicorn_config
+        unicorn -D -c $unicorn_config env.ru
+        unicorn_wait_start
+}
+
+t_begin "minimal request succeeds" && {
+        rm -f $tmp
+        (
+                cat $fifo > $tmp &
+                printf "$req"
+                wait
+                echo ok > $ok
+        ) | socat - TCP:$listen > $fifo
+        test xok = x$(cat $ok)
+
+        fgrep "HTTP/1.1 200 OK" $tmp
+}
+
+t_begin "big request fails" && {
+        rm -f $tmp
+        (
+                cat $fifo > $tmp &
+                printf 'GET /xxxxxx HTTP/1.0\r\n\r\n'
+                wait
+                echo ok > $ok
+        ) | socat - TCP:$listen > $fifo
+        test xok = x$(cat $ok)
+        fgrep "HTTP/1.1 413" $tmp
+}
+
+dbgcat tmp
+
+t_begin "killing succeeds" && {
+        kill $unicorn_pid
+}
+
+t_begin "check stderr" && {
+        check_stderr
+}
+
+t_done