global handleDir def handleDir(env): filePath = env["fPath"] simpleResponse( env["self"].connection,"200 OK",{ "Content-Type": "text/html; charset=UTF-8", "Accept-Ranges": "none", "Date": env["requestTimeFormatted"] } ) dirList = [] fileList = [] with fileLock: for root,dirs,files in os.walk(filePath): for file in dirs: dirList.append(p(root,file).replace(filePath + os.path.sep,"",1).replace(os.path.sep,"/") + "/") for file in files: fileList.append(p(root,file).replace(filePath + os.path.sep,"",1).replace(os.path.sep,"/")) break dirList.sort(key=str.lower) fileList.sort(key=str.lower) env["self"].connection.sendall(('''\