Ditto
This commit is contained in:
parent
d20f3b5434
commit
d5664f33e1
@ -1,7 +1,8 @@
|
||||
global handleText
|
||||
def handleText(env):
|
||||
filePath = env["fPath"]
|
||||
data = b""
|
||||
lastModified = 0
|
||||
lastModified = None
|
||||
with fileLock:
|
||||
with open(env["fPath"],"rb") as textFile:
|
||||
data = textFile.read()
|
||||
@ -9,16 +10,18 @@ def handleText(env):
|
||||
lastModified = os.path.getmtime(filePath)
|
||||
except:
|
||||
pass
|
||||
lastModified = email.utils.formatdate(lastModified).replace("-0000","GMT")
|
||||
|
||||
headers = {
|
||||
"Content-Type": mimetypesText[env["fileExt"]]+ "; charset=UTF-8",
|
||||
"Accept-Ranges": "none",
|
||||
"Date": env["requestTimeFormatted"]
|
||||
}
|
||||
|
||||
if lastModified != None:
|
||||
headers["Last-Modified"] = email.utils.formatdate(lastModified).replace("-0000","GMT")
|
||||
|
||||
simpleResponse(
|
||||
env["self"].connection,"200 OK",
|
||||
{
|
||||
"Content-Type": mimetypesText[env["fileExt"]]+ "; charset=UTF-8",
|
||||
"Accept-Ranges": "none",
|
||||
"Date": env["requestTimeFormatted"],
|
||||
"Last-Modified": lastModified
|
||||
},data
|
||||
env["self"].connection,"200 OK",headers,data
|
||||
)
|
||||
|
||||
for t in mimetypesText:
|
||||
|
Loading…
Reference in New Issue
Block a user