Commit Graph

21 Commits

Author SHA1 Message Date
Pierre-Yves David
fddf556ac8 phase: apply publishing enforcement for "serve" source
When a changegroup is added by a push on a publishing server, we ensure they
are added as public. This is used to enforce publishing on server when the
client is not aware of phases. It also prevents race conditions where a reader
could see the changesets as draft before they get turned public by the client.
Finally, this save rounds trip as the client does not need additional request to
turn them public.

However, this logic was only enforced when the changegroup was from a "push"
source. And "push" is used for local pushes only. Wireprotocol push uses "serve"
as source since Mercurial 1.9. We now enforce this logic for both "push" and
"serve" sources.

One could note that this logic was mainly useful during wireprotocol exchanges.
So this code is finally put into good use, 9 versions after its introduction.
2014-04-07 18:10:50 -07:00
Stéphane Klein
f029558dda http: reuse authentication info after the first failed request (issue3567)
[This was applied in df58533adb15 but backed out again in 8127f169caa4 because
of Python 2.4 issues. This edition and test-http.t works with Python 2.4.]

Context: mercurial access to repository server with http access, and this
server is protected by basic auth.

Before patch:

* mercurial try an anonymous access to server, server return 401 response and
  mercurial resend request with login / password information

After patch:

* mercurial try an anonymous access to server, server return
  401 response. For all next requests, mercurial keep in memory this
  information (this server need basic auth information).

This patch reduce the number of http access against mercurial server.

Example, before patch:

10.10.168.170 - - [25/Oct/2013:15:44:51 +0200] "GET /hg/testagt?cmd=capabilities
HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:44:52 +0200] "GET /hg/testagt?cmd=capabilities
HTTP/1.1" 200 147 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:00 +0200] "GET /hg/testagt?cmd=capabilities
HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:01 +0200] "GET /hg/testagt?cmd=capabilities
HTTP/1.1" 200 147 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:03 +0200] "GET /hg/testagt?cmd=batch
HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:04 +0200] "GET /hg/testagt?cmd=batch
HTTP/1.1" 200 42 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:06 +0200] "GET /hg/testagt?cmd=getbundle
HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:07 +0200] "GET /hg/testagt?cmd=getbundle
HTTP/1.1" 200 61184 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:09 +0200] "GET /hg/testagt?cmd=listkeys
HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:10 +0200] "GET /hg/testagt?cmd=listkeys
HTTP/1.1" 200 15 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:12 +0200] "GET /hg/testagt?cmd=listkeys
HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:12 +0200] "GET /hg/testagt?cmd=listkeys
HTTP/1.1" 200 - "-" "mercurial/proto-1.0"

Example after patch:

10.10.168.170 - - [28/Oct/2013:11:49:14 +0100] "GET /hg/testagt?cmd=capabilities
HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
10.10.168.170 - - [28/Oct/2013:11:49:15 +0100] "GET /hg/testagt?cmd=capabilities
HTTP/1.1" 200 147 "-" "mercurial/proto-1.0"
10.10.168.170 - - [28/Oct/2013:11:49:17 +0100] "GET /hg/testagt?cmd=batch
HTTP/1.1" 200 42 "-" "mercurial/proto-1.0"
10.10.168.170 - - [28/Oct/2013:11:49:19 +0100] "GET /hg/testagt?cmd=getbundle
HTTP/1.1" 200 61184 "-" "mercurial/proto-1.0"
10.10.168.170 - - [28/Oct/2013:11:49:22 +0100] "GET /hg/testagt?cmd=listkeys
HTTP/1.1" 200 15 "-" "mercurial/proto-1.0"
10.10.168.170 - - [28/Oct/2013:11:49:24 +0100] "GET /hg/testagt?cmd=listkeys
HTTP/1.1" 200 - "-" "mercurial/proto-1.0"

In this last example, you can see only one 401 response.
2013-12-20 14:56:05 +01:00
Mads Kiilerich
3341cf857f tests: improved test coverage for HTTP authentication and 401 responses
Dump the access log to verify that the client gets the 401s it deserves and
handles them correctly. This establishes a baseline for Basic authentication
protocol.
2014-02-05 01:41:36 +01:00
Mads Kiilerich
59b97fe104 tests: ignore http tests that are known wontfix failures on python 2.4
As mentioned on http://bz.selenic.com/show_bug.cgi?id=2739#c17 , babf177f9036
left test-http.t failing on Python < 2.4.3. That has not been noticed because
most 2.4 testing has been done with a patched 2.4.2.

This makes sure that the tests only are run for Python >= 2.4.3. That makes it
possible to verify that everything else works with Python 2.4.
2014-02-05 01:37:37 +01:00
Lucas Moscovicz
178ffcb15d url: added authuri when login information is requested (issue3209)
When users are using a revset they can get multiple password prompts.
This prompts have no extra information about which password is being requested
so I added the authuri to the prompt to make it recognizable.

As in:
$ hg log -r "outgoing('https://bitbucket.org/mg/test') -
outgoing('https://bitbucket.org/nesneros/test')"
http authorization required
realm: Bitbucket.org HTTP
user: interrupted!

I changed it to describe the url when prompting for password.
As in:
$ hg log -r "outgoing('https://bitbucket.org/mg/test') -
outgoing('https://bitbucket.org/nesneros/test')"
http authorization required for https://bitbucket.org/mg/test
realm: Bitbucket.org HTTP
user: interrupted!
2014-01-15 16:46:20 -08:00
Augie Fackler
5200764eb8 clone: don't fail with --update for non-local clones (issue3578)
This was broken by e01343f7da6f due to lack of test coverage. This
adds a test and fixes the defect.
2012-08-08 10:04:02 -05:00
Brad Hall
6b8032746f tag: don't allow tagging the null revision (issue1915)
Also fixed the tests that were doing this and expected it to work
2012-06-05 17:00:13 -07:00
Adrian Buehlmann
41fcaa827d test-http and test-https: partially adapt for Windows 2012-06-19 19:45:00 +02:00
Mads Kiilerich
a8107f523f tests: consistently use printenv.py the same MSYS/Windows-compatible way
This will remove some reasons some tests are disabled on Windows.
2012-06-21 03:05:02 +02:00
Adrian Buehlmann
b761076e81 tests/printenv.py: eliminate trailing spaces on output 2012-06-17 00:27:31 +02:00
Benoit Allard
ed90b14694 protocol: Add the stream-preferred capability
This makes the client use the uncompressed protocol.
2012-04-04 00:00:47 +02:00
Mads Kiilerich
8415df7277 tests: use 'hghave serve' to guard tests that requires serve daemon management 2011-11-07 03:24:53 +01:00
Mads Kiilerich
a9383c13c5 subrepo: fix cloning of repos from urls without slash after host (issue2970)
This fixes a regression introduced with the new url handling in 1.9.

This should perhaps be fixed in the url class instead, but that might be too
invasive for a stable bugfix.
2011-08-26 16:23:35 +02:00
Mads Kiilerich
6c5f486f38 test-http: test http authentication
The extension hack is based on Henrik Stuart's hg-textauth.
2011-08-05 00:39:54 +02:00
Peter Arrenbrecht
66c54cef75 bundlerepo: fix and improve getremotechanges
Fixes the regression where incoming could show local changes
introduced by rev eecf03f0ef7c.
2011-05-02 12:36:23 +02:00
Thomas Arendsen Hein
f0eec1822c tests: check for (*/sec) instead of (*B/sec) to match (X bytes/sec)
I just had: transferred 606 bytes in 2.9 seconds (211 bytes/sec)
2011-04-29 11:04:39 +02:00
Mads Kiilerich
53a7e81f78 hgweb: handle invalid requests with both form data and querystring
Invalid requests could give an unhandled ErrorResponse.

Now this ErrorResponse is handled like other ErrorResponses so the client gets
an error message which also is logged on the server.
2011-02-21 00:57:19 +01:00
Mads Kiilerich
e4660104cf util: flush stdout before calling external processes
stdout could have content in its buffer while a subprocess ran and emitted
output.

Flushing stdout ensures that output now comes in the right order.
2011-02-18 03:35:01 +01:00
Mads Kiilerich
3e84017cf0 tests: use printenv.py where it is - don't copy it around 2011-02-15 02:17:43 +01:00
Mads Kiilerich
e490eeec3f tests: reintroduce ":$HGPORT" in test output
This reduces the number of patterns that must be adjusted when writing tests.
2010-10-08 22:36:11 -05:00
Matt Mackall
692a52d686 tests: unify test-http 2010-09-26 13:41:32 -05:00