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
·40 lines (39 loc) · 1.43 KB
/
Copy pathrun
File metadata and controls
executable file
·40 lines (39 loc) · 1.43 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
#!/usr/bin/env sh
echo "Small Response Body:"
curl http://localhost:8080/
echo "\n\nEmpty Response:"
curl http://localhost:8080/empty
echo "\n\nBody Too Large:"
curl -H'Content-Length: 4000000000' http://localhost:8080/
echo "\n\nEcho Body:"
curl -XPOST http://localhost:8080/echo -d'Echo test'
echo "\n\nGet Header:"
curl http://localhost:8080/host
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\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 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 1>&2
echo "\nStress Test large body:"
dd if=/dev/urandom of=test.dat bs=52428800 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 1>&2
rm test.dat *.bench