Router cleanup

This commit is contained in:
Brahim Hadriche committed 2022-11-28 12:19:40 -05:00
1 parent e0cc6970ab
commit 27b4ad90d3
6 files changed
+29 -47

No files matched your search

@@ -18,12 +18,8 @@ namespace Http
request = context.request
response = context.response
uri = request.uri
decoded_uri = WebUtils.UrlUnescape(uri)
if decoded_uri.instr("?")
decoded_uri = decoded_uri.Tokenize("?")[0]
end if
path = CreateObject("roPath", router.root + decoded_uri)
decoded_path = WebUtils.UrlUnescape(request.route)
path = CreateObject("roPath", router.root + decoded_path)
fs = CreateObject("roFilesystem")
if not path.isValid()
@@ -49,9 +45,9 @@ namespace Http
router.GenerateDirectoryListing(path, router, request, response)
return true
else if stat.type = "file"
response.mimetype = WebUtils.MimeType(decoded_uri)
response.mimetype = WebUtils.MimeType(decoded_path)
response.fileLength = stat.size
router.log.info("uri=" + uri + ", target=" + path + ", content-type=" + response.mimetype + ", content-length=" + Stri(response.fileLength).trim())
router.log.info("uri=" + request.uri + ", target=" + path + ", content-type=" + response.mimetype + ", content-length=" + Stri(response.fileLength).trim())
router.GenerateFile(path, router, request, response)
return true
else