From 77a951c5da518dda471282635c98f3b572ca15db Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 5 May 2011 16:42:26 -0700 Subject: http_parser: add max_header_len accessor Rainbows! wants to be able to lower this eventually... --- t/t0019-max_header_len.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 t/t0019-max_header_len.sh (limited to 't') 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 -- cgit v1.2.3-24-ge0c7