Encodes the headers into the Writer.
Encodes the headers into the Writer. Does not encode Transfer-Encoding or
Content-Length headers, which are left for the body encoder. Adds
Date header if one is missing and this is a server response.
Note: this method is very niche but useful for both server and client.