I think we should rewrite this later to match what we have in our http package.  This allows for cheaper encoding of headers.