@@ -30,6 +30,10 @@ import (
3030// with good compression ratio.
3131//
3232// See also RequestCtx.SendFileBytes.
33+ //
34+ // WARNING: do not pass any user supplied paths to this function!
35+ // WARNING: if path is based on user input users will be able to request
36+ // any file on your filesystem! Use fasthttp.FS with a sane Root instead.
3337func ServeFileBytesUncompressed (ctx * RequestCtx , path []byte ) {
3438 ServeFileUncompressed (ctx , b2s (path ))
3539}
@@ -43,6 +47,10 @@ func ServeFileBytesUncompressed(ctx *RequestCtx, path []byte) {
4347// with good compression ratio.
4448//
4549// See also RequestCtx.SendFile.
50+ //
51+ // WARNING: do not pass any user supplied paths to this function!
52+ // WARNING: if path is based on user input users will be able to request
53+ // any file on your filesystem! Use fasthttp.FS with a sane Root instead.
4654func ServeFileUncompressed (ctx * RequestCtx , path string ) {
4755 ctx .Request .Header .DelBytes (strAcceptEncoding )
4856 ServeFile (ctx , path )
@@ -62,6 +70,10 @@ func ServeFileUncompressed(ctx *RequestCtx, path string) {
6270// file contents.
6371//
6472// See also RequestCtx.SendFileBytes.
73+ //
74+ // WARNING: do not pass any user supplied paths to this function!
75+ // WARNING: if path is based on user input users will be able to request
76+ // any file on your filesystem! Use fasthttp.FS with a sane Root instead.
6577func ServeFileBytes (ctx * RequestCtx , path []byte ) {
6678 ServeFile (ctx , b2s (path ))
6779}
@@ -79,6 +91,10 @@ func ServeFileBytes(ctx *RequestCtx, path []byte) {
7991// Use ServeFileUncompressed is you don't need serving compressed file contents.
8092//
8193// See also RequestCtx.SendFile.
94+ //
95+ // WARNING: do not pass any user supplied paths to this function!
96+ // WARNING: if path is based on user input users will be able to request
97+ // any file on your filesystem! Use fasthttp.FS with a sane Root instead.
8298func ServeFile (ctx * RequestCtx , path string ) {
8399 rootFSOnce .Do (func () {
84100 rootFSHandler = rootFS .NewRequestHandler ()
0 commit comments