Improve ContentType charset parsing, close #2232
Minor clean up
Don't create a new Array when computing bodyLength, close #2233