aboutsummaryrefslogtreecommitdiff
path: root/contrib/tools/httptest.pl
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/tools/httptest.pl')
-rw-r--r--contrib/tools/httptest.pl195
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
5use Socket;
6sub 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
15my $host = shift;
16my $port = shift || 80;
17print "\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
22socket(SOCK,AF_INET,SOCK_STREAM,6) or print "Died";
23print "a normal connection\n";
24<STDIN>;
25connect(SOCK,$saddr) or exit;
26print "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";
28syswrite(SOCK,"$header");
29$keep=1;
30while($keep) {
31 if(newdata(SOCK)) {
32 if(($data=<SOCK>)) {
33 print "Read: ".$data;
34 }else {
35 $keep=0;
36 };
37 };
38};
39close(SOCK);
40
41
42
43socket(SOCK,AF_INET,SOCK_STREAM,6) or exit;
44print "Trying to send (nothing) press (enter) to continue\n";
45<STDIN>;
46connect(SOCK,$saddr) or exit;
47print "Connected\n";
48$header="";
49syswrite(SOCK,"$header");
50$keep=1;
51while($keep) {
52 if(newdata(SOCK)) {
53 if(($data=<SOCK>)) {
54 print "Read: ".$data;
55 }else {
56 $keep=0;
57 };
58 };
59};
60close(SOCK);
61
62
63socket(SOCK,AF_INET,SOCK_STREAM,6) or print "Died";
64print "a post (foo)value with 10000000 bytes press (enter) to continue\n";
65<STDIN>;
66connect(SOCK,$saddr) or exit;
67print "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
69syswrite(SOCK,"$header");
70$keep=1;
71while($keep) {
72 if(newdata(SOCK)) {
73 if(($data=<SOCK>)) {
74 print "Read: ".$data;
75 }else {
76 $keep=0;
77 };
78 };
79};
80close(SOCK);
81
82socket(SOCK,AF_INET,SOCK_STREAM,6) or exit;
83print "Trying to send a big data for ClientInfo\n";
84<STDIN>;
85connect(SOCK,$saddr) or exit;
86print "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";
88syswrite(SOCK,"$header");
89$keep=1;
90while($keep) {
91 if(newdata(SOCK)) {
92 if(($data=<SOCK>)) {
93 print "Read: ".$data;
94 }else {
95 $keep=0;
96 };
97 };
98};
99close(SOCK);
100
101socket(SOCK,AF_INET,SOCK_STREAM,6) or exit;
102print "Change method by a big name\n";
103<STDIN>;
104connect(SOCK,$saddr) or exit;
105print "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";
107syswrite(SOCK,"$header");
108$keep=1;
109while($keep) {
110 if(newdata(SOCK)) {
111 if(($data=<SOCK>)) {
112 print "Read: ".$data;
113 }else {
114 $keep=0;
115 };
116 };
117};
118close(SOCK);
119
120socket(SOCK,AF_INET,SOCK_STREAM,6) or exit;
121print "big query value\n";
122<STDIN>;
123connect(SOCK,$saddr) or exit;
124print "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";
126syswrite(SOCK,"$header");
127$keep=1;
128while($keep) {
129 if(newdata(SOCK)) {
130 if(($data=<SOCK>)) {
131 print "Read: ".$data;
132 }else {
133 $keep=0;
134 };
135 };
136};
137close(SOCK);
138
139socket(SOCK,AF_INET,SOCK_STREAM,6) or exit;
140print "requestname filled w 0's\n";
141<STDIN>;
142connect(SOCK,$saddr) or exit;
143print "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";
145syswrite(SOCK,"$header");
146$keep=1;
147while($keep) {
148 if(newdata(SOCK)) {
149 if(($data=<SOCK>)) {
150 print "Read: ".$data;
151 }else {
152 $keep=0;
153 };
154 };
155};
156close(SOCK);
157
158socket(SOCK,AF_INET,SOCK_STREAM,6) or exit;
159print "query filled w 0's\n";
160<STDIN>;
161connect(SOCK,$saddr) or exit;
162print "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";
164syswrite(SOCK,"$header");
165$keep=1;
166while($keep) {
167 if(newdata(SOCK)) {
168 if(($data=<SOCK>)) {
169 print "Read: ".$data;
170 }else {
171 $keep=0;
172 };
173 };
174};
175close(SOCK);
176
177socket(SOCK,AF_INET,SOCK_STREAM,6) or print "Died";
178print "a post (foo)value with 10000000 bytes press (enter) to continue\n";
179<STDIN>;
180connect(SOCK,$saddr) or exit;
181print "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
183syswrite(SOCK,"$header");
184$keep=1;
185while($keep) {
186 if(newdata(SOCK)) {
187 if(($data=<SOCK>)) {
188 print "Read: ".$data;
189 }else {
190 $keep=0;
191 };
192 };
193};
194
195print "--------- END --------\n"