Show More
@@ -1,98 +1,113 | |||||
1 | from __future__ import absolute_import |
|
1 | from __future__ import absolute_import | |
2 |
|
2 | |||
3 | import base64 |
|
3 | import base64 | |
4 | import hashlib |
|
4 | import hashlib | |
5 |
|
5 | |||
6 | from mercurial.hgweb import common |
|
6 | from mercurial.hgweb import common | |
7 | from mercurial import ( |
|
7 | from mercurial import ( | |
8 | node, |
|
8 | node, | |
9 | ) |
|
9 | ) | |
10 |
|
10 | |||
11 | def parse_keqv_list(req, l): |
|
11 | def parse_keqv_list(req, l): | |
12 | """Parse list of key=value strings where keys are not duplicated.""" |
|
12 | """Parse list of key=value strings where keys are not duplicated.""" | |
13 | parsed = {} |
|
13 | parsed = {} | |
14 | for elt in l: |
|
14 | for elt in l: | |
15 | k, v = elt.split(b'=', 1) |
|
15 | k, v = elt.split(b'=', 1) | |
16 | if v[0:1] == b'"' and v[-1:] == b'"': |
|
16 | if v[0:1] == b'"' and v[-1:] == b'"': | |
17 | v = v[1:-1] |
|
17 | v = v[1:-1] | |
18 | parsed[k] = v |
|
18 | parsed[k] = v | |
19 | return parsed |
|
19 | return parsed | |
20 |
|
20 | |||
21 | class digestauthserver(object): |
|
21 | class digestauthserver(object): | |
22 | def __init__(self): |
|
22 | def __init__(self): | |
23 | self._user_hashes = {} |
|
23 | self._user_hashes = {} | |
24 |
|
24 | |||
25 | def gethashers(self): |
|
25 | def gethashers(self): | |
26 | def _md5sum(x): |
|
26 | def _md5sum(x): | |
27 | m = hashlib.md5() |
|
27 | m = hashlib.md5() | |
28 | m.update(x) |
|
28 | m.update(x) | |
29 | return node.hex(m.digest()) |
|
29 | return node.hex(m.digest()) | |
30 |
|
30 | |||
31 | h = _md5sum |
|
31 | h = _md5sum | |
32 |
|
32 | |||
33 | kd = lambda s, d, h=h: h(b"%s:%s" % (s, d)) |
|
33 | kd = lambda s, d, h=h: h(b"%s:%s" % (s, d)) | |
34 | return h, kd |
|
34 | return h, kd | |
35 |
|
35 | |||
36 | def adduser(self, user, password, realm): |
|
36 | def adduser(self, user, password, realm): | |
37 | h, kd = self.gethashers() |
|
37 | h, kd = self.gethashers() | |
38 | a1 = h(b'%s:%s:%s' % (user, realm, password)) |
|
38 | a1 = h(b'%s:%s:%s' % (user, realm, password)) | |
39 | self._user_hashes[(user, realm)] = a1 |
|
39 | self._user_hashes[(user, realm)] = a1 | |
40 |
|
40 | |||
41 | def makechallenge(self, realm): |
|
41 | def makechallenge(self, realm): | |
42 | # We aren't testing the protocol here, just that the bytes make the |
|
42 | # We aren't testing the protocol here, just that the bytes make the | |
43 | # proper round trip. So hardcoded seems fine. |
|
43 | # proper round trip. So hardcoded seems fine. | |
44 | nonce = b'064af982c5b571cea6450d8eda91c20d' |
|
44 | nonce = b'064af982c5b571cea6450d8eda91c20d' | |
45 | return b'realm="%s", nonce="%s", algorithm=MD5, qop="auth"' % (realm, |
|
45 | return b'realm="%s", nonce="%s", algorithm=MD5, qop="auth"' % (realm, | |
46 | nonce) |
|
46 | nonce) | |
47 |
|
47 | |||
48 | def checkauth(self, req, header): |
|
48 | def checkauth(self, req, header): | |
49 | log = req.rawenv[b'wsgi.errors'] |
|
49 | log = req.rawenv[b'wsgi.errors'] | |
50 |
|
50 | |||
51 | h, kd = self.gethashers() |
|
51 | h, kd = self.gethashers() | |
52 | resp = parse_keqv_list(req, header.split(b', ')) |
|
52 | resp = parse_keqv_list(req, header.split(b', ')) | |
53 |
|
53 | |||
54 | if resp.get(b'algorithm', b'MD5').upper() != b'MD5': |
|
54 | if resp.get(b'algorithm', b'MD5').upper() != b'MD5': | |
55 | log.write(b'Unsupported algorithm: %s' % resp.get(b'algorithm')) |
|
55 | log.write(b'Unsupported algorithm: %s' % resp.get(b'algorithm')) | |
56 | raise common.ErrorResponse(common.HTTP_FORBIDDEN, |
|
56 | raise common.ErrorResponse(common.HTTP_FORBIDDEN, | |
57 | b"unknown algorithm") |
|
57 | b"unknown algorithm") | |
58 | user = resp[b'username'] |
|
58 | user = resp[b'username'] | |
59 | realm = resp[b'realm'] |
|
59 | realm = resp[b'realm'] | |
60 | nonce = resp[b'nonce'] |
|
60 | nonce = resp[b'nonce'] | |
61 |
|
61 | |||
62 | ha1 = self._user_hashes.get((user, realm)) |
|
62 | ha1 = self._user_hashes.get((user, realm)) | |
63 | if not ha1: |
|
63 | if not ha1: | |
64 | log.write(b'No hash found for user/realm "%s/%s"' % (user, realm)) |
|
64 | log.write(b'No hash found for user/realm "%s/%s"' % (user, realm)) | |
65 | raise common.ErrorResponse(common.HTTP_FORBIDDEN, b"bad user") |
|
65 | raise common.ErrorResponse(common.HTTP_FORBIDDEN, b"bad user") | |
66 |
|
66 | |||
67 | qop = resp.get(b'qop', b'auth') |
|
67 | qop = resp.get(b'qop', b'auth') | |
68 | if qop != b'auth': |
|
68 | if qop != b'auth': | |
69 | log.write(b"Unsupported qop: %s" % qop) |
|
69 | log.write(b"Unsupported qop: %s" % qop) | |
70 | raise common.ErrorResponse(common.HTTP_FORBIDDEN, b"bad qop") |
|
70 | raise common.ErrorResponse(common.HTTP_FORBIDDEN, b"bad qop") | |
71 |
|
71 | |||
72 | cnonce, ncvalue = resp.get(b'cnonce'), resp.get(b'nc') |
|
72 | cnonce, ncvalue = resp.get(b'cnonce'), resp.get(b'nc') | |
73 | if not cnonce or not ncvalue: |
|
73 | if not cnonce or not ncvalue: | |
74 | log.write(b'No cnonce (%s) or ncvalue (%s)' % (cnonce, ncvalue)) |
|
74 | log.write(b'No cnonce (%s) or ncvalue (%s)' % (cnonce, ncvalue)) | |
75 | raise common.ErrorResponse(common.HTTP_FORBIDDEN, b"no cnonce") |
|
75 | raise common.ErrorResponse(common.HTTP_FORBIDDEN, b"no cnonce") | |
76 |
|
76 | |||
77 | a2 = b'%s:%s' % (req.method, resp[b'uri']) |
|
77 | a2 = b'%s:%s' % (req.method, resp[b'uri']) | |
78 | noncebit = b"%s:%s:%s:%s:%s" % (nonce, ncvalue, cnonce, qop, h(a2)) |
|
78 | noncebit = b"%s:%s:%s:%s:%s" % (nonce, ncvalue, cnonce, qop, h(a2)) | |
79 |
|
79 | |||
80 | respdig = kd(ha1, noncebit) |
|
80 | respdig = kd(ha1, noncebit) | |
81 | if respdig != resp[b'response']: |
|
81 | if respdig != resp[b'response']: | |
82 | log.write(b'User/realm "%s/%s" gave %s, but expected %s' |
|
82 | log.write(b'User/realm "%s/%s" gave %s, but expected %s' | |
83 | % (user, realm, resp[b'response'], respdig)) |
|
83 | % (user, realm, resp[b'response'], respdig)) | |
84 | return False |
|
84 | return False | |
85 |
|
85 | |||
86 | return True |
|
86 | return True | |
87 |
|
87 | |||
|
88 | digest = digestauthserver() | |||
|
89 | ||||
88 | def perform_authentication(hgweb, req, op): |
|
90 | def perform_authentication(hgweb, req, op): | |
89 | auth = req.headers.get(b'Authorization') |
|
91 | auth = req.headers.get(b'Authorization') | |
|
92 | ||||
|
93 | if req.headers.get(b'X-HgTest-AuthType') == b'Digest': | |||
|
94 | if not auth: | |||
|
95 | challenge = digest.makechallenge(b'mercurial') | |||
|
96 | raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, b'who', | |||
|
97 | [(b'WWW-Authenticate', b'Digest %s' % challenge)]) | |||
|
98 | ||||
|
99 | if not digest.checkauth(req, auth[7:]): | |||
|
100 | raise common.ErrorResponse(common.HTTP_FORBIDDEN, b'no') | |||
|
101 | ||||
|
102 | return | |||
|
103 | ||||
90 | if not auth: |
|
104 | if not auth: | |
91 | raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, b'who', |
|
105 | raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, b'who', | |
92 | [(b'WWW-Authenticate', b'Basic Realm="mercurial"')]) |
|
106 | [(b'WWW-Authenticate', b'Basic Realm="mercurial"')]) | |
93 |
|
107 | |||
94 | if base64.b64decode(auth.split()[1]).split(b':', 1) != [b'user', b'pass']: |
|
108 | if base64.b64decode(auth.split()[1]).split(b':', 1) != [b'user', b'pass']: | |
95 | raise common.ErrorResponse(common.HTTP_FORBIDDEN, b'no') |
|
109 | raise common.ErrorResponse(common.HTTP_FORBIDDEN, b'no') | |
96 |
|
110 | |||
97 | def extsetup(ui): |
|
111 | def extsetup(ui): | |
98 | common.permhooks.insert(0, perform_authentication) |
|
112 | common.permhooks.insert(0, perform_authentication) | |
|
113 | digest.adduser(b'user', b'pass', b'mercurial') |
@@ -1,552 +1,584 | |||||
1 | #require serve |
|
1 | #require serve | |
2 |
|
2 | |||
3 | $ hg init test |
|
3 | $ hg init test | |
4 | $ cd test |
|
4 | $ cd test | |
5 | $ echo foo>foo |
|
5 | $ echo foo>foo | |
6 | $ mkdir foo.d foo.d/bAr.hg.d foo.d/baR.d.hg |
|
6 | $ mkdir foo.d foo.d/bAr.hg.d foo.d/baR.d.hg | |
7 | $ echo foo>foo.d/foo |
|
7 | $ echo foo>foo.d/foo | |
8 | $ echo bar>foo.d/bAr.hg.d/BaR |
|
8 | $ echo bar>foo.d/bAr.hg.d/BaR | |
9 | $ echo bar>foo.d/baR.d.hg/bAR |
|
9 | $ echo bar>foo.d/baR.d.hg/bAR | |
10 | $ hg commit -A -m 1 |
|
10 | $ hg commit -A -m 1 | |
11 | adding foo |
|
11 | adding foo | |
12 | adding foo.d/bAr.hg.d/BaR |
|
12 | adding foo.d/bAr.hg.d/BaR | |
13 | adding foo.d/baR.d.hg/bAR |
|
13 | adding foo.d/baR.d.hg/bAR | |
14 | adding foo.d/foo |
|
14 | adding foo.d/foo | |
15 | $ hg serve -p $HGPORT -d --pid-file=../hg1.pid -E ../error.log |
|
15 | $ hg serve -p $HGPORT -d --pid-file=../hg1.pid -E ../error.log | |
16 | $ hg serve --config server.uncompressed=False -p $HGPORT1 -d --pid-file=../hg2.pid |
|
16 | $ hg serve --config server.uncompressed=False -p $HGPORT1 -d --pid-file=../hg2.pid | |
17 |
|
17 | |||
18 | Test server address cannot be reused |
|
18 | Test server address cannot be reused | |
19 |
|
19 | |||
20 | $ hg serve -p $HGPORT1 2>&1 |
|
20 | $ hg serve -p $HGPORT1 2>&1 | |
21 | abort: cannot start server at 'localhost:$HGPORT1': $EADDRINUSE$ |
|
21 | abort: cannot start server at 'localhost:$HGPORT1': $EADDRINUSE$ | |
22 | [255] |
|
22 | [255] | |
23 |
|
23 | |||
24 | $ cd .. |
|
24 | $ cd .. | |
25 | $ cat hg1.pid hg2.pid >> $DAEMON_PIDS |
|
25 | $ cat hg1.pid hg2.pid >> $DAEMON_PIDS | |
26 |
|
26 | |||
27 | clone via stream |
|
27 | clone via stream | |
28 |
|
28 | |||
29 | #if no-reposimplestore |
|
29 | #if no-reposimplestore | |
30 | $ hg clone --stream http://localhost:$HGPORT/ copy 2>&1 |
|
30 | $ hg clone --stream http://localhost:$HGPORT/ copy 2>&1 | |
31 | streaming all changes |
|
31 | streaming all changes | |
32 | 9 files to transfer, 715 bytes of data |
|
32 | 9 files to transfer, 715 bytes of data | |
33 | transferred * bytes in * seconds (*/sec) (glob) |
|
33 | transferred * bytes in * seconds (*/sec) (glob) | |
34 | updating to branch default |
|
34 | updating to branch default | |
35 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
35 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
36 | $ hg verify -R copy |
|
36 | $ hg verify -R copy | |
37 | checking changesets |
|
37 | checking changesets | |
38 | checking manifests |
|
38 | checking manifests | |
39 | crosschecking files in changesets and manifests |
|
39 | crosschecking files in changesets and manifests | |
40 | checking files |
|
40 | checking files | |
41 | checked 1 changesets with 4 changes to 4 files |
|
41 | checked 1 changesets with 4 changes to 4 files | |
42 | #endif |
|
42 | #endif | |
43 |
|
43 | |||
44 | try to clone via stream, should use pull instead |
|
44 | try to clone via stream, should use pull instead | |
45 |
|
45 | |||
46 | $ hg clone --stream http://localhost:$HGPORT1/ copy2 |
|
46 | $ hg clone --stream http://localhost:$HGPORT1/ copy2 | |
47 | warning: stream clone requested but server has them disabled |
|
47 | warning: stream clone requested but server has them disabled | |
48 | requesting all changes |
|
48 | requesting all changes | |
49 | adding changesets |
|
49 | adding changesets | |
50 | adding manifests |
|
50 | adding manifests | |
51 | adding file changes |
|
51 | adding file changes | |
52 | added 1 changesets with 4 changes to 4 files |
|
52 | added 1 changesets with 4 changes to 4 files | |
53 | new changesets 8b6053c928fe |
|
53 | new changesets 8b6053c928fe | |
54 | updating to branch default |
|
54 | updating to branch default | |
55 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
55 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
56 |
|
56 | |||
57 | try to clone via stream but missing requirements, so should use pull instead |
|
57 | try to clone via stream but missing requirements, so should use pull instead | |
58 |
|
58 | |||
59 | $ cat > $TESTTMP/removesupportedformat.py << EOF |
|
59 | $ cat > $TESTTMP/removesupportedformat.py << EOF | |
60 | > from mercurial import localrepo |
|
60 | > from mercurial import localrepo | |
61 | > def extsetup(ui): |
|
61 | > def extsetup(ui): | |
62 | > localrepo.localrepository.supportedformats.remove(b'generaldelta') |
|
62 | > localrepo.localrepository.supportedformats.remove(b'generaldelta') | |
63 | > EOF |
|
63 | > EOF | |
64 |
|
64 | |||
65 | $ hg clone --config extensions.rsf=$TESTTMP/removesupportedformat.py --stream http://localhost:$HGPORT/ copy3 |
|
65 | $ hg clone --config extensions.rsf=$TESTTMP/removesupportedformat.py --stream http://localhost:$HGPORT/ copy3 | |
66 | warning: stream clone requested but client is missing requirements: generaldelta |
|
66 | warning: stream clone requested but client is missing requirements: generaldelta | |
67 | (see https://www.mercurial-scm.org/wiki/MissingRequirement for more information) |
|
67 | (see https://www.mercurial-scm.org/wiki/MissingRequirement for more information) | |
68 | requesting all changes |
|
68 | requesting all changes | |
69 | adding changesets |
|
69 | adding changesets | |
70 | adding manifests |
|
70 | adding manifests | |
71 | adding file changes |
|
71 | adding file changes | |
72 | added 1 changesets with 4 changes to 4 files |
|
72 | added 1 changesets with 4 changes to 4 files | |
73 | new changesets 8b6053c928fe |
|
73 | new changesets 8b6053c928fe | |
74 | updating to branch default |
|
74 | updating to branch default | |
75 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
75 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
76 |
|
76 | |||
77 | clone via pull |
|
77 | clone via pull | |
78 |
|
78 | |||
79 | $ hg clone http://localhost:$HGPORT1/ copy-pull |
|
79 | $ hg clone http://localhost:$HGPORT1/ copy-pull | |
80 | requesting all changes |
|
80 | requesting all changes | |
81 | adding changesets |
|
81 | adding changesets | |
82 | adding manifests |
|
82 | adding manifests | |
83 | adding file changes |
|
83 | adding file changes | |
84 | added 1 changesets with 4 changes to 4 files |
|
84 | added 1 changesets with 4 changes to 4 files | |
85 | new changesets 8b6053c928fe |
|
85 | new changesets 8b6053c928fe | |
86 | updating to branch default |
|
86 | updating to branch default | |
87 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
87 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
88 | $ hg verify -R copy-pull |
|
88 | $ hg verify -R copy-pull | |
89 | checking changesets |
|
89 | checking changesets | |
90 | checking manifests |
|
90 | checking manifests | |
91 | crosschecking files in changesets and manifests |
|
91 | crosschecking files in changesets and manifests | |
92 | checking files |
|
92 | checking files | |
93 | checked 1 changesets with 4 changes to 4 files |
|
93 | checked 1 changesets with 4 changes to 4 files | |
94 | $ cd test |
|
94 | $ cd test | |
95 | $ echo bar > bar |
|
95 | $ echo bar > bar | |
96 | $ hg commit -A -d '1 0' -m 2 |
|
96 | $ hg commit -A -d '1 0' -m 2 | |
97 | adding bar |
|
97 | adding bar | |
98 | $ cd .. |
|
98 | $ cd .. | |
99 |
|
99 | |||
100 | clone over http with --update |
|
100 | clone over http with --update | |
101 |
|
101 | |||
102 | $ hg clone http://localhost:$HGPORT1/ updated --update 0 |
|
102 | $ hg clone http://localhost:$HGPORT1/ updated --update 0 | |
103 | requesting all changes |
|
103 | requesting all changes | |
104 | adding changesets |
|
104 | adding changesets | |
105 | adding manifests |
|
105 | adding manifests | |
106 | adding file changes |
|
106 | adding file changes | |
107 | added 2 changesets with 5 changes to 5 files |
|
107 | added 2 changesets with 5 changes to 5 files | |
108 | new changesets 8b6053c928fe:5fed3813f7f5 |
|
108 | new changesets 8b6053c928fe:5fed3813f7f5 | |
109 | updating to branch default |
|
109 | updating to branch default | |
110 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
110 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
111 | $ hg log -r . -R updated |
|
111 | $ hg log -r . -R updated | |
112 | changeset: 0:8b6053c928fe |
|
112 | changeset: 0:8b6053c928fe | |
113 | user: test |
|
113 | user: test | |
114 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
114 | date: Thu Jan 01 00:00:00 1970 +0000 | |
115 | summary: 1 |
|
115 | summary: 1 | |
116 |
|
116 | |||
117 | $ rm -rf updated |
|
117 | $ rm -rf updated | |
118 |
|
118 | |||
119 | incoming via HTTP |
|
119 | incoming via HTTP | |
120 |
|
120 | |||
121 | $ hg clone http://localhost:$HGPORT1/ --rev 0 partial |
|
121 | $ hg clone http://localhost:$HGPORT1/ --rev 0 partial | |
122 | adding changesets |
|
122 | adding changesets | |
123 | adding manifests |
|
123 | adding manifests | |
124 | adding file changes |
|
124 | adding file changes | |
125 | added 1 changesets with 4 changes to 4 files |
|
125 | added 1 changesets with 4 changes to 4 files | |
126 | new changesets 8b6053c928fe |
|
126 | new changesets 8b6053c928fe | |
127 | updating to branch default |
|
127 | updating to branch default | |
128 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
128 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
129 | $ cd partial |
|
129 | $ cd partial | |
130 | $ touch LOCAL |
|
130 | $ touch LOCAL | |
131 | $ hg ci -qAm LOCAL |
|
131 | $ hg ci -qAm LOCAL | |
132 | $ hg incoming http://localhost:$HGPORT1/ --template '{desc}\n' |
|
132 | $ hg incoming http://localhost:$HGPORT1/ --template '{desc}\n' | |
133 | comparing with http://localhost:$HGPORT1/ |
|
133 | comparing with http://localhost:$HGPORT1/ | |
134 | searching for changes |
|
134 | searching for changes | |
135 | 2 |
|
135 | 2 | |
136 | $ cd .. |
|
136 | $ cd .. | |
137 |
|
137 | |||
138 | pull |
|
138 | pull | |
139 |
|
139 | |||
140 | $ cd copy-pull |
|
140 | $ cd copy-pull | |
141 | $ cat >> .hg/hgrc <<EOF |
|
141 | $ cat >> .hg/hgrc <<EOF | |
142 | > [hooks] |
|
142 | > [hooks] | |
143 | > changegroup = sh -c "printenv.py --line changegroup" |
|
143 | > changegroup = sh -c "printenv.py --line changegroup" | |
144 | > EOF |
|
144 | > EOF | |
145 | $ hg pull |
|
145 | $ hg pull | |
146 | pulling from http://localhost:$HGPORT1/ |
|
146 | pulling from http://localhost:$HGPORT1/ | |
147 | searching for changes |
|
147 | searching for changes | |
148 | adding changesets |
|
148 | adding changesets | |
149 | adding manifests |
|
149 | adding manifests | |
150 | adding file changes |
|
150 | adding file changes | |
151 | added 1 changesets with 1 changes to 1 files |
|
151 | added 1 changesets with 1 changes to 1 files | |
152 | new changesets 5fed3813f7f5 |
|
152 | new changesets 5fed3813f7f5 | |
153 | changegroup hook: HG_HOOKNAME=changegroup |
|
153 | changegroup hook: HG_HOOKNAME=changegroup | |
154 | HG_HOOKTYPE=changegroup |
|
154 | HG_HOOKTYPE=changegroup | |
155 | HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d |
|
155 | HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d | |
156 | HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d |
|
156 | HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d | |
157 | HG_SOURCE=pull |
|
157 | HG_SOURCE=pull | |
158 | HG_TXNID=TXN:$ID$ |
|
158 | HG_TXNID=TXN:$ID$ | |
159 | HG_URL=http://localhost:$HGPORT1/ |
|
159 | HG_URL=http://localhost:$HGPORT1/ | |
160 |
|
160 | |||
161 | (run 'hg update' to get a working copy) |
|
161 | (run 'hg update' to get a working copy) | |
162 | $ cd .. |
|
162 | $ cd .. | |
163 |
|
163 | |||
164 | clone from invalid URL |
|
164 | clone from invalid URL | |
165 |
|
165 | |||
166 | $ hg clone http://localhost:$HGPORT/bad |
|
166 | $ hg clone http://localhost:$HGPORT/bad | |
167 | abort: HTTP Error 404: Not Found |
|
167 | abort: HTTP Error 404: Not Found | |
168 | [255] |
|
168 | [255] | |
169 |
|
169 | |||
170 | test http authentication |
|
170 | test http authentication | |
171 | + use the same server to test server side streaming preference |
|
171 | + use the same server to test server side streaming preference | |
172 |
|
172 | |||
173 | $ cd test |
|
173 | $ cd test | |
174 |
|
174 | |||
175 | $ hg serve --config extensions.x=$TESTDIR/httpserverauth.py -p $HGPORT2 -d \ |
|
175 | $ hg serve --config extensions.x=$TESTDIR/httpserverauth.py -p $HGPORT2 -d \ | |
176 | > --pid-file=pid --config server.preferuncompressed=True \ |
|
176 | > --pid-file=pid --config server.preferuncompressed=True -E ../errors2.log \ | |
177 | > --config web.push_ssl=False --config web.allow_push=* -A ../access.log |
|
177 | > --config web.push_ssl=False --config web.allow_push=* -A ../access.log | |
178 | $ cat pid >> $DAEMON_PIDS |
|
178 | $ cat pid >> $DAEMON_PIDS | |
179 |
|
179 | |||
180 | $ cat << EOF > get_pass.py |
|
180 | $ cat << EOF > get_pass.py | |
181 | > import getpass |
|
181 | > import getpass | |
182 | > def newgetpass(arg): |
|
182 | > def newgetpass(arg): | |
183 | > return "pass" |
|
183 | > return "pass" | |
184 | > getpass.getpass = newgetpass |
|
184 | > getpass.getpass = newgetpass | |
185 | > EOF |
|
185 | > EOF | |
186 |
|
186 | |||
187 | $ hg id http://localhost:$HGPORT2/ |
|
187 | $ hg id http://localhost:$HGPORT2/ | |
188 | abort: http authorization required for http://localhost:$HGPORT2/ |
|
188 | abort: http authorization required for http://localhost:$HGPORT2/ | |
189 | [255] |
|
189 | [255] | |
190 | $ hg id http://localhost:$HGPORT2/ |
|
190 | $ hg id http://localhost:$HGPORT2/ | |
191 | abort: http authorization required for http://localhost:$HGPORT2/ |
|
191 | abort: http authorization required for http://localhost:$HGPORT2/ | |
192 | [255] |
|
192 | [255] | |
193 | $ hg id --config ui.interactive=true --config extensions.getpass=get_pass.py http://user@localhost:$HGPORT2/ |
|
193 | $ hg id --config ui.interactive=true --config extensions.getpass=get_pass.py http://user@localhost:$HGPORT2/ | |
194 | http authorization required for http://localhost:$HGPORT2/ |
|
194 | http authorization required for http://localhost:$HGPORT2/ | |
195 | realm: mercurial |
|
195 | realm: mercurial | |
196 | user: user |
|
196 | user: user | |
197 | password: 5fed3813f7f5 |
|
197 | password: 5fed3813f7f5 | |
198 | $ hg id http://user:pass@localhost:$HGPORT2/ |
|
198 | $ hg id http://user:pass@localhost:$HGPORT2/ | |
199 | 5fed3813f7f5 |
|
199 | 5fed3813f7f5 | |
200 | $ echo '[auth]' >> .hg/hgrc |
|
200 | $ echo '[auth]' >> .hg/hgrc | |
201 | $ echo 'l.schemes=http' >> .hg/hgrc |
|
201 | $ echo 'l.schemes=http' >> .hg/hgrc | |
202 | $ echo 'l.prefix=lo' >> .hg/hgrc |
|
202 | $ echo 'l.prefix=lo' >> .hg/hgrc | |
203 | $ echo 'l.username=user' >> .hg/hgrc |
|
203 | $ echo 'l.username=user' >> .hg/hgrc | |
204 | $ echo 'l.password=pass' >> .hg/hgrc |
|
204 | $ echo 'l.password=pass' >> .hg/hgrc | |
205 | $ hg id http://localhost:$HGPORT2/ |
|
205 | $ hg id http://localhost:$HGPORT2/ | |
206 | 5fed3813f7f5 |
|
206 | 5fed3813f7f5 | |
207 | $ hg id http://localhost:$HGPORT2/ |
|
207 | $ hg id http://localhost:$HGPORT2/ | |
208 | 5fed3813f7f5 |
|
208 | 5fed3813f7f5 | |
209 | $ hg id http://user@localhost:$HGPORT2/ |
|
209 | $ hg id http://user@localhost:$HGPORT2/ | |
210 | 5fed3813f7f5 |
|
210 | 5fed3813f7f5 | |
211 |
|
211 | |||
|
212 | $ cat > use_digests.py << EOF | |||
|
213 | > from mercurial import ( | |||
|
214 | > exthelper, | |||
|
215 | > url, | |||
|
216 | > ) | |||
|
217 | > | |||
|
218 | > eh = exthelper.exthelper() | |||
|
219 | > uisetup = eh.finaluisetup | |||
|
220 | > | |||
|
221 | > @eh.wrapfunction(url, 'opener') | |||
|
222 | > def urlopener(orig, *args, **kwargs): | |||
|
223 | > opener = orig(*args, **kwargs) | |||
|
224 | > opener.addheaders.append((r'X-HgTest-AuthType', r'Digest')) | |||
|
225 | > return opener | |||
|
226 | > EOF | |||
|
227 | ||||
|
228 | $ hg id http://localhost:$HGPORT2/ --config extensions.x=use_digests.py || true | |||
|
229 | abort: HTTP Error 403: bad user (py3 !) | |||
|
230 | 5fed3813f7f5 (no-py3 !) | |||
|
231 | ||||
212 | #if no-reposimplestore |
|
232 | #if no-reposimplestore | |
213 | $ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1 |
|
233 | $ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1 | |
214 | streaming all changes |
|
234 | streaming all changes | |
215 | 10 files to transfer, 1.01 KB of data |
|
235 | 10 files to transfer, 1.01 KB of data | |
216 | transferred * KB in * seconds (*/sec) (glob) |
|
236 | transferred * KB in * seconds (*/sec) (glob) | |
217 | updating to branch default |
|
237 | updating to branch default | |
218 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
238 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
219 | #endif |
|
239 | #endif | |
220 |
|
240 | |||
221 | --pull should override server's preferuncompressed |
|
241 | --pull should override server's preferuncompressed | |
222 | $ hg clone --pull http://user:pass@localhost:$HGPORT2/ dest-pull 2>&1 |
|
242 | $ hg clone --pull http://user:pass@localhost:$HGPORT2/ dest-pull 2>&1 | |
223 | requesting all changes |
|
243 | requesting all changes | |
224 | adding changesets |
|
244 | adding changesets | |
225 | adding manifests |
|
245 | adding manifests | |
226 | adding file changes |
|
246 | adding file changes | |
227 | added 2 changesets with 5 changes to 5 files |
|
247 | added 2 changesets with 5 changes to 5 files | |
228 | new changesets 8b6053c928fe:5fed3813f7f5 |
|
248 | new changesets 8b6053c928fe:5fed3813f7f5 | |
229 | updating to branch default |
|
249 | updating to branch default | |
230 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
250 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
231 |
|
251 | |||
232 | $ hg id http://user2@localhost:$HGPORT2/ |
|
252 | $ hg id http://user2@localhost:$HGPORT2/ | |
233 | abort: http authorization required for http://localhost:$HGPORT2/ |
|
253 | abort: http authorization required for http://localhost:$HGPORT2/ | |
234 | [255] |
|
254 | [255] | |
235 | $ hg id http://user:pass2@localhost:$HGPORT2/ |
|
255 | $ hg id http://user:pass2@localhost:$HGPORT2/ | |
236 | abort: HTTP Error 403: no |
|
256 | abort: HTTP Error 403: no | |
237 | [255] |
|
257 | [255] | |
238 |
|
258 | |||
239 | $ hg -R dest-pull tag -r tip top |
|
259 | $ hg -R dest-pull tag -r tip top | |
240 | $ hg -R dest-pull push http://user:pass@localhost:$HGPORT2/ |
|
260 | $ hg -R dest-pull push http://user:pass@localhost:$HGPORT2/ | |
241 | pushing to http://user:***@localhost:$HGPORT2/ |
|
261 | pushing to http://user:***@localhost:$HGPORT2/ | |
242 | searching for changes |
|
262 | searching for changes | |
243 | remote: adding changesets |
|
263 | remote: adding changesets | |
244 | remote: adding manifests |
|
264 | remote: adding manifests | |
245 | remote: adding file changes |
|
265 | remote: adding file changes | |
246 | remote: added 1 changesets with 1 changes to 1 files |
|
266 | remote: added 1 changesets with 1 changes to 1 files | |
247 | $ hg rollback -q |
|
267 | $ hg rollback -q | |
248 | $ hg -R dest-pull push http://user:pass@localhost:$HGPORT2/ --debug --config devel.debug.peer-request=yes |
|
268 | $ hg -R dest-pull push http://user:pass@localhost:$HGPORT2/ --debug --config devel.debug.peer-request=yes | |
249 | pushing to http://user:***@localhost:$HGPORT2/ |
|
269 | pushing to http://user:***@localhost:$HGPORT2/ | |
250 | using http://localhost:$HGPORT2/ |
|
270 | using http://localhost:$HGPORT2/ | |
251 | http auth: user user, password **** |
|
271 | http auth: user user, password **** | |
252 | sending capabilities command |
|
272 | sending capabilities command | |
253 | devel-peer-request: GET http://localhost:$HGPORT2/?cmd=capabilities |
|
273 | devel-peer-request: GET http://localhost:$HGPORT2/?cmd=capabilities | |
254 | http auth: user user, password **** |
|
274 | http auth: user user, password **** | |
255 | devel-peer-request: finished in *.???? seconds (200) (glob) |
|
275 | devel-peer-request: finished in *.???? seconds (200) (glob) | |
256 | query 1; heads |
|
276 | query 1; heads | |
257 | devel-peer-request: batched-content |
|
277 | devel-peer-request: batched-content | |
258 | devel-peer-request: - heads (0 arguments) |
|
278 | devel-peer-request: - heads (0 arguments) | |
259 | devel-peer-request: - known (1 arguments) |
|
279 | devel-peer-request: - known (1 arguments) | |
260 | sending batch command |
|
280 | sending batch command | |
261 | devel-peer-request: GET http://localhost:$HGPORT2/?cmd=batch |
|
281 | devel-peer-request: GET http://localhost:$HGPORT2/?cmd=batch | |
262 | devel-peer-request: Vary X-HgArg-1,X-HgProto-1 |
|
282 | devel-peer-request: Vary X-HgArg-1,X-HgProto-1 | |
263 | devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
283 | devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
264 | devel-peer-request: 68 bytes of commands arguments in headers |
|
284 | devel-peer-request: 68 bytes of commands arguments in headers | |
265 | devel-peer-request: finished in *.???? seconds (200) (glob) |
|
285 | devel-peer-request: finished in *.???? seconds (200) (glob) | |
266 | searching for changes |
|
286 | searching for changes | |
267 | all remote heads known locally |
|
287 | all remote heads known locally | |
268 | preparing listkeys for "phases" |
|
288 | preparing listkeys for "phases" | |
269 | sending listkeys command |
|
289 | sending listkeys command | |
270 | devel-peer-request: GET http://localhost:$HGPORT2/?cmd=listkeys |
|
290 | devel-peer-request: GET http://localhost:$HGPORT2/?cmd=listkeys | |
271 | devel-peer-request: Vary X-HgArg-1,X-HgProto-1 |
|
291 | devel-peer-request: Vary X-HgArg-1,X-HgProto-1 | |
272 | devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
292 | devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
273 | devel-peer-request: 16 bytes of commands arguments in headers |
|
293 | devel-peer-request: 16 bytes of commands arguments in headers | |
274 | devel-peer-request: finished in *.???? seconds (200) (glob) |
|
294 | devel-peer-request: finished in *.???? seconds (200) (glob) | |
275 | received listkey for "phases": 58 bytes |
|
295 | received listkey for "phases": 58 bytes | |
276 | checking for updated bookmarks |
|
296 | checking for updated bookmarks | |
277 | preparing listkeys for "bookmarks" |
|
297 | preparing listkeys for "bookmarks" | |
278 | sending listkeys command |
|
298 | sending listkeys command | |
279 | devel-peer-request: GET http://localhost:$HGPORT2/?cmd=listkeys |
|
299 | devel-peer-request: GET http://localhost:$HGPORT2/?cmd=listkeys | |
280 | devel-peer-request: Vary X-HgArg-1,X-HgProto-1 |
|
300 | devel-peer-request: Vary X-HgArg-1,X-HgProto-1 | |
281 | devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
301 | devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
282 | devel-peer-request: 19 bytes of commands arguments in headers |
|
302 | devel-peer-request: 19 bytes of commands arguments in headers | |
283 | devel-peer-request: finished in *.???? seconds (200) (glob) |
|
303 | devel-peer-request: finished in *.???? seconds (200) (glob) | |
284 | received listkey for "bookmarks": 0 bytes |
|
304 | received listkey for "bookmarks": 0 bytes | |
285 | sending branchmap command |
|
305 | sending branchmap command | |
286 | devel-peer-request: GET http://localhost:$HGPORT2/?cmd=branchmap |
|
306 | devel-peer-request: GET http://localhost:$HGPORT2/?cmd=branchmap | |
287 | devel-peer-request: Vary X-HgProto-1 |
|
307 | devel-peer-request: Vary X-HgProto-1 | |
288 | devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
308 | devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
289 | devel-peer-request: finished in *.???? seconds (200) (glob) |
|
309 | devel-peer-request: finished in *.???? seconds (200) (glob) | |
290 | preparing listkeys for "bookmarks" |
|
310 | preparing listkeys for "bookmarks" | |
291 | sending listkeys command |
|
311 | sending listkeys command | |
292 | devel-peer-request: GET http://localhost:$HGPORT2/?cmd=listkeys |
|
312 | devel-peer-request: GET http://localhost:$HGPORT2/?cmd=listkeys | |
293 | devel-peer-request: Vary X-HgArg-1,X-HgProto-1 |
|
313 | devel-peer-request: Vary X-HgArg-1,X-HgProto-1 | |
294 | devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
314 | devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
295 | devel-peer-request: 19 bytes of commands arguments in headers |
|
315 | devel-peer-request: 19 bytes of commands arguments in headers | |
296 | devel-peer-request: finished in *.???? seconds (200) (glob) |
|
316 | devel-peer-request: finished in *.???? seconds (200) (glob) | |
297 | received listkey for "bookmarks": 0 bytes |
|
317 | received listkey for "bookmarks": 0 bytes | |
298 | 1 changesets found |
|
318 | 1 changesets found | |
299 | list of changesets: |
|
319 | list of changesets: | |
300 | 7f4e523d01f2cc3765ac8934da3d14db775ff872 |
|
320 | 7f4e523d01f2cc3765ac8934da3d14db775ff872 | |
301 | bundle2-output-bundle: "HG20", 5 parts total |
|
321 | bundle2-output-bundle: "HG20", 5 parts total | |
302 | bundle2-output-part: "replycaps" 205 bytes payload |
|
322 | bundle2-output-part: "replycaps" 205 bytes payload | |
303 | bundle2-output-part: "check:phases" 24 bytes payload |
|
323 | bundle2-output-part: "check:phases" 24 bytes payload | |
304 | bundle2-output-part: "check:heads" streamed payload |
|
324 | bundle2-output-part: "check:heads" streamed payload | |
305 | bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload |
|
325 | bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload | |
306 | bundle2-output-part: "phase-heads" 24 bytes payload |
|
326 | bundle2-output-part: "phase-heads" 24 bytes payload | |
307 | sending unbundle command |
|
327 | sending unbundle command | |
308 | sending 1013 bytes |
|
328 | sending 1013 bytes | |
309 | devel-peer-request: POST http://localhost:$HGPORT2/?cmd=unbundle |
|
329 | devel-peer-request: POST http://localhost:$HGPORT2/?cmd=unbundle | |
310 | devel-peer-request: Content-length 1013 |
|
330 | devel-peer-request: Content-length 1013 | |
311 | devel-peer-request: Content-type application/mercurial-0.1 |
|
331 | devel-peer-request: Content-type application/mercurial-0.1 | |
312 | devel-peer-request: Vary X-HgArg-1,X-HgProto-1 |
|
332 | devel-peer-request: Vary X-HgArg-1,X-HgProto-1 | |
313 | devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
333 | devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
314 | devel-peer-request: 16 bytes of commands arguments in headers |
|
334 | devel-peer-request: 16 bytes of commands arguments in headers | |
315 | devel-peer-request: 1013 bytes of data |
|
335 | devel-peer-request: 1013 bytes of data | |
316 | devel-peer-request: finished in *.???? seconds (200) (glob) |
|
336 | devel-peer-request: finished in *.???? seconds (200) (glob) | |
317 | bundle2-input-bundle: no-transaction |
|
337 | bundle2-input-bundle: no-transaction | |
318 | bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) supported |
|
338 | bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) supported | |
319 | bundle2-input-part: "output" (advisory) (params: 0 advisory) supported |
|
339 | bundle2-input-part: "output" (advisory) (params: 0 advisory) supported | |
320 | bundle2-input-part: total payload size 100 |
|
340 | bundle2-input-part: total payload size 100 | |
321 | remote: adding changesets |
|
341 | remote: adding changesets | |
322 | remote: adding manifests |
|
342 | remote: adding manifests | |
323 | remote: adding file changes |
|
343 | remote: adding file changes | |
324 | remote: added 1 changesets with 1 changes to 1 files |
|
344 | remote: added 1 changesets with 1 changes to 1 files | |
325 | bundle2-input-part: "output" (advisory) supported |
|
345 | bundle2-input-part: "output" (advisory) supported | |
326 | bundle2-input-bundle: 2 parts total |
|
346 | bundle2-input-bundle: 2 parts total | |
327 | preparing listkeys for "phases" |
|
347 | preparing listkeys for "phases" | |
328 | sending listkeys command |
|
348 | sending listkeys command | |
329 | devel-peer-request: GET http://localhost:$HGPORT2/?cmd=listkeys |
|
349 | devel-peer-request: GET http://localhost:$HGPORT2/?cmd=listkeys | |
330 | devel-peer-request: Vary X-HgArg-1,X-HgProto-1 |
|
350 | devel-peer-request: Vary X-HgArg-1,X-HgProto-1 | |
331 | devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
351 | devel-peer-request: X-hgproto-1 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
332 | devel-peer-request: 16 bytes of commands arguments in headers |
|
352 | devel-peer-request: 16 bytes of commands arguments in headers | |
333 | devel-peer-request: finished in *.???? seconds (200) (glob) |
|
353 | devel-peer-request: finished in *.???? seconds (200) (glob) | |
334 | received listkey for "phases": 15 bytes |
|
354 | received listkey for "phases": 15 bytes | |
335 | $ hg rollback -q |
|
355 | $ hg rollback -q | |
336 |
|
356 | |||
337 | $ sed 's/.*] "/"/' < ../access.log |
|
357 | $ sed 's/.*] "/"/' < ../access.log | |
338 | "GET /?cmd=capabilities HTTP/1.1" 401 - |
|
358 | "GET /?cmd=capabilities HTTP/1.1" 401 - | |
339 | "GET /?cmd=capabilities HTTP/1.1" 401 - |
|
359 | "GET /?cmd=capabilities HTTP/1.1" 401 - | |
340 | "GET /?cmd=capabilities HTTP/1.1" 401 - |
|
360 | "GET /?cmd=capabilities HTTP/1.1" 401 - | |
341 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
361 | "GET /?cmd=capabilities HTTP/1.1" 200 - | |
342 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
362 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
343 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
363 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
344 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
364 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
345 | "GET /?cmd=capabilities HTTP/1.1" 401 - |
|
365 | "GET /?cmd=capabilities HTTP/1.1" 401 - | |
346 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
366 | "GET /?cmd=capabilities HTTP/1.1" 200 - | |
347 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
367 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
348 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
368 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
349 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
369 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
350 | "GET /?cmd=capabilities HTTP/1.1" 401 - |
|
370 | "GET /?cmd=capabilities HTTP/1.1" 401 - | |
351 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
371 | "GET /?cmd=capabilities HTTP/1.1" 200 - | |
352 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
372 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
353 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
373 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
354 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
374 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
355 | "GET /?cmd=capabilities HTTP/1.1" 401 - |
|
375 | "GET /?cmd=capabilities HTTP/1.1" 401 - | |
356 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
376 | "GET /?cmd=capabilities HTTP/1.1" 200 - | |
357 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
377 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
358 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
378 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
359 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
379 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
360 | "GET /?cmd=capabilities HTTP/1.1" 401 - |
|
380 | "GET /?cmd=capabilities HTTP/1.1" 401 - | |
361 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
381 | "GET /?cmd=capabilities HTTP/1.1" 200 - | |
362 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
382 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
363 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
383 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
364 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
384 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
|
385 | "GET /?cmd=capabilities HTTP/1.1" 401 - x-hgtest-authtype:Digest | |||
|
386 | "GET /?cmd=capabilities HTTP/1.1" 403 - x-hgtest-authtype:Digest (py3 !) | |||
|
387 | "GET /?cmd=capabilities HTTP/1.1" 200 - x-hgtest-authtype:Digest (no-py3 !) | |||
|
388 | "GET /?cmd=lookup HTTP/1.1" 401 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest (no-py3 !) | |||
|
389 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest (no-py3 !) | |||
|
390 | "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest (no-py3 !) | |||
|
391 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest (no-py3 !) | |||
|
392 | "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest (no-py3 !) | |||
|
393 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull x-hgtest-authtype:Digest (no-py3 !) | |||
365 | "GET /?cmd=capabilities HTTP/1.1" 401 - (no-reposimplestore !) |
|
394 | "GET /?cmd=capabilities HTTP/1.1" 401 - (no-reposimplestore !) | |
366 | "GET /?cmd=capabilities HTTP/1.1" 200 - (no-reposimplestore !) |
|
395 | "GET /?cmd=capabilities HTTP/1.1" 200 - (no-reposimplestore !) | |
367 | "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (no-reposimplestore !) |
|
396 | "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (no-reposimplestore !) | |
368 | "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=0&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&stream=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (no-reposimplestore !) |
|
397 | "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=0&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&stream=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (no-reposimplestore !) | |
369 | "GET /?cmd=capabilities HTTP/1.1" 401 - (no-reposimplestore !) |
|
398 | "GET /?cmd=capabilities HTTP/1.1" 401 - (no-reposimplestore !) | |
370 | "GET /?cmd=capabilities HTTP/1.1" 200 - (no-reposimplestore !) |
|
399 | "GET /?cmd=capabilities HTTP/1.1" 200 - (no-reposimplestore !) | |
371 | "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
400 | "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
372 | "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
401 | "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
373 | "GET /?cmd=capabilities HTTP/1.1" 401 - |
|
402 | "GET /?cmd=capabilities HTTP/1.1" 401 - | |
374 | "GET /?cmd=capabilities HTTP/1.1" 401 - |
|
403 | "GET /?cmd=capabilities HTTP/1.1" 401 - | |
375 | "GET /?cmd=capabilities HTTP/1.1" 403 - |
|
404 | "GET /?cmd=capabilities HTTP/1.1" 403 - | |
376 | "GET /?cmd=capabilities HTTP/1.1" 401 - |
|
405 | "GET /?cmd=capabilities HTTP/1.1" 401 - | |
377 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
406 | "GET /?cmd=capabilities HTTP/1.1" 200 - | |
378 | "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D7f4e523d01f2cc3765ac8934da3d14db775ff872 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
407 | "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D7f4e523d01f2cc3765ac8934da3d14db775ff872 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
379 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
408 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
380 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
409 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
381 | "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
410 | "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
382 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
411 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
383 | "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=666f726365* (glob) |
|
412 | "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=666f726365* (glob) | |
384 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
413 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
385 | "GET /?cmd=capabilities HTTP/1.1" 401 - |
|
414 | "GET /?cmd=capabilities HTTP/1.1" 401 - | |
386 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
415 | "GET /?cmd=capabilities HTTP/1.1" 200 - | |
387 | "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D7f4e523d01f2cc3765ac8934da3d14db775ff872 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
416 | "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D7f4e523d01f2cc3765ac8934da3d14db775ff872 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
388 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
417 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
389 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
418 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
390 | "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
419 | "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
391 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
420 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
392 | "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=666f726365 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
421 | "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=666f726365 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
393 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull |
|
422 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull | |
394 |
|
423 | |||
395 | $ cd .. |
|
424 | $ cd .. | |
396 |
|
425 | |||
397 | clone of serve with repo in root and unserved subrepo (issue2970) |
|
426 | clone of serve with repo in root and unserved subrepo (issue2970) | |
398 |
|
427 | |||
399 | $ hg --cwd test init sub |
|
428 | $ hg --cwd test init sub | |
400 | $ echo empty > test/sub/empty |
|
429 | $ echo empty > test/sub/empty | |
401 | $ hg --cwd test/sub add empty |
|
430 | $ hg --cwd test/sub add empty | |
402 | $ hg --cwd test/sub commit -qm 'add empty' |
|
431 | $ hg --cwd test/sub commit -qm 'add empty' | |
403 | $ hg --cwd test/sub tag -r 0 something |
|
432 | $ hg --cwd test/sub tag -r 0 something | |
404 | $ echo sub = sub > test/.hgsub |
|
433 | $ echo sub = sub > test/.hgsub | |
405 | $ hg --cwd test add .hgsub |
|
434 | $ hg --cwd test add .hgsub | |
406 | $ hg --cwd test commit -qm 'add subrepo' |
|
435 | $ hg --cwd test commit -qm 'add subrepo' | |
407 | $ hg clone http://localhost:$HGPORT noslash-clone |
|
436 | $ hg clone http://localhost:$HGPORT noslash-clone | |
408 | requesting all changes |
|
437 | requesting all changes | |
409 | adding changesets |
|
438 | adding changesets | |
410 | adding manifests |
|
439 | adding manifests | |
411 | adding file changes |
|
440 | adding file changes | |
412 | added 3 changesets with 7 changes to 7 files |
|
441 | added 3 changesets with 7 changes to 7 files | |
413 | new changesets 8b6053c928fe:56f9bc90cce6 |
|
442 | new changesets 8b6053c928fe:56f9bc90cce6 | |
414 | updating to branch default |
|
443 | updating to branch default | |
415 | cloning subrepo sub from http://localhost:$HGPORT/sub |
|
444 | cloning subrepo sub from http://localhost:$HGPORT/sub | |
416 | abort: HTTP Error 404: Not Found |
|
445 | abort: HTTP Error 404: Not Found | |
417 | [255] |
|
446 | [255] | |
418 | $ hg clone http://localhost:$HGPORT/ slash-clone |
|
447 | $ hg clone http://localhost:$HGPORT/ slash-clone | |
419 | requesting all changes |
|
448 | requesting all changes | |
420 | adding changesets |
|
449 | adding changesets | |
421 | adding manifests |
|
450 | adding manifests | |
422 | adding file changes |
|
451 | adding file changes | |
423 | added 3 changesets with 7 changes to 7 files |
|
452 | added 3 changesets with 7 changes to 7 files | |
424 | new changesets 8b6053c928fe:56f9bc90cce6 |
|
453 | new changesets 8b6053c928fe:56f9bc90cce6 | |
425 | updating to branch default |
|
454 | updating to branch default | |
426 | cloning subrepo sub from http://localhost:$HGPORT/sub |
|
455 | cloning subrepo sub from http://localhost:$HGPORT/sub | |
427 | abort: HTTP Error 404: Not Found |
|
456 | abort: HTTP Error 404: Not Found | |
428 | [255] |
|
457 | [255] | |
429 |
|
458 | |||
430 | check error log |
|
459 | check error log | |
431 |
|
460 | |||
432 | $ cat error.log |
|
461 | $ cat error.log | |
433 |
|
462 | |||
|
463 | $ cat errors2.log | |||
|
464 | $LOCALIP - - [$ERRDATE$] HG error: No hash found for user/realm "b'user'/mercurial" (glob) (py3 !) | |||
|
465 | ||||
434 | check abort error reporting while pulling/cloning |
|
466 | check abort error reporting while pulling/cloning | |
435 |
|
467 | |||
436 | $ $RUNTESTDIR/killdaemons.py |
|
468 | $ $RUNTESTDIR/killdaemons.py | |
437 | $ hg serve -R test -p $HGPORT -d --pid-file=hg3.pid -E error.log --config extensions.crash=${TESTDIR}/crashgetbundler.py |
|
469 | $ hg serve -R test -p $HGPORT -d --pid-file=hg3.pid -E error.log --config extensions.crash=${TESTDIR}/crashgetbundler.py | |
438 | $ cat hg3.pid >> $DAEMON_PIDS |
|
470 | $ cat hg3.pid >> $DAEMON_PIDS | |
439 | $ hg clone http://localhost:$HGPORT/ abort-clone |
|
471 | $ hg clone http://localhost:$HGPORT/ abort-clone | |
440 | requesting all changes |
|
472 | requesting all changes | |
441 | remote: abort: this is an exercise |
|
473 | remote: abort: this is an exercise | |
442 | abort: pull failed on remote |
|
474 | abort: pull failed on remote | |
443 | [255] |
|
475 | [255] | |
444 | $ cat error.log |
|
476 | $ cat error.log | |
445 |
|
477 | |||
446 | disable pull-based clones |
|
478 | disable pull-based clones | |
447 |
|
479 | |||
448 | $ hg serve -R test -p $HGPORT1 -d --pid-file=hg4.pid -E error.log --config server.disablefullbundle=True |
|
480 | $ hg serve -R test -p $HGPORT1 -d --pid-file=hg4.pid -E error.log --config server.disablefullbundle=True | |
449 | $ cat hg4.pid >> $DAEMON_PIDS |
|
481 | $ cat hg4.pid >> $DAEMON_PIDS | |
450 | $ hg clone http://localhost:$HGPORT1/ disable-pull-clone |
|
482 | $ hg clone http://localhost:$HGPORT1/ disable-pull-clone | |
451 | requesting all changes |
|
483 | requesting all changes | |
452 | remote: abort: server has pull-based clones disabled |
|
484 | remote: abort: server has pull-based clones disabled | |
453 | abort: pull failed on remote |
|
485 | abort: pull failed on remote | |
454 | (remove --pull if specified or upgrade Mercurial) |
|
486 | (remove --pull if specified or upgrade Mercurial) | |
455 | [255] |
|
487 | [255] | |
456 |
|
488 | |||
457 | #if no-reposimplestore |
|
489 | #if no-reposimplestore | |
458 | ... but keep stream clones working |
|
490 | ... but keep stream clones working | |
459 |
|
491 | |||
460 | $ hg clone --stream --noupdate http://localhost:$HGPORT1/ test-stream-clone |
|
492 | $ hg clone --stream --noupdate http://localhost:$HGPORT1/ test-stream-clone | |
461 | streaming all changes |
|
493 | streaming all changes | |
462 | * files to transfer, * of data (glob) |
|
494 | * files to transfer, * of data (glob) | |
463 | transferred * in * seconds (*/sec) (glob) |
|
495 | transferred * in * seconds (*/sec) (glob) | |
464 | $ cat error.log |
|
496 | $ cat error.log | |
465 | #endif |
|
497 | #endif | |
466 |
|
498 | |||
467 | ... and also keep partial clones and pulls working |
|
499 | ... and also keep partial clones and pulls working | |
468 | $ hg clone http://localhost:$HGPORT1 --rev 0 test/partial/clone |
|
500 | $ hg clone http://localhost:$HGPORT1 --rev 0 test/partial/clone | |
469 | adding changesets |
|
501 | adding changesets | |
470 | adding manifests |
|
502 | adding manifests | |
471 | adding file changes |
|
503 | adding file changes | |
472 | added 1 changesets with 4 changes to 4 files |
|
504 | added 1 changesets with 4 changes to 4 files | |
473 | new changesets 8b6053c928fe |
|
505 | new changesets 8b6053c928fe | |
474 | updating to branch default |
|
506 | updating to branch default | |
475 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
507 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
476 | $ hg pull -R test/partial/clone |
|
508 | $ hg pull -R test/partial/clone | |
477 | pulling from http://localhost:$HGPORT1/ |
|
509 | pulling from http://localhost:$HGPORT1/ | |
478 | searching for changes |
|
510 | searching for changes | |
479 | adding changesets |
|
511 | adding changesets | |
480 | adding manifests |
|
512 | adding manifests | |
481 | adding file changes |
|
513 | adding file changes | |
482 | added 2 changesets with 3 changes to 3 files |
|
514 | added 2 changesets with 3 changes to 3 files | |
483 | new changesets 5fed3813f7f5:56f9bc90cce6 |
|
515 | new changesets 5fed3813f7f5:56f9bc90cce6 | |
484 | (run 'hg update' to get a working copy) |
|
516 | (run 'hg update' to get a working copy) | |
485 |
|
517 | |||
486 | $ hg clone -U -r 0 test/partial/clone test/another/clone |
|
518 | $ hg clone -U -r 0 test/partial/clone test/another/clone | |
487 | adding changesets |
|
519 | adding changesets | |
488 | adding manifests |
|
520 | adding manifests | |
489 | adding file changes |
|
521 | adding file changes | |
490 | added 1 changesets with 4 changes to 4 files |
|
522 | added 1 changesets with 4 changes to 4 files | |
491 | new changesets 8b6053c928fe |
|
523 | new changesets 8b6053c928fe | |
492 |
|
524 | |||
493 | corrupt cookies file should yield a warning |
|
525 | corrupt cookies file should yield a warning | |
494 |
|
526 | |||
495 | $ cat > $TESTTMP/cookies.txt << EOF |
|
527 | $ cat > $TESTTMP/cookies.txt << EOF | |
496 | > bad format |
|
528 | > bad format | |
497 | > EOF |
|
529 | > EOF | |
498 |
|
530 | |||
499 | $ hg --config auth.cookiefile=$TESTTMP/cookies.txt id http://localhost:$HGPORT/ |
|
531 | $ hg --config auth.cookiefile=$TESTTMP/cookies.txt id http://localhost:$HGPORT/ | |
500 | (error loading cookie file $TESTTMP/cookies.txt: '*/cookies.txt' does not look like a Netscape format cookies file; continuing without cookies) (glob) |
|
532 | (error loading cookie file $TESTTMP/cookies.txt: '*/cookies.txt' does not look like a Netscape format cookies file; continuing without cookies) (glob) | |
501 | 56f9bc90cce6 |
|
533 | 56f9bc90cce6 | |
502 |
|
534 | |||
503 | $ killdaemons.py |
|
535 | $ killdaemons.py | |
504 |
|
536 | |||
505 | Create dummy authentication handler that looks for cookies. It doesn't do anything |
|
537 | Create dummy authentication handler that looks for cookies. It doesn't do anything | |
506 | useful. It just raises an HTTP 500 with details about the Cookie request header. |
|
538 | useful. It just raises an HTTP 500 with details about the Cookie request header. | |
507 | We raise HTTP 500 because its message is printed in the abort message. |
|
539 | We raise HTTP 500 because its message is printed in the abort message. | |
508 |
|
540 | |||
509 | $ cat > cookieauth.py << EOF |
|
541 | $ cat > cookieauth.py << EOF | |
510 | > from mercurial import util |
|
542 | > from mercurial import util | |
511 | > from mercurial.hgweb import common |
|
543 | > from mercurial.hgweb import common | |
512 | > def perform_authentication(hgweb, req, op): |
|
544 | > def perform_authentication(hgweb, req, op): | |
513 | > cookie = req.headers.get(b'Cookie') |
|
545 | > cookie = req.headers.get(b'Cookie') | |
514 | > if not cookie: |
|
546 | > if not cookie: | |
515 | > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, b'no-cookie') |
|
547 | > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, b'no-cookie') | |
516 | > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, b'Cookie: %s' % cookie) |
|
548 | > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, b'Cookie: %s' % cookie) | |
517 | > def extsetup(ui): |
|
549 | > def extsetup(ui): | |
518 | > common.permhooks.insert(0, perform_authentication) |
|
550 | > common.permhooks.insert(0, perform_authentication) | |
519 | > EOF |
|
551 | > EOF | |
520 |
|
552 | |||
521 | $ hg serve --config extensions.cookieauth=cookieauth.py -R test -p $HGPORT -d --pid-file=pid |
|
553 | $ hg serve --config extensions.cookieauth=cookieauth.py -R test -p $HGPORT -d --pid-file=pid | |
522 | $ cat pid > $DAEMON_PIDS |
|
554 | $ cat pid > $DAEMON_PIDS | |
523 |
|
555 | |||
524 | Request without cookie sent should fail due to lack of cookie |
|
556 | Request without cookie sent should fail due to lack of cookie | |
525 |
|
557 | |||
526 | $ hg id http://localhost:$HGPORT |
|
558 | $ hg id http://localhost:$HGPORT | |
527 | abort: HTTP Error 500: no-cookie |
|
559 | abort: HTTP Error 500: no-cookie | |
528 | [255] |
|
560 | [255] | |
529 |
|
561 | |||
530 | Populate a cookies file |
|
562 | Populate a cookies file | |
531 |
|
563 | |||
532 | $ cat > cookies.txt << EOF |
|
564 | $ cat > cookies.txt << EOF | |
533 | > # HTTP Cookie File |
|
565 | > # HTTP Cookie File | |
534 | > # Expiration is 2030-01-01 at midnight |
|
566 | > # Expiration is 2030-01-01 at midnight | |
535 | > .example.com TRUE / FALSE 1893456000 hgkey examplevalue |
|
567 | > .example.com TRUE / FALSE 1893456000 hgkey examplevalue | |
536 | > EOF |
|
568 | > EOF | |
537 |
|
569 | |||
538 | Should not send a cookie for another domain |
|
570 | Should not send a cookie for another domain | |
539 |
|
571 | |||
540 | $ hg --config auth.cookiefile=cookies.txt id http://localhost:$HGPORT/ |
|
572 | $ hg --config auth.cookiefile=cookies.txt id http://localhost:$HGPORT/ | |
541 | abort: HTTP Error 500: no-cookie |
|
573 | abort: HTTP Error 500: no-cookie | |
542 | [255] |
|
574 | [255] | |
543 |
|
575 | |||
544 | Add a cookie entry for our test server and verify it is sent |
|
576 | Add a cookie entry for our test server and verify it is sent | |
545 |
|
577 | |||
546 | $ cat >> cookies.txt << EOF |
|
578 | $ cat >> cookies.txt << EOF | |
547 | > localhost.local FALSE / FALSE 1893456000 hgkey localhostvalue |
|
579 | > localhost.local FALSE / FALSE 1893456000 hgkey localhostvalue | |
548 | > EOF |
|
580 | > EOF | |
549 |
|
581 | |||
550 | $ hg --config auth.cookiefile=cookies.txt id http://localhost:$HGPORT/ |
|
582 | $ hg --config auth.cookiefile=cookies.txt id http://localhost:$HGPORT/ | |
551 | abort: HTTP Error 500: Cookie: hgkey=localhostvalue |
|
583 | abort: HTTP Error 500: Cookie: hgkey=localhostvalue | |
552 | [255] |
|
584 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now