mirror of
https://github.com/zedeus/nitter
synced 2026-09-05 22:59:31 +00:00
Fix crash on malformed request paths
This commit is contained in:
parent
60cb10229f
commit
fb9107cff6
2 changed files with 67 additions and 2 deletions
|
|
@ -2,7 +2,7 @@
|
|||
import asyncdispatch, strformat, logging
|
||||
from net import Port
|
||||
from htmlgen import a
|
||||
from os import getEnv
|
||||
from os import getEnv, normalizedPath
|
||||
|
||||
import jester
|
||||
|
||||
|
|
@ -63,12 +63,17 @@ createDebugRouter(cfg)
|
|||
|
||||
settings:
|
||||
port = Port(cfg.port)
|
||||
staticDir = cfg.staticDir
|
||||
staticDir = normalizedPath(cfg.staticDir)
|
||||
bindAddr = cfg.address
|
||||
reusePort = true
|
||||
maxBody = 64 * 1024
|
||||
|
||||
routes:
|
||||
before:
|
||||
# Reject malformed paths
|
||||
if request.path.len == 0 or request.path[0] != '/':
|
||||
halt Http400
|
||||
|
||||
# skip all file URLs
|
||||
cond "." notin request.path
|
||||
applyUrlPrefs()
|
||||
|
|
|
|||
Loading…
Reference in a new issue