mirror of
https://github.com/caddyserver/caddy.git
synced 2025-07-09 03:04:57 -04:00
Started article, just jotting down some notes
parent
963ca9d827
commit
5c462bed2e
7
Things-HTTP-Middleware-Developers-Should-Know.md
Normal file
7
Things-HTTP-Middleware-Developers-Should-Know.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
*Article is a WIP*
|
||||||
|
|
||||||
|
- Use httpserver.Path to compare base paths to know if your handler should handle the request
|
||||||
|
- Don't touch the file system using a path from the request directly. Instead:
|
||||||
|
- To open a file, use http.Dir
|
||||||
|
- For anything else, use httpserver.SafePath to get a sanitized path
|
||||||
|
- If you need to wrap or record the response, wrap your own ResponseWriter type with httpserver.ResponseWriterWrapper so it is guaranteed to implement some crucial interfaces.
|
Loading…
x
Reference in New Issue
Block a user