Parse and encode HTTP headers and cookies