aboutsummaryrefslogtreecommitdiff
path: root/http.go
diff options
context:
space:
mode:
Diffstat (limited to 'http.go')
-rw-r--r--http.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/http.go b/http.go
index d134b62..4f8718c 100644
--- a/http.go
+++ b/http.go
@@ -2120,6 +2120,12 @@ func writeBodyFixedSize(w *bufio.Writer, r io.Reader, size int64) error {
}
func copyZeroAlloc(w io.Writer, r io.Reader) (int64, error) {
+ if wt, ok := r.(io.WriterTo); ok {
+ return wt.WriteTo(w)
+ }
+ if rt, ok := w.(io.ReaderFrom); ok {
+ return rt.ReadFrom(r)
+ }
vbuf := copyBufPool.Get()
buf := vbuf.([]byte)
n, err := io.CopyBuffer(w, r, buf)