-
Notifications
You must be signed in to change notification settings - Fork 0
/
testing.sh
executable file
·61 lines (47 loc) · 3.69 KB
/
testing.sh
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
#!/usr/bin/env bash
set -x
HOST='127.0.0.1'
PORT=8888
HTTP_REQ_DELIM='\r\n'
HTTP_REQ_END='\r\n\r\n'
# Normal Requests
(echo -en "GET / HTTP/1.1${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "GET / HTTP/1.0${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "GET / HTTP/1.1${HTTP_REQ_DELIM}Connection: keep-alive${HTTP_REQ_END}GET / HTTP/1.1${HTTP_REQ_DELIM}Connection: keep-alive${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "POST / HTTP/1.1${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_DELIM}Content-Length: 2${HTTP_REQ_END}12") | nc $HOST $PORT
(echo -en "POST / HTTP/1.1${HTTP_REQ_DELIM}Content-Length: 2${HTTP_REQ_DELIM}Connection: keep-alive${HTTP_REQ_END}12GET / HTTP/1.1${HTTP_REQ_DELIM}Connection: keep-alive${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "GET /Temp/ HTTP/1.1${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "GET /Temp/index.html HTTP/1.1${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
# HTTP Version Error
(echo -en "GET / HTTP/1.2${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "GET / HTTP/1.2${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "POST / HTTP/1.2${HTTP_REQ_DELIM}Content-Length: 2\r\nConnection: Close${HTTP_REQ_END}12") | nc $HOST $PORT
(echo -en "POST / HTTP/1.2${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "POST / HTTP/1.2${HTTP_REQ_END}") | nc $HOST $PORT
# Not Implemented Error
(echo -en "GETS / HTTP/1.1${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "OPTIONS / HTTP/1.1${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "POSTS / HTTP/1.1${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "HELLO / HTTP/1.1${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "GETS / HTTP/1.0${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "OPTIONS / HTTP/1.0${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "POSTS / HTTP/1.0${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "HELLO / HTTP/2.0${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
# Invalid URI Error
(echo -en "GET /new|.txt HTTP/1.1${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "GET new.txt HTTP/1.1${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "GET /hello/try!<> HTTP/1.1${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "POST /new|.txt HTTP/1.1${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "POST new.txt HTTP/1.1${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "POST /hello/try!<> HTTP/1.1${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
# Invalid File Type
(echo -en "GET /new.txt2 HTTP/1.1${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "POST /new.txt2 HTTP/1.1${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "POST /new.kpg HTTP/1.1${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
#Not Found Error
(echo -en "GET /new.html HTTP/1.1${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "POST /new.html HTTP/1.1${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "GET /temp/new.html HTTP/1.1${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "POST /temp/ HTTP/1.1${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
(echo -en "POST /temp/ HTTP/1.1${HTTP_REQ_DELIM}Connection: Close${HTTP_REQ_END}") | nc $HOST $PORT
set +x