copies: make the loss in _backwardcopies more stable
A couple of tests shows slightly more correct output. That is pure coincidence.
serve: use chunked encoding in hgweb responses
'hg serve' used to close connections when sending a response with unknown
length ... such as a bundle or archive.
Now chunked encoding will be used for responses with unknown length, and the
connection do thus not have to be closed to indicate the end of the response.
Chunked encoding is only used if the length is unknown, if the connection
wouldn't be closed for other reasons, AND if it is a HTTP 1.1 request.
This will not benefit other users of hgweb ... but it can serve as an example
that it can be done.
serve: remove connection close hack for Python 2.3
Introduced in
276de216d2c5 and no longer needed - BaseHTTPServer handles
connection closing just fine if we don't mess with its internals.
hgweb: pass the actual response body to request.response, not just the length
This makes it less likely to send a response that doesn't match Content-Length.
hgweb: don't pass empty response chunks on
hgweb internals will often produce empty writes - especially when returning
compressed data. hgweb is no middleware application and there is thus no
reason to pass them on to be processed in other layers.
hgweb: remove handling of any else than strings from request.write
Iterators should be returned WSGI style, not written. And apparently all of
hgweb do that.
serve: send response headers even if response has no body
The headers would usually be sent anyway because the app did a number of writes
of empty strings.
hgweb: simplify wsgirequest header handling
Remove leaky header abstraction and prepare for other encodings.
hgweb: make type a mandatory parameter to request.respond
There will thus always be headers and the runtime check can be removed.
hgweb: use Content-Length for pushres
This prevents some unnecessary http connection close.