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 | | |
71 | | |
72 | | |
73 | | |
74 | | |
75 | | |
76 | | |
77 | | |
78 | | |
79 | | |
80 | | |
81 | | |
82 | | |
83 | | |
84 | | |
85 | | |
86 | | |
87 | | |
88 | | |
89 | | |
90 | | |
91 | | |
92 | | |
93 | | |
94 | | |
95 | | |
96 | | |
97 | | |
98 | | |
99 | | |
100 | | |
101 | | |
102 | | |
103 | | |
104 | | |
105 | | |
106 | | |
107 | | |
108 | | |
109 | | |
110 | | |
111 | | |
112 | | |
113 | | |
114 | | |
115 | | |
116 | | |
117 | | |
118 | | |
119 | | |
120 | | |
121 | | |
122 | | |
123 | | |
124 | | |
125 | | |
126 | | |
127 | | |
128 | | |
129 | | |
130 | | |
131 | | |
132 | | |
133 | | |
134 | | |
135 | | |
136 | | |
137 | | |
138 | | |
139 | | |
140 | | |
141 | | |
142 | | |
143 | | |
144 | | |
145 | | |
146 | | |
147 | | |
148 | | |
149 | | |
150 | | |
151 | | |
152 | | |
153 | | |
154 | | |
155 | | |
156 | | |
157 | | |
158 | | |
159 | | |
160 | | |
161 | | |
162 | | |
163 | | |
164 | | |
165 | | |
166 | | |
167 | | |
168 | | |
169 | | |
170 | | |
171 | | |
172 | | |
173 | | |
174 | | |
175 | | |
176 | | |
177 | | |
178 | | |
| inherit "../pike_async_process_test_common"; | | | string simple_check( ) | { | return | common_wait( ([ 2:"Illegal headers", | 3:"Illegal data", | 4:"Connection failed", | 5:"Bad protocol value in reply", | 6:"Bad response code in reply", | 7:"No date header", | 8:"Bad or no content-length header", | 9:"Bad or no last-modified header", | 11:"Did not expect headers", | 12:"Did not expect data", | 13:"Did not expect connection", | 14:"Did not expect valid reply", | ]) ); | } | | function run( string script, string file, int|string ... ma ) | { | return lambda() { | run_pikescript( script, file, @((array(string))ma) ); | }; | } | | #define rtest( COMMENT, SCRIPT, FILE, LEN, ARGS...) \ | atest(COMMENT, run(SCRIPT, FILE, LEN, ARGS), simple_check) | | #define _test( X,Y,Z,Å,Ä,Ö) atest(X+Ä, run(Y,Z,Å,Ö), simple_check ) | | #define stest( X,Y,Z,Å ) _test( X,Y,Z,Å, "", "1" ) | #define stest2( X,Y,Z,Å ) _test( X,Y,Z,Å," (no \\r)", "2" ) | #define stest3( X,Y,Z,Å ) _test( X,Y,Z,Å," (1 b packets)", "3" ) | #define stest4( X,Y,Z,Å ) _test( X,Y,Z,Å," (10 b packets)", "4" ) | | #define stest5( X,Y,Z,Å ) _test( X,Y,Z,Å," (1k headers)", "5" ) | #define stest6( X,Y,Z,Å ) _test( X,Y,Z,Å," (10k headers)", "6" ) | #define stest7( X,Y,Z,Å ) _test( X,Y,Z,Å," (100k headers)", "7" ) | | #define stest8( X,Y,Z,Å ) _test( X,Y,Z,Å," (1k headers, no \\r)", "8" ) | #define stest9( X,Y,Z,Å ) _test( X,Y,Z,Å," (10k headers, no \\r)", "9" ) | #define stest10( X,Y,Z,Å ) _test( X,Y,Z,Å," (100k headers, no \\r)", "10" ) | | #define stest11( X,Y,Z,Å ) _test( X,Y,Z,Å," (header overflow (>512Kb))","11" ) | | #define btest( X,Y,Z,Å,Ä) _test( X,Y,Z,Å, "", Ä ) | | void setup( ) | { | | | | | | stest( "HTTP/1.0 /1k.raw", "http/http10.pike", "/1k.raw", 1024 ); | stest( "HTTP/1.0 /10k.raw", "http/http10.pike", "/10k.raw", 1024*10 ); | stest( "HTTP/1.0 /", "http/http10.pike", "/", 0 ); | stest( "HTTP/1.0 /nofile", "http/http10.pike", "/nofile", 0 ); | stest( "HTTP/1.0 /nofile", "http/http10.pike", "/nofile", 0 ); | | | | | | | btest( "HTTP/01.0 /1k.raw", "http/http010.pike", "/1k.raw", 1024, "01.0" ); | btest( "HTTP/01.0 /nofile", "http/http010.pike", "/nofile", 0, "01.0" ); | btest( "HTTP/001.00 /1k.raw", "http/http010.pike", "/1k.raw", 1024, "001.00" ); | btest( "HTTP/001.00 /nofile", "http/http010.pike", "/nofile", 0, "001.00" ); | | stest( "PING", "http/ping.pike", "/", 0 ); | | | | | | | stest2( "HTTP/1.0 /1k.raw", "http/http10.pike", "/1k.raw", 1024 ); | stest2( "HTTP/1.0 /10k.raw", "http/http10.pike", "/10k.raw", 1024*10 ); | stest2( "HTTP/1.0 /", "http/http10.pike", "/", 0 ); | stest2( "HTTP/1.0 /nofile", "http/http10.pike", "/nofile", 0 ); | | | | | | | stest2( "PING", "http/ping.pike", "/", 0 ); | | | | | | | stest3( "HTTP/1.0 /1k.raw", "http/http10.pike", "/1k.raw", 1024 ); | stest3( "HTTP/1.0 /10k.raw", "http/http10.pike", "/10k.raw", 1024*10 ); | stest3( "HTTP/1.0 /", "http/http10.pike", "/", 0 ); | stest3( "HTTP/1.0 /nofile", "http/http10.pike", "/nofile", 0 ); | | | | | | | stest3( "PING", "http/ping.pike", "/", 0 ); | | | | | | | stest4( "HTTP/1.0 /1k.raw", "http/http10.pike", "/1k.raw", 1024 ); | stest4( "HTTP/1.0 /10k.raw", "http/http10.pike", "/10k.raw", 1024*10 ); | stest4( "HTTP/1.0 /", "http/http10.pike", "/", 0 ); | stest4( "HTTP/1.0 /nofile", "http/http10.pike", "/nofile", 0 ); | | stest5( "HTTP/1.0 /1k.raw", "http/http10.pike", "/1k.raw", 1024 ); | stest5( "HTTP/1.0 /10k.raw", "http/http10.pike", "/10k.raw", 1024*10 ); | stest5( "HTTP/1.0 /", "http/http10.pike", "/", 0 ); | stest5( "HTTP/1.0 /nofile", "http/http10.pike", "/nofile", 0 ); | | stest6( "HTTP/1.0 /1k.raw", "http/http10.pike", "/1k.raw", 1024 ); | stest6( "HTTP/1.0 /10k.raw", "http/http10.pike", "/10k.raw", 1024*10 ); | stest6( "HTTP/1.0 /", "http/http10.pike", "/", 0 ); | stest6( "HTTP/1.0 /nofile", "http/http10.pike", "/nofile", 0 ); | | stest7( "HTTP/1.0 /1k.raw", "http/http10.pike", "/1k.raw", 1024 ); | stest7( "HTTP/1.0 /10k.raw", "http/http10.pike", "/10k.raw", 1024*10 ); | stest7( "HTTP/1.0 /", "http/http10.pike", "/", 0 ); | stest7( "HTTP/1.0 /nofile", "http/http10.pike", "/nofile", 0 ); | | stest8( "HTTP/1.0 /1k.raw", "http/http10.pike", "/1k.raw", 1024 ); | stest8( "HTTP/1.0 /10k.raw", "http/http10.pike", "/10k.raw", 1024*10 ); | stest8( "HTTP/1.0 /", "http/http10.pike", "/", 0 ); | stest8( "HTTP/1.0 /nofile", "http/http10.pike", "/nofile", 0 ); | | stest9( "HTTP/1.0 /1k.raw", "http/http10.pike", "/1k.raw", 1024 ); | stest9( "HTTP/1.0 /10k.raw", "http/http10.pike", "/10k.raw", 1024*10 ); | stest9( "HTTP/1.0 /", "http/http10.pike", "/", 0 ); | stest9( "HTTP/1.0 /nofile", "http/http10.pike", "/nofile", 0 ); | | stest10( "HTTP/1.0 /1k.raw", "http/http10.pike", "/1k.raw", 1024 ); | stest10( "HTTP/1.0 /10k.raw", "http/http10.pike", "/10k.raw", 1024*10 ); | stest10( "HTTP/1.0 /", "http/http10.pike", "/", 0 ); | stest10( "HTTP/1.0 /nofile", "http/http10.pike", "/nofile", 0 ); | | stest11( "HTTP/1.0 /1k.raw", "http/http10.pike", "/1k.raw", 0 ); | stest11( "HTTP/1.0 /10k.raw", "http/http10.pike", "/10k.raw", 0 ); | stest11( "HTTP/1.0 /", "http/http10.pike", "/", 0 ); | stest11( "HTTP/1.0 /nofile", "http/http10.pike", "/nofile", 0 ); | | | | | | | rtest( "REDIRECT (Host)", "http/http_redirect.pike", | "/redirect.html", "http://test.example.com/", "Host:test.example.com" ); | rtest( "REDIRECT (Forwarded)", "http/http_redirect.pike", | "/redirect.html", "https://test.example.com/", "Host:test2.example.com", | "Forwarded: host=\"test.example.com\";proto=https"); | rtest( "REDIRECT (Multi Forwarded)", "http/http_redirect.pike", | "/redirect.html", "https://test.example.com/", "Host:test2.example.com", | "Forwarded: host=\"test.example.com\"", | "Forwarded: host=\"test3.example.com\"", | "Forwarded: host=\"test4.example.com\";proto=https"); | rtest( "REDIRECT (Simgle Multi Forwarded)", "http/http_redirect.pike", | "/redirect.html", "https://test.example.com/", "Host:test2.example.com", | "Forwarded: host=\"test.example.com\",host=\"test3.example.com\",host=\"test4.example.com\";proto=https"); | rtest( "REDIRECT (X-Forwarded)", "http/http_redirect.pike", | "/redirect.html", "https://test.example.com/", "Host:test2.example.com", | "X-Forwarded-Host: test.example.com", "X-Forwarded-Proto: https"); | } | | |
|