diff options
Diffstat (limited to 'contrib/tools/httptest.pl')
-rw-r--r-- | contrib/tools/httptest.pl | 195 |
1 files changed, 0 insertions, 195 deletions
diff --git a/contrib/tools/httptest.pl b/contrib/tools/httptest.pl deleted file mode 100644 index 23360d28..00000000 --- a/contrib/tools/httptest.pl +++ /dev/null | |||
@@ -1,195 +0,0 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | |||
4 | |||
5 | use Socket; | ||
6 | sub newdata { | ||
7 | #my $self = shift; | ||
8 | my ($nfound,$timeout,$rin,$rout)=(0,0.2,""); | ||
9 | vec($rin,fileno(shift()),1)=1; | ||
10 | $nfound=select($rout=$rin,undef,undef,$timeout); | ||
11 | return $nfound; | ||
12 | }; | ||
13 | |||
14 | |||
15 | my $host = shift; | ||
16 | my $port = shift || 80; | ||
17 | print "\n\tWARNING: If program exit before msg that's mean that the server crashed or something happened to server\n\n"; | ||
18 | $saddr=sockaddr_in($port,inet_aton($host)); | ||
19 | $SIG{PIPE}=NULL; | ||
20 | |||
21 | |||
22 | socket(SOCK,AF_INET,SOCK_STREAM,6) or print "Died"; | ||
23 | print "a normal connection\n"; | ||
24 | <STDIN>; | ||
25 | connect(SOCK,$saddr) or exit; | ||
26 | print "Connected\n"; | ||
27 | $header="GET / HTTP/1.0\r\nConnection: Keep-Alive\r\nUser-Agent: Mozilla/4.73 [en] (X11; U; Linux 2.4.12 i686)\r\nHost: localhost:81\r\nAccept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*\r\nAccept-Encoding: gzip\r\nAccept-Language: en\r\nAccept-Charset: iso-8859-1,*,utf-8\r\n\r\n"; | ||
28 | syswrite(SOCK,"$header"); | ||
29 | $keep=1; | ||
30 | while($keep) { | ||
31 | if(newdata(SOCK)) { | ||
32 | if(($data=<SOCK>)) { | ||
33 | print "Read: ".$data; | ||
34 | }else { | ||
35 | $keep=0; | ||
36 | }; | ||
37 | }; | ||
38 | }; | ||
39 | close(SOCK); | ||
40 | |||
41 | |||
42 | |||
43 | socket(SOCK,AF_INET,SOCK_STREAM,6) or exit; | ||
44 | print "Trying to send (nothing) press (enter) to continue\n"; | ||
45 | <STDIN>; | ||
46 | connect(SOCK,$saddr) or exit; | ||
47 | print "Connected\n"; | ||
48 | $header=""; | ||
49 | syswrite(SOCK,"$header"); | ||
50 | $keep=1; | ||
51 | while($keep) { | ||
52 | if(newdata(SOCK)) { | ||
53 | if(($data=<SOCK>)) { | ||
54 | print "Read: ".$data; | ||
55 | }else { | ||
56 | $keep=0; | ||
57 | }; | ||
58 | }; | ||
59 | }; | ||
60 | close(SOCK); | ||
61 | |||
62 | |||
63 | socket(SOCK,AF_INET,SOCK_STREAM,6) or print "Died"; | ||
64 | print "a post (foo)value with 10000000 bytes press (enter) to continue\n"; | ||
65 | <STDIN>; | ||
66 | connect(SOCK,$saddr) or exit; | ||
67 | print "Connected\n"; | ||
68 | $header="POST / HTTP/1.0\r\nConnection: Keep-Alive\r\nUser-Agent: Mozilla/4.73 [en] (X11; U; Linux 2.4.12 i686)\r\nHost: localhost:81\r\nAccept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*\r\nAccept-Encoding: gzip\r\nAccept-Language: en\r\nAccept-Charset: iso-8859-1,*,utf-8\r\n\r\ndev=".("a"x1000000)."&teste=1\r\n\r\n"; #big values | ||
69 | syswrite(SOCK,"$header"); | ||
70 | $keep=1; | ||
71 | while($keep) { | ||
72 | if(newdata(SOCK)) { | ||
73 | if(($data=<SOCK>)) { | ||
74 | print "Read: ".$data; | ||
75 | }else { | ||
76 | $keep=0; | ||
77 | }; | ||
78 | }; | ||
79 | }; | ||
80 | close(SOCK); | ||
81 | |||
82 | socket(SOCK,AF_INET,SOCK_STREAM,6) or exit; | ||
83 | print "Trying to send a big data for ClientInfo\n"; | ||
84 | <STDIN>; | ||
85 | connect(SOCK,$saddr) or exit; | ||
86 | print "Connected\n"; | ||
87 | $header="GET / HTTP/1.0\r\nConnection: Keep-Alive\r\nUser-Agent: Mozilla/4.73 [en] (X11; U; Linux 2.4.12 i686)\r\nHost: localhost:81\r\nAccept: ".("a"x1000000)."\r\nAccept-Encoding: gzip\r\nAccept-Language: en\r\nAccept-Charset: iso-8859-1,*,utf-8\r\n\r\n"; | ||
88 | syswrite(SOCK,"$header"); | ||
89 | $keep=1; | ||
90 | while($keep) { | ||
91 | if(newdata(SOCK)) { | ||
92 | if(($data=<SOCK>)) { | ||
93 | print "Read: ".$data; | ||
94 | }else { | ||
95 | $keep=0; | ||
96 | }; | ||
97 | }; | ||
98 | }; | ||
99 | close(SOCK); | ||
100 | |||
101 | socket(SOCK,AF_INET,SOCK_STREAM,6) or exit; | ||
102 | print "Change method by a big name\n"; | ||
103 | <STDIN>; | ||
104 | connect(SOCK,$saddr) or exit; | ||
105 | print "Connected\n"; | ||
106 | $header=("a"x1000000)." / HTTP/1.0\r\nConnection: Keep-Alive\r\nUser-Agent: Mozilla/4.73 [en] (X11; U; Linux 2.4.12 i686)\r\nAccept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*\r\nAccept-Encoding: gzip\r\nAccept-Language: en\r\nAccept-Charset: iso-8859-1,*,utf-8\r\n\r\n"; | ||
107 | syswrite(SOCK,"$header"); | ||
108 | $keep=1; | ||
109 | while($keep) { | ||
110 | if(newdata(SOCK)) { | ||
111 | if(($data=<SOCK>)) { | ||
112 | print "Read: ".$data; | ||
113 | }else { | ||
114 | $keep=0; | ||
115 | }; | ||
116 | }; | ||
117 | }; | ||
118 | close(SOCK); | ||
119 | |||
120 | socket(SOCK,AF_INET,SOCK_STREAM,6) or exit; | ||
121 | print "big query value\n"; | ||
122 | <STDIN>; | ||
123 | connect(SOCK,$saddr) or exit; | ||
124 | print "Connected\n"; | ||
125 | $header="GET /?teste=".("a"x1000000)." / HTTP/1.0\r\nConnection: Keep-Alive\r\nUser-Agent: Mozilla/4.73 [en] (X11; U; Linux 2.4.12 i686)\r\nAccept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*\r\nAccept-Encoding: gzip\r\nAccept-Language: en\r\nAccept-Charset: iso-8859-1,*,utf-8\r\n\r\n"; | ||
126 | syswrite(SOCK,"$header"); | ||
127 | $keep=1; | ||
128 | while($keep) { | ||
129 | if(newdata(SOCK)) { | ||
130 | if(($data=<SOCK>)) { | ||
131 | print "Read: ".$data; | ||
132 | }else { | ||
133 | $keep=0; | ||
134 | }; | ||
135 | }; | ||
136 | }; | ||
137 | close(SOCK); | ||
138 | |||
139 | socket(SOCK,AF_INET,SOCK_STREAM,6) or exit; | ||
140 | print "requestname filled w 0's\n"; | ||
141 | <STDIN>; | ||
142 | connect(SOCK,$saddr) or exit; | ||
143 | print "Connected\n"; | ||
144 | $header="GET /".("\0"x1000000)." HTTP/1.0\r\nConnection: Keep-Alive\r\nUser-Agent: Mozilla/4.73 [en] (X11; U; Linux 2.4.12 i686)\r\nAccept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*\r\nAccept-Encoding: gzip\r\nAccept-Language: en\r\nAccept-Charset: iso-8859-1,*,utf-8\r\n\r\n"; | ||
145 | syswrite(SOCK,"$header"); | ||
146 | $keep=1; | ||
147 | while($keep) { | ||
148 | if(newdata(SOCK)) { | ||
149 | if(($data=<SOCK>)) { | ||
150 | print "Read: ".$data; | ||
151 | }else { | ||
152 | $keep=0; | ||
153 | }; | ||
154 | }; | ||
155 | }; | ||
156 | close(SOCK); | ||
157 | |||
158 | socket(SOCK,AF_INET,SOCK_STREAM,6) or exit; | ||
159 | print "query filled w 0's\n"; | ||
160 | <STDIN>; | ||
161 | connect(SOCK,$saddr) or exit; | ||
162 | print "Connected\n"; | ||
163 | $header="GET /teste?teste=".("\0"x1000000)." HTTP/1.0\r\nConnection: Keep-Alive\r\nUser-Agent: Mozilla/4.73 [en] (X11; U; Linux 2.4.12 i686)\r\nAccept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*\r\nAccept-Encoding: gzip\r\nAccept-Language: en\r\nAccept-Charset: iso-8859-1,*,utf-8\r\n\r\n"; | ||
164 | syswrite(SOCK,"$header"); | ||
165 | $keep=1; | ||
166 | while($keep) { | ||
167 | if(newdata(SOCK)) { | ||
168 | if(($data=<SOCK>)) { | ||
169 | print "Read: ".$data; | ||
170 | }else { | ||
171 | $keep=0; | ||
172 | }; | ||
173 | }; | ||
174 | }; | ||
175 | close(SOCK); | ||
176 | |||
177 | socket(SOCK,AF_INET,SOCK_STREAM,6) or print "Died"; | ||
178 | print "a post (foo)value with 10000000 bytes press (enter) to continue\n"; | ||
179 | <STDIN>; | ||
180 | connect(SOCK,$saddr) or exit; | ||
181 | print "Connected\n"; | ||
182 | $header="POST / HTTP/1.0\r\nConnection: Keep-Alive\r\nUser-Agent: Mozilla/4.73 [en] (X11; U; Linux 2.4.12 i686)\r\nHost: localhost:81\r\nAccept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*\r\nAccept-Encoding: gzip\r\nAccept-Language: en\r\nAccept-Charset: iso-8859-1,*,utf-8\r\n\r\ndev=teste".("\0"x1000000)."&teste=1\r\n\r\n"; #big values | ||
183 | syswrite(SOCK,"$header"); | ||
184 | $keep=1; | ||
185 | while($keep) { | ||
186 | if(newdata(SOCK)) { | ||
187 | if(($data=<SOCK>)) { | ||
188 | print "Read: ".$data; | ||
189 | }else { | ||
190 | $keep=0; | ||
191 | }; | ||
192 | }; | ||
193 | }; | ||
194 | |||
195 | print "--------- END --------\n" | ||