MCPcopy Create free account
hub / github.com/php/frankenphp / parseContentLength

Function parseContentLength

recorder_test.go:265–275  ·  view source on GitHub ↗

parseContentLength trims whitespace from s and returns -1 if no value is set, or the value if it's >= 0. This a modified version of same function found in net/http/transfer.go. This one just ignores an invalid header.

(cl string)

Source from the content-addressed store, hash-verified

263// This a modified version of same function found in net/http/transfer.go. This
264// one just ignores an invalid header.
265func parseContentLength(cl string) int64 {
266 cl = textproto.TrimString(cl)
267 if cl == "" {
268 return -1
269 }
270 n, err := strconv.ParseUint(cl, 10, 63)
271 if err != nil {
272 return -1
273 }
274 return int64(n)
275}

Callers 1

ResultMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected