]> Cypherpunks.ru repositories - gostls13.git/commit
net/http: use Copy in ServeContent if CopyN not needed
authorLeo Antunes <leo@costela.net>
Sun, 30 Oct 2022 10:15:27 +0000 (10:15 +0000)
committerGopher Robot <gobot@golang.org>
Thu, 9 Mar 2023 17:49:45 +0000 (17:49 +0000)
commit2a3b16e184331501eaa2e3ed626642f1edf9a410
tree575ad6d56f06c2bb5c433fdbe1470e22c3dca619
parentafbcf2138cb5f95d829f0a556ce3aaf77627cc32
net/http: use Copy in ServeContent if CopyN not needed

This small PR allows optimizations made in io.Copy (like the use of
io.WriterTo) to be used in one possible path of http.ServeContent
(in case of a non-Range request).
This, in turn, allows us to skip the buffer allocation in io.Copy.

Change-Id: Ifa2ece206ecd4556aaaed15d663b65e95e00bb0a
GitHub-Last-Rev: 94fc0318145ba1bd48502564f6488aade871c301
GitHub-Pull-Request: golang/go#56480
Reviewed-on: https://go-review.googlesource.com/c/go/+/446276
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
src/net/http/fs.go
src/net/http/fs_test.go