Move some lesser used code to its own method to improve inlining
Use optimised algorith to parse the content length