summary refs log tree commit homepage
path: root/t/t0042-client_header_buffer_size.sh
blob: 0e1936140125df56939ca9e12e2f0cf1b12dce79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/sh
. ./test-lib.sh

t_plan 8 "client_header_buffer_size tests for $model"

t_begin "setup and startup" && {
	rainbows_setup $model
}

t_begin "fails with zero buffer size" && {
	ed -s $unicorn_config <<EOF
,s/^  client_max_body_size.*/  client_header_buffer_size 0/
w
EOF
	grep "client_header_buffer_size 0" $unicorn_config
	rainbows -D client_header_buffer_size.ru -c $unicorn_config || \
		echo err=$? > $ok
	test x"$(cat $ok)" = "xerr=1"
}

t_begin "fails with negative value" && {
	ed -s $unicorn_config <<EOF
,s/^  client_header_buffer_size.*/  client_header_buffer_size -1/
w
EOF
	grep "client_header_buffer_size -1" $unicorn_config
	rainbows -D client_header_buffer_size.ru -c $unicorn_config || \
		echo err=$? > $ok
	test x"$(cat $ok)" = "xerr=1"
}

t_begin "fails with negative value" && {
	ed -s $unicorn_config <<EOF
,s/^  client_header_buffer_size.*/  client_header_buffer_size -1/
w
EOF
	grep "client_header_buffer_size -1" $unicorn_config
	rainbows -D client_header_buffer_size.ru -c $unicorn_config || \
		echo err=$? > $ok
	test x"$(cat $ok)" = "xerr=1"
}

t_begin "starts with correct value" && {
	ed -s $unicorn_config <<EOF
,s/^  client_header_buffer_size.*/  client_header_buffer_size 16399/
w
EOF
	grep "client_header_buffer_size 16399" $unicorn_config
	rainbows -D client_header_buffer_size.ru -c $unicorn_config
	rainbows_wait_start
}

t_begin "regular TCP request works right" && {
	test x$(curl -sSfv http://$listen/) = x16399
}

t_begin "no errors in stderr" && {
	check_stderr
}

t_begin "shutdown" && {
	kill $rainbows_pid
}

t_done