mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 20:52:33 +02:00
utils.io: revert last change
This commit is contained in:
parent
09db57db8f
commit
9c04065c33
1 changed files with 0 additions and 11 deletions
|
@ -132,17 +132,6 @@ const (
|
||||||
// This is a copy of io.Copy with context and HTTP flusher handling
|
// This is a copy of io.Copy with context and HTTP flusher handling
|
||||||
// Author: yusing <yusing@6uo.me>.
|
// Author: yusing <yusing@6uo.me>.
|
||||||
func CopyClose(dst *ContextWriter, src *ContextReader) (err error) {
|
func CopyClose(dst *ContextWriter, src *ContextReader) (err error) {
|
||||||
// If the reader has a WriteTo method, use it to do the copy.
|
|
||||||
// Avoids an allocation and a copy.
|
|
||||||
if wt, ok := src.Reader.(io.WriterTo); ok {
|
|
||||||
_, err = wt.WriteTo(dst)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// Similarly, if the writer has a ReadFrom method, use it to do the copy.
|
|
||||||
if rf, ok := dst.Writer.(io.ReaderFrom); ok {
|
|
||||||
_, err = rf.ReadFrom(src)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var buf []byte
|
var buf []byte
|
||||||
if l, ok := src.Reader.(*io.LimitedReader); ok {
|
if l, ok := src.Reader.(*io.LimitedReader); ok {
|
||||||
size := copyBufSize
|
size := copyBufSize
|
||||||
|
|
Loading…
Add table
Reference in a new issue