mirror of
https://github.com/emikulic/darkhttpd.git
synced 2023-08-10 21:13:08 +03:00
Dir listing: special-case ".." to come first.
Suggested by: @frogtile Fixes #14
This commit is contained in:
@ -22,6 +22,7 @@ runtests() {
|
||||
rm -rf $DIR || exit 1
|
||||
fi
|
||||
mkdir $DIR || exit 1
|
||||
mkdir $DIR/\( || exit 1
|
||||
mkdir $DIR/forbidden || exit 1
|
||||
chmod 0 $DIR/forbidden || exit 1
|
||||
mkdir $DIR/unreadable || exit 1
|
||||
|
@ -174,6 +174,15 @@ class TestDirList(TestHelper):
|
||||
self.assertEqual(ord("#"), 0x23)
|
||||
self.assertContains(body, "escape%28this%29name", "12345")
|
||||
|
||||
def test_dotdot_first(self):
|
||||
resp = self.get("/")
|
||||
status, hdrs, body = parse(resp)
|
||||
self.assertLess(b'(', b'..') # ( sorts before ..
|
||||
paren_pos = body.index(b'<a href="%28">(</a>/')
|
||||
dotdot_pos = body.index(b'<a href="..">..</a>/')
|
||||
# But we special-case .. to come first
|
||||
self.assertLess(dotdot_pos, paren_pos)
|
||||
|
||||
class TestCases(TestHelper):
|
||||
pass # these get autogenerated in setUpModule()
|
||||
|
||||
|
Reference in New Issue
Block a user