Harden web/download pipeline and split handler modules
Replace shell-based downloader execution with validated arguments, enforce request hardening and safer defaults, and refactor handlers/router/state so job control is safer and easier to maintain.
This commit is contained in:
19
src/router.go
Normal file
19
src/router.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package main
|
||||
|
||||
import "net/http"
|
||||
|
||||
func newRouter() http.Handler {
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("/", handleRoot)
|
||||
mux.HandleFunc("/upload", handleUpload)
|
||||
mux.HandleFunc("/select", handleSelect)
|
||||
mux.HandleFunc("/process", handleProcess)
|
||||
mux.HandleFunc("/progress", handleProgress)
|
||||
mux.HandleFunc("/abort", handleAbort)
|
||||
mux.HandleFunc("/pause", handlePause)
|
||||
mux.HandleFunc("/resume", handleResume)
|
||||
mux.HandleFunc("/clear-completed", handleClearCompleted)
|
||||
mux.HandleFunc("/ws", handleWebSocket)
|
||||
mux.HandleFunc("/set-speed-limit", handleSetSpeedLimit)
|
||||
return withSecurityHeaders(mux)
|
||||
}
|
||||
Reference in New Issue
Block a user