Coerce fractional, negative and non-numeric length arguments to numbers. Fractional numbers are rounded up, negative numbers and non-numeric values are set to zero.
Fixes #1569, parse error on multi-line HTTP headers.
An overloaded toString() method may have side effects so don't call it for a simple type check. Back-port of 54b409d to the v0.4 branch.