Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1d105d1

Browse files
committed
For this server to work on Windows, directories should use "/" as the
separator in the href, not os.sep. Added a <title> tag to directory listings. Bumped version to 0.5.
1 parent 410a844 commit 1d105d1

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Lib/SimpleHTTPServer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"""
77

88

9-
__version__ = "0.4"
9+
__version__ = "0.5"
1010

1111

1212
import os
@@ -99,6 +99,7 @@ def list_directory(self, path):
9999
return None
100100
list.sort(lambda a, b: cmp(a.lower(), b.lower()))
101101
f = StringIO()
102+
f.write("<title>Directory listing for %s</title>\n" % self.path)
102103
f.write("<h2>Directory listing for %s</h2>\n" % self.path)
103104
f.write("<hr>\n<ul>\n")
104105
for name in list:
@@ -107,7 +108,7 @@ def list_directory(self, path):
107108
# Append / for directories or @ for symbolic links
108109
if os.path.isdir(fullname):
109110
displayname = name + "/"
110-
linkname = name + os.sep
111+
linkname = name + "/"
111112
if os.path.islink(fullname):
112113
displayname = name + "@"
113114
# Note: a link to a directory displays with @ and links with /

0 commit comments

Comments
 (0)