mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-30 22:34:15 -05:00
reverseproxy: Add mention of which half a copyBuffer err comes from (#5472)
Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
This commit is contained in:
parent
2b3046de36
commit
66e571e687
1 changed files with 4 additions and 3 deletions
|
@ -20,6 +20,7 @@ package reverseproxy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
weakrand "math/rand"
|
weakrand "math/rand"
|
||||||
"mime"
|
"mime"
|
||||||
|
@ -215,7 +216,7 @@ func (h Handler) copyBuffer(dst io.Writer, src io.Reader, buf []byte) (int64, er
|
||||||
written += int64(nw)
|
written += int64(nw)
|
||||||
}
|
}
|
||||||
if werr != nil {
|
if werr != nil {
|
||||||
return written, werr
|
return written, fmt.Errorf("writing: %w", werr)
|
||||||
}
|
}
|
||||||
if nr != nw {
|
if nr != nw {
|
||||||
return written, io.ErrShortWrite
|
return written, io.ErrShortWrite
|
||||||
|
@ -223,9 +224,9 @@ func (h Handler) copyBuffer(dst io.Writer, src io.Reader, buf []byte) (int64, er
|
||||||
}
|
}
|
||||||
if rerr != nil {
|
if rerr != nil {
|
||||||
if rerr == io.EOF {
|
if rerr == io.EOF {
|
||||||
rerr = nil
|
return written, nil
|
||||||
}
|
}
|
||||||
return written, rerr
|
return written, fmt.Errorf("reading: %w", rerr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue