3 t_plan
11 "parser error test"
5 t_begin
"setup and startup" && {
7 unicorn
-D env.ru
-c $unicorn_config
11 t_begin
"send a bad request" && {
13 printf 'GET / HTTP/1/1\r\nHost: example.com\r\n\r\n'
17 ) | socat
- TCP
:$listen > $fifo
18 test xok
= x$
(cat $ok)
23 t_begin
"response should be a 400" && {
24 grep -F 'HTTP/1.1 400 Bad Request' $tmp
27 t_begin
"send a huge Request URI (REQUEST_PATH > (12 * 1024))" && {
32 trap 'echo ok > $ok' EXIT
34 for i
in $
(awk </dev
/null
'BEGIN{for(i=0;i<1024;i++) print i}')
38 printf ' HTTP/1.1\r\nHost: example.com\r\n\r\n'
39 ) | socat
- TCP
:$listen > $fifo ||
:
40 test xok
= x$
(cat $ok)
44 t_begin
"response should be a 414 (REQUEST_PATH)" && {
45 grep -F 'HTTP/1.1 414 Request-URI Too Long' $tmp
48 t_begin
"send a huge Request URI (QUERY_STRING > (10 * 1024))" && {
53 trap 'echo ok > $ok' EXIT
54 printf 'GET /hello-world?a'
55 for i
in $
(awk </dev
/null
'BEGIN{for(i=0;i<1024;i++) print i}')
59 printf ' HTTP/1.1\r\nHost: example.com\r\n\r\n'
60 ) | socat
- TCP
:$listen > $fifo ||
:
61 test xok
= x$
(cat $ok)
65 t_begin
"response should be a 414 (QUERY_STRING)" && {
66 grep -F 'HTTP/1.1 414 Request-URI Too Long' $tmp
69 t_begin
"send a huge Request URI (FRAGMENT > 1024)" && {
74 trap 'echo ok > $ok' EXIT
75 printf 'GET /hello-world#a'
76 for i
in $
(awk </dev
/null
'BEGIN{for(i=0;i<64;i++) print i}')
78 printf '0123456789abcdef'
80 printf ' HTTP/1.1\r\nHost: example.com\r\n\r\n'
81 ) | socat
- TCP
:$listen > $fifo ||
:
82 test xok
= x$
(cat $ok)
86 t_begin
"response should be a 414 (FRAGMENT)" && {
87 grep -F 'HTTP/1.1 414 Request-URI Too Long' $tmp
90 t_begin
"server stderr should be clean" && check_stderr
92 t_begin
"term signal sent" && kill $unicorn_pid