3 skip_models StreamResponseEpoll
4 t_plan
19 "simple HTTP connection keepalive/pipelining tests for $model"
6 t_begin
"checking for config.ru for $model" && {
7 tbase
=simple-http_
$model.ru
11 t_begin
"setup and start" && {
14 echo "listen '$unix_socket'" >> $unicorn_config
15 rainbows
-D $tbase -c $unicorn_config
19 t_begin
"pid file exists" && {
23 t_begin
"single TCP request" && {
24 curl
-sSfv http
://$listen/
27 t_begin
"handles client EOF gracefully" && {
28 printf 'GET / HTTP/1.1\r\nHost: example.com\r\n\r\n' | \
29 socat
- UNIX
:$unix_socket > $tmp
31 if grep 'HTTP.* 500' $tmp
33 die
"500 error returned on client shutdown(SHUT_WR)"
40 t_begin
"pipelining partial requests" && {
41 req
='GET / HTTP/1.1\r\nHost: example.com\r\n'
44 printf "$req"'\r\n'"$req"
46 printf 'Connection: close\r\n\r\n'
49 ) | socat
- UNIX
:$unix_socket > $fifo
53 t_begin
"two HTTP/1.1 responses" && {
54 test 2 -eq $
(grep '^HTTP/1.1' $tmp | count_lines
)
57 t_begin
"two HTTP/1.1 200 OK responses" && {
58 test 2 -eq $
(grep '^HTTP/1.1 200 OK' $tmp | count_lines
)
61 t_begin
'one "Connection: keep-alive" response' && {
62 test 1 -eq $
(grep '^Connection: keep-alive' $tmp | count_lines
)
65 t_begin
'one "Connection: close" response' && {
66 test 1 -eq $
(grep '^Connection: close' $tmp | count_lines
)
69 t_begin
'check subshell success' && {
70 test x
"$(cat $ok)" = xok
74 t_begin
"check stderr" && {
78 t_begin
"burst pipelining requests" && {
79 req
='GET / HTTP/1.1\r\nHost: example.com\r\n'
82 printf "$req"'\r\n'"$req"'Connection: close\r\n\r\n'
85 ) | socat
- UNIX
:$unix_socket > $fifo
91 t_begin
"two HTTP/1.1 responses" && {
92 test 2 -eq $
(grep '^HTTP/1.1' $tmp | count_lines
)
95 t_begin
"two HTTP/1.1 200 OK responses" && {
96 test 2 -eq $
(grep '^HTTP/1.1 200 OK' $tmp | count_lines
)
99 t_begin
'one "Connection: keep-alive" response' && {
100 test 1 -eq $
(grep '^Connection: keep-alive' $tmp | count_lines
)
103 t_begin
'one "Connection: close" response' && {
104 test 1 -eq $
(grep '^Connection: close' $tmp | count_lines
)
107 t_begin
'check subshell success' && {
108 test x
"$(cat $ok)" = xok
111 t_begin
"killing succeeds" && {