unicorn.git  about / heads / tags
Rack HTTP server for Unix and fast clients
blob 6a355b49cc4ea2ab1a5ef7d323a6be675588b0e0 874 bytes (raw)
$ git show no-kgio-wip:t/t0019-max_header_len.sh	# shows this blob on the CLI

 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
 
#!/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" | count_bytes)
	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

git clone https://yhbt.net/unicorn.git