hgweb: fill in content-type and content-length as native strings
This lets me actually get a capabilities response from hgweb over
http.
Differential Revision: https://phab.mercurial-scm.org/D1087
hgweb: set sent_headers attr as early as practical
While doing Python 3 porting work, I've seen exceptions happen in
parts of hgweb we normally assume are robust. It won't hurt anything
to set this attribute significantly earlier, so let's do so and save
confusing during the porting process.
Differential Revision: https://phab.mercurial-scm.org/D1085