hgweb: discard Content-Type header for 304 responses (
issue5844)
A side-effect of
98baf8dea553 was that hgwebdir always sets a global
default for the Content-Type header. HTTP 304 responses don't allow
the Content-Type header. So a side-effect of this change was that
HTTP 304 responses served via hgwebdir resulted in a ProgrammingError
being raised.
This commit teaches our 304 response issuing code to drop the
Content-Type header.
Differential Revision: https://phab.mercurial-scm.org/D3435
tests: add tests demonstrating ISE for HTTP 304 responses with hgwebdir
There are two separate failures here. One for the Content-Type header.
Another for the Content-Security-Policy header.
Differential Revision: https://phab.mercurial-scm.org/D3434
hgweb: guard against empty Content-Length header
Discussion in issue 5860 seems to indicate this can occur.
Differential Revision: https://phab.mercurial-scm.org/D3432
test-push-http: do not clear pid file
It's okay now, but we'll end up leaking daemon processes if we add some
more.
debugcolor: fix crash by empty styles (
issue5856)
tests: explicitly define compression engines for tests
The zstd compression engine requires C extensions and isn't present
in pure Python builds.
The compression engine list leaks into the server capabilities string.
Unless we're testing functionality specific to a compression format,
the set of compression formats supported by a server doesn't matter
much.
So this commit explicitly defines the server's compression engines for
some tests so behavior is consistent between pure and non-pure builds.
Differential Revision: https://phab.mercurial-scm.org/D3431
tests: update no-zstd branch of test-treediscovery.t as in
330ada7e8ea5
This side of the test got overlooked. We should probably consider
having a way to run some of our tests through a "no-zstd" case just
like we run some things through a "no-obsmarkers" case, but that's not
an appropriate thing for stable.
Differential Revision: https://phab.mercurial-scm.org/D3430
tests: glob away content-length changes relating to missing zstd bindings
This doesn't fix everything in these two tests around missing zstd: we
still get some changes in the CBOR payload in ways that I think we
probably shouldn't bother to glob around. Maybe we should just disable
zstd support in some of these lower-level wireproto tests?
Differential Revision: https://phab.mercurial-scm.org/D3429
revlog: make pure version of _partialmatch() support 40-byte hex nodeids
Without this patch, test-histedit-arguments.t would fail when run with
--pure. It turned out to be because the pure version of
_partialmatch() does not support full 40-byte hex nodeids. When
histedit's instructions include things like "pick tip", it resolves
the "tip" revision early to a full nodeid (but plain hex nodeid
prefixes are not resolved to full nodeids). Then the nodeid (full or
not) is looked up using to a full nodeid later. This step is what
fails in pure mode. It has been failing since my
c4131138eadb
(histedit: look up partial nodeid as partial nodeid, 2018-04-06). I
haven't verified, but I suspect histedit instructions like "pick <full
hex nodeid>" would have been failing before my commit too, though.
The fix is trivial: change a "< 40" to "<= 40".
Differential Revision: https://phab.mercurial-scm.org/D3428
hgweb: reuse body file object when hgwebdir calls hgweb (
issue5851)
An unintended side-effect of
f0a851542a05 was that the request body
file object (which uses a util.cappedreader) was constructed twice
when hgwebdir called into hgweb. Since we attempt to read all remaining
data from this file object when Content-Length is defined and since there
were two instances of this object and the client supplied no additional
data to read, this resulted in deadlock.
The fix implemented in this commit is to reuse the request body file
object when it is passed from hgwebdir to hgweb.
A test demonstrating `hg clone` and `hg push` via hgwebdir has been
added. Without this patch, the test hangs when doing `hg clone`.
Surprisingly, this must mean that we have effectively no test coverage
of the wire protocol when run via hgwebdir.
Differential Revision: https://phab.mercurial-scm.org/D3427