diff --git a/src/net/http/filetransport.go b/src/net/http/filetransport.go index 7384b22fbe9..b08bae63487 100644 --- a/src/net/http/filetransport.go +++ b/src/net/http/filetransport.go @@ -35,7 +35,7 @@ func NewFileTransport(fs FileSystem) RoundTripper { // NewFileTransportFS returns a new [RoundTripper], serving the provided // file system fsys. The returned RoundTripper ignores the URL host in its // incoming requests, as well as most other properties of the -// request. +// request. The files provided by fsys must implement [io.Seeker]. // // The typical use case for NewFileTransportFS is to register the "file" // protocol with a [Transport], as in: diff --git a/src/net/http/fs.go b/src/net/http/fs.go index 70653550f02..3a716fbd2cc 100644 --- a/src/net/http/fs.go +++ b/src/net/http/fs.go @@ -819,6 +819,7 @@ func ServeFile(w ResponseWriter, r *Request, name string) { // ServeFileFS replies to the request with the contents // of the named file or directory from the file system fsys. +// The files provided by fsys must implement [io.Seeker]. // // If the provided name is constructed from user input, it should be // sanitized before calling [ServeFileFS]. @@ -965,6 +966,7 @@ func FileServer(root FileSystem) Handler { // FileServerFS returns a handler that serves HTTP requests // with the contents of the file system fsys. +// The files provided by fsys must implement [io.Seeker]. // // As a special case, the returned file server redirects any request // ending in "/index.html" to the same path, without the final