unicorn.git  about / heads / tags
Rack HTTP server for Unix and fast clients
blob 9a3e7cfd58761b80424a9c05473b3483f6076c88 570 bytes (raw)
$ git show v3.0.0:t/t0002-parser-error.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
 
#!/bin/sh
. ./test-lib.sh
t_plan 5 "parser error test"

t_begin "setup and startup" && {
	unicorn_setup
	unicorn -D env.ru -c $unicorn_config
	unicorn_wait_start
}

t_begin "send a bad request" && {
	(
		printf 'GET / HTTP/1/1\r\nHost: example.com\r\n\r\n'
		cat $fifo > $tmp &
		wait
		echo ok > $ok
	) | socat - TCP:$listen > $fifo
	test xok = x$(cat $ok)
}

dbgcat tmp

t_begin "response should be a 400" && {
	grep -F 'HTTP/1.1 400 Bad Request' $tmp
}

t_begin "server stderr should be clean" && check_stderr

t_begin "term signal sent" && kill $unicorn_pid

t_done

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