Mercurial > hg
annotate tests/test-hgweb.t @ 15812:0cc4ad757c77
sslutil: verify that wrap_socket really wrapped the socket
This works around that ssl.wrap_socket silently skips ssl negotiation on
sockets that was connected but since then has been reset by the peer but not
yet closed at the Python level. That leaves the socket in a state where
.getpeercert() fails with an AttributeError on None. See
http://bugs.python.org/issue13721 .
A call to .cipher() is now used to verify that the wrapping really did succeed.
Otherwise it aborts with "ssl connection failed".
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Mon, 09 Jan 2012 14:43:15 +0100 |
parents | c5c9ca3719f9 |
children | f2719b387380 |
rev | line source |
---|---|
15446
c5c9ca3719f9
tests: use 'hghave serve' to guard tests that requires serve daemon management
Mads Kiilerich <mads@kiilerich.com>
parents:
14046
diff
changeset
|
1 $ "$TESTDIR/hghave" serve || exit 80 |
c5c9ca3719f9
tests: use 'hghave serve' to guard tests that requires serve daemon management
Mads Kiilerich <mads@kiilerich.com>
parents:
14046
diff
changeset
|
2 |
12432 | 3 Some tests for hgweb. Tests static files, plain files and different 404's. |
4 | |
5 $ hg init test | |
6 $ cd test | |
7 $ mkdir da | |
8 $ echo foo > da/foo | |
9 $ echo foo > foo | |
10 $ hg ci -Ambase | |
11 adding da/foo | |
12 adding foo | |
13 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log | |
14 $ cat hg.pid >> $DAEMON_PIDS | |
15 | |
16 manifest | |
3942 | 17 |
12432 | 18 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/?style=raw') |
19 200 Script output follows | |
20 | |
21 | |
22 drwxr-xr-x da | |
23 -rw-r--r-- 4 foo | |
24 | |
25 | |
26 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/da?style=raw') | |
27 200 Script output follows | |
28 | |
29 | |
30 -rw-r--r-- 4 foo | |
31 | |
32 | |
33 | |
34 plain file | |
35 | |
36 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?style=raw' | |
37 200 Script output follows | |
38 | |
39 foo | |
40 | |
41 should give a 404 - static file that does not exist | |
9842
d3dbdca92458
hgweb: don't choke when an inexistent style is requested (issue1901)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
8167
diff
changeset
|
42 |
12432 | 43 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/static/bogus' |
44 404 Not Found | |
45 | |
46 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
47 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> | |
48 <head> | |
49 <link rel="icon" href="/static/hgicon.png" type="image/png" /> | |
50 <meta name="robots" content="index, nofollow" /> | |
51 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> | |
14046
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
13863
diff
changeset
|
52 <script type="text/javascript" src="/static/mercurial.js"></script> |
12432 | 53 |
54 <title>test: error</title> | |
55 </head> | |
56 <body> | |
57 | |
58 <div class="container"> | |
59 <div class="menu"> | |
60 <div class="logo"> | |
61 <a href="http://mercurial.selenic.com/"> | |
62 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a> | |
63 </div> | |
64 <ul> | |
65 <li><a href="/shortlog">log</a></li> | |
66 <li><a href="/graph">graph</a></li> | |
67 <li><a href="/tags">tags</a></li> | |
13597
38c9837b1f75
hgweb: add separate page with bookmarks listing
Alexander Solovyov <alexander@solovyov.net>
parents:
12846
diff
changeset
|
68 <li><a href="/bookmarks">bookmarks</a></li> |
12432 | 69 <li><a href="/branches">branches</a></li> |
12680
d664547ef540
hgweb: add help link to templates missed in ead4e21f49f1
Augie Fackler <durin42@gmail.com>
parents:
12666
diff
changeset
|
70 <li><a href="/help">help</a></li> |
12432 | 71 </ul> |
72 </div> | |
73 | |
74 <div class="main"> | |
75 | |
76 <h2><a href="/">test</a></h2> | |
77 <h3>error</h3> | |
78 | |
79 <form class="search" action="/log"> | |
80 | |
81 <p><input name="rev" id="search1" type="text" size="30"></p> | |
82 <div id="hint">find changesets by author, revision, | |
83 files, or words in the commit message</div> | |
84 </form> | |
85 | |
86 <div class="description"> | |
87 <p> | |
88 An error occurred while processing your request: | |
89 </p> | |
90 <p> | |
91 Not Found | |
92 </p> | |
93 </div> | |
94 </div> | |
95 </div> | |
96 | |
14046
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
13863
diff
changeset
|
97 <script type="text/javascript">process_dates()</script> |
12432 | 98 |
99 | |
100 </body> | |
101 </html> | |
102 | |
103 [1] | |
104 | |
105 should give a 404 - bad revision | |
106 | |
107 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/spam/foo?style=raw' | |
108 404 Not Found | |
109 | |
110 | |
111 error: revision not found: spam | |
112 [1] | |
113 | |
114 should give a 400 - bad command | |
9842
d3dbdca92458
hgweb: don't choke when an inexistent style is requested (issue1901)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
8167
diff
changeset
|
115 |
12432 | 116 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?cmd=spam&style=raw' |
117 400* (glob) | |
118 | |
119 | |
120 error: no such method: spam | |
121 [1] | |
122 | |
123 should give a 404 - file does not exist | |
5561
22713dce19f6
hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
5384
diff
changeset
|
124 |
12432 | 125 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork?style=raw' |
126 404 Not Found | |
127 | |
128 | |
129 error: bork@2ef0ac749a14: not found in manifest | |
130 [1] | |
131 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork' | |
132 404 Not Found | |
133 | |
134 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
135 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> | |
136 <head> | |
137 <link rel="icon" href="/static/hgicon.png" type="image/png" /> | |
138 <meta name="robots" content="index, nofollow" /> | |
139 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> | |
14046
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
13863
diff
changeset
|
140 <script type="text/javascript" src="/static/mercurial.js"></script> |
12432 | 141 |
142 <title>test: error</title> | |
143 </head> | |
144 <body> | |
145 | |
146 <div class="container"> | |
147 <div class="menu"> | |
148 <div class="logo"> | |
149 <a href="http://mercurial.selenic.com/"> | |
150 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a> | |
151 </div> | |
152 <ul> | |
153 <li><a href="/shortlog">log</a></li> | |
154 <li><a href="/graph">graph</a></li> | |
155 <li><a href="/tags">tags</a></li> | |
13597
38c9837b1f75
hgweb: add separate page with bookmarks listing
Alexander Solovyov <alexander@solovyov.net>
parents:
12846
diff
changeset
|
156 <li><a href="/bookmarks">bookmarks</a></li> |
12432 | 157 <li><a href="/branches">branches</a></li> |
12680
d664547ef540
hgweb: add help link to templates missed in ead4e21f49f1
Augie Fackler <durin42@gmail.com>
parents:
12666
diff
changeset
|
158 <li><a href="/help">help</a></li> |
12432 | 159 </ul> |
160 </div> | |
161 | |
162 <div class="main"> | |
163 | |
164 <h2><a href="/">test</a></h2> | |
165 <h3>error</h3> | |
166 | |
167 <form class="search" action="/log"> | |
168 | |
169 <p><input name="rev" id="search1" type="text" size="30"></p> | |
170 <div id="hint">find changesets by author, revision, | |
171 files, or words in the commit message</div> | |
172 </form> | |
173 | |
174 <div class="description"> | |
175 <p> | |
176 An error occurred while processing your request: | |
177 </p> | |
178 <p> | |
179 bork@2ef0ac749a14: not found in manifest | |
180 </p> | |
181 </div> | |
182 </div> | |
183 </div> | |
184 | |
14046
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
13863
diff
changeset
|
185 <script type="text/javascript">process_dates()</script> |
12432 | 186 |
187 | |
188 </body> | |
189 </html> | |
190 | |
191 [1] | |
192 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/tip/bork?style=raw' | |
193 404 Not Found | |
194 | |
195 | |
196 error: bork@2ef0ac749a14: not found in manifest | |
197 [1] | |
5561
22713dce19f6
hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
5384
diff
changeset
|
198 |
12432 | 199 try bad style |
5561
22713dce19f6
hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
5384
diff
changeset
|
200 |
12432 | 201 $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/?style=foobar') |
202 200 Script output follows | |
203 | |
204 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
205 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> | |
206 <head> | |
207 <link rel="icon" href="/static/hgicon.png" type="image/png" /> | |
208 <meta name="robots" content="index, nofollow" /> | |
209 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> | |
14046
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
13863
diff
changeset
|
210 <script type="text/javascript" src="/static/mercurial.js"></script> |
12432 | 211 |
212 <title>test: 2ef0ac749a14 /</title> | |
213 </head> | |
214 <body> | |
215 | |
216 <div class="container"> | |
217 <div class="menu"> | |
218 <div class="logo"> | |
219 <a href="http://mercurial.selenic.com/"> | |
220 <img src="/static/hglogo.png" alt="mercurial" /></a> | |
221 </div> | |
222 <ul> | |
223 <li><a href="/shortlog/2ef0ac749a14">log</a></li> | |
224 <li><a href="/graph/2ef0ac749a14">graph</a></li> | |
225 <li><a href="/tags">tags</a></li> | |
13597
38c9837b1f75
hgweb: add separate page with bookmarks listing
Alexander Solovyov <alexander@solovyov.net>
parents:
12846
diff
changeset
|
226 <li><a href="/bookmarks">bookmarks</a></li> |
12432 | 227 <li><a href="/branches">branches</a></li> |
228 </ul> | |
229 <ul> | |
230 <li><a href="/rev/2ef0ac749a14">changeset</a></li> | |
231 <li class="active">browse</li> | |
232 </ul> | |
233 <ul> | |
234 | |
235 </ul> | |
12666
ead4e21f49f1
web: add a help view for getting hg help output
Augie Fackler <durin42@gmail.com>
parents:
12432
diff
changeset
|
236 <ul> |
ead4e21f49f1
web: add a help view for getting hg help output
Augie Fackler <durin42@gmail.com>
parents:
12432
diff
changeset
|
237 <li><a href="/help">help</a></li> |
ead4e21f49f1
web: add a help view for getting hg help output
Augie Fackler <durin42@gmail.com>
parents:
12432
diff
changeset
|
238 </ul> |
12432 | 239 </div> |
240 | |
241 <div class="main"> | |
242 <h2><a href="/">test</a></h2> | |
243 <h3>directory / @ 0:2ef0ac749a14 <span class="tag">tip</span> </h3> | |
244 | |
245 <form class="search" action="/log"> | |
246 | |
247 <p><input name="rev" id="search1" type="text" size="30" /></p> | |
248 <div id="hint">find changesets by author, revision, | |
249 files, or words in the commit message</div> | |
250 </form> | |
251 | |
252 <table class="bigtable"> | |
253 <tr> | |
254 <th class="name">name</th> | |
255 <th class="size">size</th> | |
256 <th class="permissions">permissions</th> | |
257 </tr> | |
258 <tr class="fileline parity0"> | |
259 <td class="name"><a href="/file/2ef0ac749a14/">[up]</a></td> | |
260 <td class="size"></td> | |
261 <td class="permissions">drwxr-xr-x</td> | |
262 </tr> | |
263 | |
264 <tr class="fileline parity1"> | |
265 <td class="name"> | |
266 <a href="/file/2ef0ac749a14/da"> | |
267 <img src="/static/coal-folder.png" alt="dir."/> da/ | |
268 </a> | |
269 <a href="/file/2ef0ac749a14/da/"> | |
270 | |
271 </a> | |
272 </td> | |
273 <td class="size"></td> | |
274 <td class="permissions">drwxr-xr-x</td> | |
275 </tr> | |
276 | |
277 <tr class="fileline parity0"> | |
278 <td class="filename"> | |
279 <a href="/file/2ef0ac749a14/foo"> | |
280 <img src="/static/coal-file.png" alt="file"/> foo | |
281 </a> | |
282 </td> | |
283 <td class="size">4</td> | |
284 <td class="permissions">-rw-r--r--</td> | |
285 </tr> | |
286 </table> | |
287 </div> | |
288 </div> | |
14046
b24e5a708fad
web: Made elapsed time calculation dynamic (javascript).
Benoit Allard <benoit@aeteurope.nl>
parents:
13863
diff
changeset
|
289 <script type="text/javascript">process_dates()</script> |
12432 | 290 |
291 | |
292 </body> | |
293 </html> | |
294 | |
5561
22713dce19f6
hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
5384
diff
changeset
|
295 |
12432 | 296 stop and restart |
297 | |
298 $ "$TESTDIR/killdaemons.py" | |
299 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log | |
300 $ cat hg.pid >> $DAEMON_PIDS | |
5561
22713dce19f6
hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
5384
diff
changeset
|
301 |
12432 | 302 Test the access/error files are opened in append mode |
303 | |
304 $ python -c "print len(file('access.log').readlines()), 'log lines written'" | |
305 10 log lines written | |
306 | |
307 static file | |
5561
22713dce19f6
hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents:
5384
diff
changeset
|
308 |
12432 | 309 $ "$TESTDIR/get-with-headers.py" --twice localhost:$HGPORT '/static/style-gitweb.css' |
310 200 Script output follows | |
311 | |
312 body { font-family: sans-serif; font-size: 12px; margin:0px; border:solid #d9d8d1; border-width:1px; margin:10px; } | |
313 a { color:#0000cc; } | |
314 a:hover, a:visited, a:active { color:#880000; } | |
315 div.page_header { height:25px; padding:8px; font-size:18px; font-weight:bold; background-color:#d9d8d1; } | |
316 div.page_header a:visited { color:#0000cc; } | |
317 div.page_header a:hover { color:#880000; } | |
318 div.page_nav { padding:8px; } | |
319 div.page_nav a:visited { color:#0000cc; } | |
320 div.page_path { padding:8px; border:solid #d9d8d1; border-width:0px 0px 1px} | |
321 div.page_footer { padding:4px 8px; background-color: #d9d8d1; } | |
322 div.page_footer_text { float:left; color:#555555; font-style:italic; } | |
323 div.page_body { padding:8px; } | |
324 div.title, a.title { | |
325 display:block; padding:6px 8px; | |
326 font-weight:bold; background-color:#edece6; text-decoration:none; color:#000000; | |
327 } | |
328 a.title:hover { background-color: #d9d8d1; } | |
329 div.title_text { padding:6px 0px; border: solid #d9d8d1; border-width:0px 0px 1px; } | |
330 div.log_body { padding:8px 8px 8px 150px; } | |
331 .age { white-space:nowrap; } | |
332 span.age { position:relative; float:left; width:142px; font-style:italic; } | |
333 div.log_link { | |
334 padding:0px 8px; | |
335 font-size:10px; font-family:sans-serif; font-style:normal; | |
336 position:relative; float:left; width:136px; | |
337 } | |
338 div.list_head { padding:6px 8px 4px; border:solid #d9d8d1; border-width:1px 0px 0px; font-style:italic; } | |
339 a.list { text-decoration:none; color:#000000; } | |
340 a.list:hover { text-decoration:underline; color:#880000; } | |
341 table { padding:8px 4px; } | |
342 th { padding:2px 5px; font-size:12px; text-align:left; } | |
343 tr.light:hover, .parity0:hover { background-color:#edece6; } | |
344 tr.dark, .parity1 { background-color:#f6f6f0; } | |
345 tr.dark:hover, .parity1:hover { background-color:#edece6; } | |
346 td { padding:2px 5px; font-size:12px; vertical-align:top; } | |
347 td.closed { background-color: #99f; } | |
348 td.link { padding:2px 5px; font-family:sans-serif; font-size:10px; } | |
349 td.indexlinks { white-space: nowrap; } | |
350 td.indexlinks a { | |
351 padding: 2px 5px; line-height: 10px; | |
352 border: 1px solid; | |
353 color: #ffffff; background-color: #7777bb; | |
354 border-color: #aaaadd #333366 #333366 #aaaadd; | |
355 font-weight: bold; text-align: center; text-decoration: none; | |
356 font-size: 10px; | |
357 } | |
358 td.indexlinks a:hover { background-color: #6666aa; } | |
359 div.pre { font-family:monospace; font-size:12px; white-space:pre; } | |
360 div.diff_info { font-family:monospace; color:#000099; background-color:#edece6; font-style:italic; } | |
361 div.index_include { border:solid #d9d8d1; border-width:0px 0px 1px; padding:12px 8px; } | |
362 div.search { margin:4px 8px; position:absolute; top:56px; right:12px } | |
363 .linenr { color:#999999; text-decoration:none } | |
364 div.rss_logo { float: right; white-space: nowrap; } | |
365 div.rss_logo a { | |
366 padding:3px 6px; line-height:10px; | |
367 border:1px solid; border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e; | |
368 color:#ffffff; background-color:#ff6600; | |
369 font-weight:bold; font-family:sans-serif; font-size:10px; | |
370 text-align:center; text-decoration:none; | |
371 } | |
372 div.rss_logo a:hover { background-color:#ee5500; } | |
373 pre { margin: 0; } | |
374 span.logtags span { | |
375 padding: 0px 4px; | |
376 font-size: 10px; | |
377 font-weight: normal; | |
378 border: 1px solid; | |
379 background-color: #ffaaff; | |
380 border-color: #ffccff #ff00ee #ff00ee #ffccff; | |
381 } | |
382 span.logtags span.tagtag { | |
383 background-color: #ffffaa; | |
384 border-color: #ffffcc #ffee00 #ffee00 #ffffcc; | |
385 } | |
386 span.logtags span.branchtag { | |
387 background-color: #aaffaa; | |
388 border-color: #ccffcc #00cc33 #00cc33 #ccffcc; | |
389 } | |
390 span.logtags span.inbranchtag { | |
391 background-color: #d5dde6; | |
392 border-color: #e3ecf4 #9398f4 #9398f4 #e3ecf4; | |
393 } | |
13863
b602ac02f1ba
hgweb: add bookmark labels to gitweb theme (based on 270f57d35525)
Yuya Nishihara <yuya@tcha.org>
parents:
13597
diff
changeset
|
394 span.logtags span.bookmarktag { |
b602ac02f1ba
hgweb: add bookmark labels to gitweb theme (based on 270f57d35525)
Yuya Nishihara <yuya@tcha.org>
parents:
13597
diff
changeset
|
395 background-color: #afdffa; |
b602ac02f1ba
hgweb: add bookmark labels to gitweb theme (based on 270f57d35525)
Yuya Nishihara <yuya@tcha.org>
parents:
13597
diff
changeset
|
396 border-color: #ccecff #46ace6 #46ace6 #ccecff; |
b602ac02f1ba
hgweb: add bookmark labels to gitweb theme (based on 270f57d35525)
Yuya Nishihara <yuya@tcha.org>
parents:
13597
diff
changeset
|
397 } |
12432 | 398 |
399 /* Graph */ | |
400 div#wrapper { | |
401 position: relative; | |
402 margin: 0; | |
403 padding: 0; | |
404 margin-top: 3px; | |
405 } | |
406 | |
407 canvas { | |
408 position: absolute; | |
409 z-index: 5; | |
410 top: -0.9em; | |
411 margin: 0; | |
412 } | |
413 | |
414 ul#nodebgs { | |
415 list-style: none inside none; | |
416 padding: 0; | |
417 margin: 0; | |
418 top: -0.7em; | |
419 } | |
420 | |
421 ul#graphnodes li, ul#nodebgs li { | |
422 height: 39px; | |
423 } | |
424 | |
425 ul#graphnodes { | |
426 position: absolute; | |
427 z-index: 10; | |
428 top: -0.8em; | |
429 list-style: none inside none; | |
430 padding: 0; | |
431 } | |
432 | |
433 ul#graphnodes li .info { | |
434 display: block; | |
435 font-size: 100%; | |
436 position: relative; | |
437 top: -3px; | |
438 font-style: italic; | |
439 } | |
440 304 Not Modified | |
441 | |
9842
d3dbdca92458
hgweb: don't choke when an inexistent style is requested (issue1901)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
8167
diff
changeset
|
442 |
12432 | 443 errors |
5690
1b365c5723bc
server: append to logfiles
Mirko Friedenhagen <mirko-lists@friedenhagen.de>
parents:
5580
diff
changeset
|
444 |
12432 | 445 $ cat errors.log |