mirror of
https://github.com/caddyserver/caddy.git
synced 2025-04-24 05:44:04 +08:00
use strconv.ParseUint instead of strconv.ParseInt
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
This commit is contained in:
parent
6db43b6079
commit
f0801b9da5
@ -141,13 +141,10 @@ func (c *client) Do(p map[string]string, req io.Reader) (r io.Reader, err error)
|
||||
// check for CONTENT_LENGTH, since the lack of it or wrong value will cause the backend to hang
|
||||
if clStr, ok := p["CONTENT_LENGTH"]; !ok {
|
||||
return nil, caddyhttp.Error(http.StatusLengthRequired, nil)
|
||||
} else {
|
||||
cl, err := strconv.ParseInt(clStr, 10, 64)
|
||||
} else if _, err := strconv.ParseUint(clStr, 10, 64); err != nil {
|
||||
// stdlib won't return a negative Content-Length, but we check just in case,
|
||||
// the most likely cause is from a missing content length, which is -1
|
||||
if err != nil || cl < 0 {
|
||||
return nil, caddyhttp.Error(http.StatusLengthRequired, err)
|
||||
}
|
||||
return nil, caddyhttp.Error(http.StatusLengthRequired, err)
|
||||
}
|
||||
|
||||
writer := &streamWriter{c: c}
|
||||
|
Loading…
x
Reference in New Issue
Block a user