Improved header handling

Now handles folded header fields

Added function to compact headers (pre-generates fields)