fix fatal flaw with HEAD implementation; add ".cci" to file extention whitelist / MIME database
This commit is contained in:
@@ -18,6 +18,8 @@ ALLOWED_METHODS = {"GET", "POST", "HEAD", "PUT"}
|
|||||||
script_directory = os.path.dirname(os.path.abspath(sys.argv[0]))
|
script_directory = os.path.dirname(os.path.abspath(sys.argv[0]))
|
||||||
webroot_real = os.path.realpath(script_directory + "/webroot")
|
webroot_real = os.path.realpath(script_directory + "/webroot")
|
||||||
|
|
||||||
|
requestType = ""
|
||||||
|
|
||||||
trying = True
|
trying = True
|
||||||
while trying:
|
while trying:
|
||||||
try:
|
try:
|
||||||
@@ -323,8 +325,8 @@ def handle_connection(connectionSocket, addr):
|
|||||||
fullRequestPath = script_directory + "/webroot/404.html"
|
fullRequestPath = script_directory + "/webroot/404.html"
|
||||||
|
|
||||||
plainresponse = False
|
plainresponse = False
|
||||||
extensions = [ ".html", ".json", ".png", ".gif", ".ico", ".jpg", ".css", ".txt", ".ttf", ".mp4", ".gz", ".img"]
|
extensions = [ ".html", ".json", ".png", ".gif", ".ico", ".jpg", ".css", ".txt", ".ttf", ".mp4", ".gz", ".img", ".cci"]
|
||||||
contentTypes = ["text/html", "text/json", "image/png", "image/gif", "image/x-icon", "image/jpeg", "text/css", "text/plain", "application/octet-stream", "video/mp4", "application/gzip", "application/octet-stream"]
|
contentTypes = ["text/html", "text/json", "image/png", "image/gif", "image/x-icon", "image/jpeg", "text/css", "text/plain", "application/octet-stream", "video/mp4", "application/gzip", "application/octet-stream","application/octet-stream"]
|
||||||
for i in range(len(extensions)):
|
for i in range(len(extensions)):
|
||||||
if fullRequestPath.endswith(extensions[i]):
|
if fullRequestPath.endswith(extensions[i]):
|
||||||
plainresponse = True
|
plainresponse = True
|
||||||
|
|||||||
Reference in New Issue
Block a user