forked from jeremycw/httpserver.h
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun
More file actions
executable file
·70 lines (54 loc) · 2.26 KB
/
Copy pathrun
File metadata and controls
executable file
·70 lines (54 loc) · 2.26 KB
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
66
67
68
69
70
#!/usr/bin/env sh
sleep 1
echo "Small Response Body:"
curl http://localhost:8080/
echo "\n\nEmpty Response:"
curl http://localhost:8080/empty
echo "\n\nEcho Body:"
curl -XPOST http://localhost:8080/echo -d'Echo test'
echo "\n\nGet Header:"
curl http://localhost:8080/host
echo "\n\nRequest Body larger than max in mem size:"
dd if=/dev/urandom of=test.dat bs=25165824 count=1 2> /dev/null
curl -H'Expect:' --data-binary @test.dat -o r1.dat http://localhost:8080/large
diff r1.dat test.dat
echo "\n\nChunked Response:"
curl http://localhost:8080/chunked
echo "\n\nChunked Response keep-alive:"
curl http://localhost:8080/chunked http://localhost:8080/chunked
echo "\n\nChunked Response close:"
curl -H'Connection: close' http://localhost:8080/chunked http://localhost:8080/chunked
echo "\n\nChunked Request keep-alive: (expect empty)"
dd if=/dev/urandom of=test.dat bs=262144 count=1 2> /dev/null
curl -H'Expect:' -H'Transfer-Encoding: chunked' -XPOST --data-binary @test.dat -o r1.dat http://localhost:8080/chunked-req -o r2.dat http://localhost:8080/chunked-req
diff r1.dat test.dat
diff r2.dat test.dat
echo "\n\nChunked Request close: (expect empty)"
curl -H'Expect:' -H'Transfer-Encoding: chunked' -XPOST --data-binary @test.dat -o r3.dat http://localhost:8080/chunked-req -o r4.dat http://localhost:8080/chunked-req
diff r3.dat test.dat
diff r4.dat test.dat
echo "\n\nPoll Server:"
curl http://localhost:8081/ &
sleep 1
curl http://localhost:8080/poll
sleep 1
curl http://localhost:8080/poll
echo "\n\nIterate Headers:"
curl -H'User-Agent: test-ua' -H'Foo-Header: foo-bar' http://localhost:8080/headers
echo "\nStress Test keep-alive:"
ab -k -c 200 -n 100000 http://127.0.0.1:8080/ > keep-alive.bench
cat keep-alive.bench | grep Complete
cat keep-alive.bench | grep Non-2xx
cat keep-alive.bench 1>&2
echo "\nStress Test close:"
ab -c 20 -n 1000 http://127.0.0.1:8080/ > connection-close.bench
cat connection-close.bench | grep Complete
cat connection-close.bench | grep Non-2xx
cat connection-close.bench 1>&2
echo "\nStress Test large body:"
dd if=/dev/urandom of=test.dat bs=7388608 count=1 2> /dev/null
ab -c 2 -n 10 -p test.dat http://127.0.0.1:8080/echo > large-file.bench
cat large-file.bench | grep Complete
cat large-file.bench | grep Non-2xx
cat large-file.bench 1>&2
rm *.dat *.bench