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