1
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-16 21:56:40 -05:00

check if body is less than anticipated when there is no error reported

This commit is contained in:
WeidiDeng 2024-10-17 16:22:17 +08:00
parent 7d483ff3ef
commit 8c803b503c
No known key found for this signature in database
GPG key ID: 25F87CE1741EC7CD

View file

@ -157,13 +157,13 @@ func (c *client) Do(p map[string]string, req io.Reader) (r io.Reader, err error)
writer.recType = Stdin
if req != nil {
_, err = io.Copy(writer, req)
if err != nil {
return nil, err
}
// body length mismatch
if lr, ok := req.(*io.LimitedReader); ok && lr.N > 0 {
return nil, io.ErrUnexpectedEOF
}
if err != nil {
return nil, err
}
}
err = writer.FlushStream()
if err != nil {