Fix crash on bad list_to_integer in header parsing

strip leading and trailing spaces from headers. Prevent badarg crash erlang:list_to_integer for content-length header