1mg.write("HTTP/1.1 200 OK\r\n")
2mg.write("Connection: close\r\n")
3mg.write("Content-Type: text/html; charset=utf-8\r\n")
4mg.write("\r\n")
5
6t = os.time()
7
8if not mg.request_info.query_string then
9  cnt = 1000
10else
11  cnt = tonumber(mg.get_var(mg.request_info.query_string, "cnt"))
12end
13
14cnt = 100*math.floor(cnt/100)
15
16mg.write([[
17<html>
18  <head>
19    <title>]] .. cnt .. [[ images</title>
20    <script type="text/javascript">
21      var startLoad = Date.now();
22      window.onload = function () {
23        var loadTime = (Date.now()-startLoad) + " ms";
24        document.getElementById('timing').innerHTML = loadTime;
25      }
26    </script>
27  </head>
28  <body>
29    <h1>A large gallery of small images:</h1>
30    <p>
31]])
32for s=0,(cnt/100)-1 do
33local ts = (tostring(t) .. tostring(s))
34mg.write([[
35      <h2>page ]]..s..[[</h2>
36      <table>
37        <tr>
38          <td><img src="imagetest/00.png?ts=]]..ts..[["></td>
39          <td><img src="imagetest/01.png?ts=]]..ts..[["></td>
40          <td><img src="imagetest/02.png?ts=]]..ts..[["></td>
41          <td><img src="imagetest/03.png?ts=]]..ts..[["></td>
42          <td><img src="imagetest/04.png?ts=]]..ts..[["></td>
43          <td><img src="imagetest/05.png?ts=]]..ts..[["></td>
44          <td><img src="imagetest/06.png?ts=]]..ts..[["></td>
45          <td><img src="imagetest/07.png?ts=]]..ts..[["></td>
46          <td><img src="imagetest/08.png?ts=]]..ts..[["></td>
47          <td><img src="imagetest/09.png?ts=]]..ts..[["></td>
48        </tr>
49]])
50mg.write([[
51        <tr>
52          <td><img src="imagetest/10.png?ts=]]..ts..[["></td>
53          <td><img src="imagetest/11.png?ts=]]..ts..[["></td>
54          <td><img src="imagetest/12.png?ts=]]..ts..[["></td>
55          <td><img src="imagetest/13.png?ts=]]..ts..[["></td>
56          <td><img src="imagetest/14.png?ts=]]..ts..[["></td>
57          <td><img src="imagetest/15.png?ts=]]..ts..[["></td>
58          <td><img src="imagetest/16.png?ts=]]..ts..[["></td>
59          <td><img src="imagetest/17.png?ts=]]..ts..[["></td>
60          <td><img src="imagetest/18.png?ts=]]..ts..[["></td>
61          <td><img src="imagetest/19.png?ts=]]..ts..[["></td>
62        </tr>
63]])
64mg.write([[
65        <tr>
66          <td><img src="imagetest/20.png?ts=]]..ts..[["></td>
67          <td><img src="imagetest/21.png?ts=]]..ts..[["></td>
68          <td><img src="imagetest/22.png?ts=]]..ts..[["></td>
69          <td><img src="imagetest/23.png?ts=]]..ts..[["></td>
70          <td><img src="imagetest/24.png?ts=]]..ts..[["></td>
71          <td><img src="imagetest/25.png?ts=]]..ts..[["></td>
72          <td><img src="imagetest/26.png?ts=]]..ts..[["></td>
73          <td><img src="imagetest/27.png?ts=]]..ts..[["></td>
74          <td><img src="imagetest/28.png?ts=]]..ts..[["></td>
75          <td><img src="imagetest/29.png?ts=]]..ts..[["></td>
76        </tr>
77]])
78mg.write([[
79        <tr>
80          <td><img src="imagetest/20.png?ts=]]..ts..[["></td>
81          <td><img src="imagetest/21.png?ts=]]..ts..[["></td>
82          <td><img src="imagetest/22.png?ts=]]..ts..[["></td>
83          <td><img src="imagetest/23.png?ts=]]..ts..[["></td>
84          <td><img src="imagetest/24.png?ts=]]..ts..[["></td>
85          <td><img src="imagetest/25.png?ts=]]..ts..[["></td>
86          <td><img src="imagetest/26.png?ts=]]..ts..[["></td>
87          <td><img src="imagetest/27.png?ts=]]..ts..[["></td>
88          <td><img src="imagetest/28.png?ts=]]..ts..[["></td>
89          <td><img src="imagetest/29.png?ts=]]..ts..[["></td>
90        </tr>
91]])
92mg.write([[
93        <tr>
94          <td><img src="imagetest/30.png?ts=]]..ts..[["></td>
95          <td><img src="imagetest/31.png?ts=]]..ts..[["></td>
96          <td><img src="imagetest/32.png?ts=]]..ts..[["></td>
97          <td><img src="imagetest/33.png?ts=]]..ts..[["></td>
98          <td><img src="imagetest/34.png?ts=]]..ts..[["></td>
99          <td><img src="imagetest/35.png?ts=]]..ts..[["></td>
100          <td><img src="imagetest/36.png?ts=]]..ts..[["></td>
101          <td><img src="imagetest/37.png?ts=]]..ts..[["></td>
102          <td><img src="imagetest/38.png?ts=]]..ts..[["></td>
103          <td><img src="imagetest/39.png?ts=]]..ts..[["></td>
104        </tr>
105]])
106mg.write([[
107        <tr>
108          <td><img src="imagetest/40.png?ts=]]..ts..[["></td>
109          <td><img src="imagetest/41.png?ts=]]..ts..[["></td>
110          <td><img src="imagetest/42.png?ts=]]..ts..[["></td>
111          <td><img src="imagetest/43.png?ts=]]..ts..[["></td>
112          <td><img src="imagetest/44.png?ts=]]..ts..[["></td>
113          <td><img src="imagetest/45.png?ts=]]..ts..[["></td>
114          <td><img src="imagetest/46.png?ts=]]..ts..[["></td>
115          <td><img src="imagetest/47.png?ts=]]..ts..[["></td>
116          <td><img src="imagetest/48.png?ts=]]..ts..[["></td>
117          <td><img src="imagetest/49.png?ts=]]..ts..[["></td>
118        </tr>
119]])
120mg.write([[
121        <tr>
122          <td><img src="imagetest/50.png?ts=]]..ts..[["></td>
123          <td><img src="imagetest/51.png?ts=]]..ts..[["></td>
124          <td><img src="imagetest/52.png?ts=]]..ts..[["></td>
125          <td><img src="imagetest/53.png?ts=]]..ts..[["></td>
126          <td><img src="imagetest/54.png?ts=]]..ts..[["></td>
127          <td><img src="imagetest/55.png?ts=]]..ts..[["></td>
128          <td><img src="imagetest/56.png?ts=]]..ts..[["></td>
129          <td><img src="imagetest/57.png?ts=]]..ts..[["></td>
130          <td><img src="imagetest/58.png?ts=]]..ts..[["></td>
131          <td><img src="imagetest/59.png?ts=]]..ts..[["></td>
132        </tr>
133]])
134mg.write([[
135        <tr>
136          <td><img src="imagetest/60.png?ts=]]..ts..[["></td>
137          <td><img src="imagetest/61.png?ts=]]..ts..[["></td>
138          <td><img src="imagetest/62.png?ts=]]..ts..[["></td>
139          <td><img src="imagetest/63.png?ts=]]..ts..[["></td>
140          <td><img src="imagetest/64.png?ts=]]..ts..[["></td>
141          <td><img src="imagetest/65.png?ts=]]..ts..[["></td>
142          <td><img src="imagetest/66.png?ts=]]..ts..[["></td>
143          <td><img src="imagetest/67.png?ts=]]..ts..[["></td>
144          <td><img src="imagetest/68.png?ts=]]..ts..[["></td>
145          <td><img src="imagetest/69.png?ts=]]..ts..[["></td>
146        </tr>
147]])
148mg.write([[
149        <tr>
150          <td><img src="imagetest/70.png?ts=]]..ts..[["></td>
151          <td><img src="imagetest/71.png?ts=]]..ts..[["></td>
152          <td><img src="imagetest/72.png?ts=]]..ts..[["></td>
153          <td><img src="imagetest/73.png?ts=]]..ts..[["></td>
154          <td><img src="imagetest/74.png?ts=]]..ts..[["></td>
155          <td><img src="imagetest/75.png?ts=]]..ts..[["></td>
156          <td><img src="imagetest/76.png?ts=]]..ts..[["></td>
157          <td><img src="imagetest/77.png?ts=]]..ts..[["></td>
158          <td><img src="imagetest/78.png?ts=]]..ts..[["></td>
159          <td><img src="imagetest/79.png?ts=]]..ts..[["></td>
160        </tr>
161]])
162mg.write([[
163        <tr>
164          <td><img src="imagetest/80.png?ts=]]..ts..[["></td>
165          <td><img src="imagetest/81.png?ts=]]..ts..[["></td>
166          <td><img src="imagetest/82.png?ts=]]..ts..[["></td>
167          <td><img src="imagetest/83.png?ts=]]..ts..[["></td>
168          <td><img src="imagetest/84.png?ts=]]..ts..[["></td>
169          <td><img src="imagetest/85.png?ts=]]..ts..[["></td>
170          <td><img src="imagetest/86.png?ts=]]..ts..[["></td>
171          <td><img src="imagetest/87.png?ts=]]..ts..[["></td>
172          <td><img src="imagetest/88.png?ts=]]..ts..[["></td>
173          <td><img src="imagetest/89.png?ts=]]..ts..[["></td>
174        </tr>
175]])
176mg.write([[
177        <tr>
178          <td><img src="imagetest/90.png?ts=]]..ts..[["></td>
179          <td><img src="imagetest/91.png?ts=]]..ts..[["></td>
180          <td><img src="imagetest/92.png?ts=]]..ts..[["></td>
181          <td><img src="imagetest/93.png?ts=]]..ts..[["></td>
182          <td><img src="imagetest/94.png?ts=]]..ts..[["></td>
183          <td><img src="imagetest/95.png?ts=]]..ts..[["></td>
184          <td><img src="imagetest/96.png?ts=]]..ts..[["></td>
185          <td><img src="imagetest/97.png?ts=]]..ts..[["></td>
186          <td><img src="imagetest/98.png?ts=]]..ts..[["></td>
187          <td><img src="imagetest/99.png?ts=]]..ts..[["></td>
188        </tr>
189      </table>
190]])
191end
192mg.write([[
193    </p>
194    <p id="timing">
195      Test case: all images are displayed.
196    </p>
197  </body>
198</html>
199]])
200