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 'wait && 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)
43 t_begin
"response should be a 414" && {
44 grep -F 'HTTP/1.1 414 Request-URI Too Long' $tmp
47 t_begin
"send a huge Request URI (QUERY_STRING > (10 * 1024))" && {
52 trap 'wait && echo ok > $ok' EXIT
53 printf 'GET /hello-world?a'
54 for i
in $
(awk </dev
/null
'BEGIN{for(i=0;i<1024;i++) print i}')
58 printf ' HTTP/1.1\r\nHost: example.com\r\n\r\n'
59 ) | socat
- TCP
:$listen > $fifo ||
:
60 test xok
= x$
(cat $ok)
63 t_begin
"response should be a 414" && {
64 grep -F 'HTTP/1.1 414 Request-URI Too Long' $tmp
67 t_begin
"send a huge Request URI (FRAGMENT > 1024)" && {
72 trap 'wait && echo ok > $ok' EXIT
73 printf 'GET /hello-world#a'
74 for i
in $
(awk </dev
/null
'BEGIN{for(i=0;i<64;i++) print i}')
76 printf '0123456789abcdef'
78 printf ' HTTP/1.1\r\nHost: example.com\r\n\r\n'
79 ) | socat
- TCP
:$listen > $fifo ||
:
80 test xok
= x$
(cat $ok)
83 t_begin
"response should be a 414" && {
84 grep -F 'HTTP/1.1 414 Request-URI Too Long' $tmp
87 t_begin
"server stderr should be clean" && check_stderr
89 t_begin
"term signal sent" && kill $unicorn_pid