encode implements HTTP/1.1 section 4.4 Message Length