6 ms·
FYI, you should replace DocsHandler with net/http's FileServer. Reasons: 1) the implementation is not vulnerable to path traversal attacks (i.e. if url.Path ==
by agentS 13y ago
FYI, you should replace DocsHandler with net/http's FileServer.
Reasons:
1) the implementation is not vulnerable to path traversal attacks (i.e. if url.Path == "/../../../../../etc/passwd").
2) It automatically handles index.html
3) It uses "/etc/mime.types" and other system files to automatically set mime types
4) It streams the file back instead of reading it all into memory.
- melvinmt 13y agoThanks! Didn't know about Fileserver. I'll look into it.