##// END OF EJS Templates
tests: add a substitution for EADDRINUSE/WSAEADDRINUSE messages...
Matt Harbison -
r35233:1b22d325 default
parent child Browse files
Show More
@@ -1,67 +1,75 b''
1 # common patterns in test at can safely be replaced
1 # common patterns in test at can safely be replaced
2 from __future__ import absolute_import
2 from __future__ import absolute_import
3
3
4 substitutions = [
4 substitutions = [
5 # list of possible compressions
5 # list of possible compressions
6 (br'zstd,zlib,none,bzip2',
6 (br'zstd,zlib,none,bzip2',
7 br'$USUAL_COMPRESSIONS$'
7 br'$USUAL_COMPRESSIONS$'
8 ),
8 ),
9 # capabilities sent through http
9 # capabilities sent through http
10 (br'bundlecaps=HG20%2Cbundle2%3DHG20%250A'
10 (br'bundlecaps=HG20%2Cbundle2%3DHG20%250A'
11 br'changegroup%253D01%252C02%250A'
11 br'changegroup%253D01%252C02%250A'
12 br'digests%253Dmd5%252Csha1%252Csha512%250A'
12 br'digests%253Dmd5%252Csha1%252Csha512%250A'
13 br'error%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250A'
13 br'error%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250A'
14 br'hgtagsfnodes%250A'
14 br'hgtagsfnodes%250A'
15 br'listkeys%250A'
15 br'listkeys%250A'
16 br'phases%253Dheads%250A'
16 br'phases%253Dheads%250A'
17 br'pushkey%250A'
17 br'pushkey%250A'
18 br'remote-changegroup%253Dhttp%252Chttps',
18 br'remote-changegroup%253Dhttp%252Chttps',
19 # (the replacement patterns)
19 # (the replacement patterns)
20 br'$USUAL_BUNDLE_CAPS$'
20 br'$USUAL_BUNDLE_CAPS$'
21 ),
21 ),
22 # bundle2 capabilities sent through ssh
22 # bundle2 capabilities sent through ssh
23 (br'bundle2=HG20%0A'
23 (br'bundle2=HG20%0A'
24 br'changegroup%3D01%2C02%0A'
24 br'changegroup%3D01%2C02%0A'
25 br'digests%3Dmd5%2Csha1%2Csha512%0A'
25 br'digests%3Dmd5%2Csha1%2Csha512%0A'
26 br'error%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0A'
26 br'error%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0A'
27 br'hgtagsfnodes%0A'
27 br'hgtagsfnodes%0A'
28 br'listkeys%0A'
28 br'listkeys%0A'
29 br'phases%3Dheads%0A'
29 br'phases%3Dheads%0A'
30 br'pushkey%0A'
30 br'pushkey%0A'
31 br'remote-changegroup%3Dhttp%2Chttps',
31 br'remote-changegroup%3Dhttp%2Chttps',
32 # (replacement patterns)
32 # (replacement patterns)
33 br'$USUAL_BUNDLE2_CAPS$'
33 br'$USUAL_BUNDLE2_CAPS$'
34 ),
34 ),
35 # HTTP log dates
35 # HTTP log dates
36 (br' - - \[\d\d/.../2\d\d\d \d\d:\d\d:\d\d] "GET',
36 (br' - - \[\d\d/.../2\d\d\d \d\d:\d\d:\d\d] "GET',
37 br' - - [$LOGDATE$] "GET'
37 br' - - [$LOGDATE$] "GET'
38 ),
38 ),
39 ]
39 ]
40
40
41 # Various platform error strings, keyed on a common replacement string
41 # Various platform error strings, keyed on a common replacement string
42 _errors = {
42 _errors = {
43 br'$ENOENT$': (
43 br'$ENOENT$': (
44 # strerror()
44 # strerror()
45 br'No such file or directory',
45 br'No such file or directory',
46
46
47 # FormatMessage(ERROR_FILE_NOT_FOUND)
47 # FormatMessage(ERROR_FILE_NOT_FOUND)
48 br'The system cannot find the file specified',
48 br'The system cannot find the file specified',
49 ),
49 ),
50 br'$ENOTDIR$': (
50 br'$ENOTDIR$': (
51 # strerror()
51 # strerror()
52 br'Not a directory',
52 br'Not a directory',
53
53
54 # FormatMessage(ERROR_PATH_NOT_FOUND)
54 # FormatMessage(ERROR_PATH_NOT_FOUND)
55 br'The system cannot find the path specified',
55 br'The system cannot find the path specified',
56 ),
56 ),
57 br'$ECONNRESET$': (
57 br'$ECONNRESET$': (
58 # strerror()
58 # strerror()
59 br'Connection reset by peer',
59 br'Connection reset by peer',
60
60
61 # FormatMessage(WSAECONNRESET)
61 # FormatMessage(WSAECONNRESET)
62 br'An existing connection was forcibly closed by the remote host',
62 br'An existing connection was forcibly closed by the remote host',
63 ),
63 ),
64 br'$EADDRINUSE$': (
65 # strerror()
66 br'Address already in use',
67
68 # FormatMessage(WSAEADDRINUSE)
69 br'Only one usage of each socket address'
70 br' \(protocol/network address/port\) is normally permitted',
71 ),
64 }
72 }
65
73
66 for replace, msgs in _errors.items():
74 for replace, msgs in _errors.items():
67 substitutions.extend((m, replace) for m in msgs)
75 substitutions.extend((m, replace) for m in msgs)
@@ -1,416 +1,411 b''
1 #require serve
1 #require serve
2
2
3 This test is a duplicate of 'test-http.t', feel free to factor out
3 This test is a duplicate of 'test-http.t', feel free to factor out
4 parts that are not bundle1/bundle2 specific.
4 parts that are not bundle1/bundle2 specific.
5
5
6 $ cat << EOF >> $HGRCPATH
6 $ cat << EOF >> $HGRCPATH
7 > [devel]
7 > [devel]
8 > # This test is dedicated to interaction through old bundle
8 > # This test is dedicated to interaction through old bundle
9 > legacy.exchange = bundle1
9 > legacy.exchange = bundle1
10 > EOF
10 > EOF
11
11
12 $ hg init test
12 $ hg init test
13 $ cd test
13 $ cd test
14 $ echo foo>foo
14 $ echo foo>foo
15 $ mkdir foo.d foo.d/bAr.hg.d foo.d/baR.d.hg
15 $ mkdir foo.d foo.d/bAr.hg.d foo.d/baR.d.hg
16 $ echo foo>foo.d/foo
16 $ echo foo>foo.d/foo
17 $ echo bar>foo.d/bAr.hg.d/BaR
17 $ echo bar>foo.d/bAr.hg.d/BaR
18 $ echo bar>foo.d/baR.d.hg/bAR
18 $ echo bar>foo.d/baR.d.hg/bAR
19 $ hg commit -A -m 1
19 $ hg commit -A -m 1
20 adding foo
20 adding foo
21 adding foo.d/bAr.hg.d/BaR
21 adding foo.d/bAr.hg.d/BaR
22 adding foo.d/baR.d.hg/bAR
22 adding foo.d/baR.d.hg/bAR
23 adding foo.d/foo
23 adding foo.d/foo
24 $ hg serve -p $HGPORT -d --pid-file=../hg1.pid -E ../error.log
24 $ hg serve -p $HGPORT -d --pid-file=../hg1.pid -E ../error.log
25 $ hg serve --config server.uncompressed=False -p $HGPORT1 -d --pid-file=../hg2.pid
25 $ hg serve --config server.uncompressed=False -p $HGPORT1 -d --pid-file=../hg2.pid
26
26
27 Test server address cannot be reused
27 Test server address cannot be reused
28
28
29 #if windows
30 $ hg serve -p $HGPORT1 2>&1
29 $ hg serve -p $HGPORT1 2>&1
31 abort: cannot start server at 'localhost:$HGPORT1': * (glob)
30 abort: cannot start server at 'localhost:$HGPORT1': $EADDRINUSE$
32 [255]
31 [255]
33 #else
32
34 $ hg serve -p $HGPORT1 2>&1
35 abort: cannot start server at 'localhost:$HGPORT1': Address already in use
36 [255]
37 #endif
38 $ cd ..
33 $ cd ..
39 $ cat hg1.pid hg2.pid >> $DAEMON_PIDS
34 $ cat hg1.pid hg2.pid >> $DAEMON_PIDS
40
35
41 clone via stream
36 clone via stream
42
37
43 $ hg clone --stream http://localhost:$HGPORT/ copy 2>&1
38 $ hg clone --stream http://localhost:$HGPORT/ copy 2>&1
44 streaming all changes
39 streaming all changes
45 6 files to transfer, 606 bytes of data
40 6 files to transfer, 606 bytes of data
46 transferred * bytes in * seconds (*/sec) (glob)
41 transferred * bytes in * seconds (*/sec) (glob)
47 searching for changes
42 searching for changes
48 no changes found
43 no changes found
49 updating to branch default
44 updating to branch default
50 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
45 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
51 $ hg verify -R copy
46 $ hg verify -R copy
52 checking changesets
47 checking changesets
53 checking manifests
48 checking manifests
54 crosschecking files in changesets and manifests
49 crosschecking files in changesets and manifests
55 checking files
50 checking files
56 4 files, 1 changesets, 4 total revisions
51 4 files, 1 changesets, 4 total revisions
57
52
58 try to clone via stream, should use pull instead
53 try to clone via stream, should use pull instead
59
54
60 $ hg clone --stream http://localhost:$HGPORT1/ copy2
55 $ hg clone --stream http://localhost:$HGPORT1/ copy2
61 warning: stream clone requested but server has them disabled
56 warning: stream clone requested but server has them disabled
62 requesting all changes
57 requesting all changes
63 adding changesets
58 adding changesets
64 adding manifests
59 adding manifests
65 adding file changes
60 adding file changes
66 added 1 changesets with 4 changes to 4 files
61 added 1 changesets with 4 changes to 4 files
67 new changesets 8b6053c928fe
62 new changesets 8b6053c928fe
68 updating to branch default
63 updating to branch default
69 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
64 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
70
65
71 try to clone via stream but missing requirements, so should use pull instead
66 try to clone via stream but missing requirements, so should use pull instead
72
67
73 $ cat > $TESTTMP/removesupportedformat.py << EOF
68 $ cat > $TESTTMP/removesupportedformat.py << EOF
74 > from mercurial import localrepo
69 > from mercurial import localrepo
75 > def extsetup(ui):
70 > def extsetup(ui):
76 > localrepo.localrepository.supportedformats.remove('generaldelta')
71 > localrepo.localrepository.supportedformats.remove('generaldelta')
77 > EOF
72 > EOF
78
73
79 $ hg clone --config extensions.rsf=$TESTTMP/removesupportedformat.py --stream http://localhost:$HGPORT/ copy3
74 $ hg clone --config extensions.rsf=$TESTTMP/removesupportedformat.py --stream http://localhost:$HGPORT/ copy3
80 warning: stream clone requested but client is missing requirements: generaldelta
75 warning: stream clone requested but client is missing requirements: generaldelta
81 (see https://www.mercurial-scm.org/wiki/MissingRequirement for more information)
76 (see https://www.mercurial-scm.org/wiki/MissingRequirement for more information)
82 requesting all changes
77 requesting all changes
83 adding changesets
78 adding changesets
84 adding manifests
79 adding manifests
85 adding file changes
80 adding file changes
86 added 1 changesets with 4 changes to 4 files
81 added 1 changesets with 4 changes to 4 files
87 new changesets 8b6053c928fe
82 new changesets 8b6053c928fe
88 updating to branch default
83 updating to branch default
89 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
84 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
90
85
91 clone via pull
86 clone via pull
92
87
93 $ hg clone http://localhost:$HGPORT1/ copy-pull
88 $ hg clone http://localhost:$HGPORT1/ copy-pull
94 requesting all changes
89 requesting all changes
95 adding changesets
90 adding changesets
96 adding manifests
91 adding manifests
97 adding file changes
92 adding file changes
98 added 1 changesets with 4 changes to 4 files
93 added 1 changesets with 4 changes to 4 files
99 new changesets 8b6053c928fe
94 new changesets 8b6053c928fe
100 updating to branch default
95 updating to branch default
101 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
96 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
102 $ hg verify -R copy-pull
97 $ hg verify -R copy-pull
103 checking changesets
98 checking changesets
104 checking manifests
99 checking manifests
105 crosschecking files in changesets and manifests
100 crosschecking files in changesets and manifests
106 checking files
101 checking files
107 4 files, 1 changesets, 4 total revisions
102 4 files, 1 changesets, 4 total revisions
108 $ cd test
103 $ cd test
109 $ echo bar > bar
104 $ echo bar > bar
110 $ hg commit -A -d '1 0' -m 2
105 $ hg commit -A -d '1 0' -m 2
111 adding bar
106 adding bar
112 $ cd ..
107 $ cd ..
113
108
114 clone over http with --update
109 clone over http with --update
115
110
116 $ hg clone http://localhost:$HGPORT1/ updated --update 0
111 $ hg clone http://localhost:$HGPORT1/ updated --update 0
117 requesting all changes
112 requesting all changes
118 adding changesets
113 adding changesets
119 adding manifests
114 adding manifests
120 adding file changes
115 adding file changes
121 added 2 changesets with 5 changes to 5 files
116 added 2 changesets with 5 changes to 5 files
122 new changesets 8b6053c928fe:5fed3813f7f5
117 new changesets 8b6053c928fe:5fed3813f7f5
123 updating to branch default
118 updating to branch default
124 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
119 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
125 $ hg log -r . -R updated
120 $ hg log -r . -R updated
126 changeset: 0:8b6053c928fe
121 changeset: 0:8b6053c928fe
127 user: test
122 user: test
128 date: Thu Jan 01 00:00:00 1970 +0000
123 date: Thu Jan 01 00:00:00 1970 +0000
129 summary: 1
124 summary: 1
130
125
131 $ rm -rf updated
126 $ rm -rf updated
132
127
133 incoming via HTTP
128 incoming via HTTP
134
129
135 $ hg clone http://localhost:$HGPORT1/ --rev 0 partial
130 $ hg clone http://localhost:$HGPORT1/ --rev 0 partial
136 adding changesets
131 adding changesets
137 adding manifests
132 adding manifests
138 adding file changes
133 adding file changes
139 added 1 changesets with 4 changes to 4 files
134 added 1 changesets with 4 changes to 4 files
140 new changesets 8b6053c928fe
135 new changesets 8b6053c928fe
141 updating to branch default
136 updating to branch default
142 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
137 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
143 $ cd partial
138 $ cd partial
144 $ touch LOCAL
139 $ touch LOCAL
145 $ hg ci -qAm LOCAL
140 $ hg ci -qAm LOCAL
146 $ hg incoming http://localhost:$HGPORT1/ --template '{desc}\n'
141 $ hg incoming http://localhost:$HGPORT1/ --template '{desc}\n'
147 comparing with http://localhost:$HGPORT1/
142 comparing with http://localhost:$HGPORT1/
148 searching for changes
143 searching for changes
149 2
144 2
150 $ cd ..
145 $ cd ..
151
146
152 pull
147 pull
153
148
154 $ cd copy-pull
149 $ cd copy-pull
155 $ cat >> .hg/hgrc <<EOF
150 $ cat >> .hg/hgrc <<EOF
156 > [hooks]
151 > [hooks]
157 > changegroup = sh -c "printenv.py changegroup"
152 > changegroup = sh -c "printenv.py changegroup"
158 > EOF
153 > EOF
159 $ hg pull
154 $ hg pull
160 pulling from http://localhost:$HGPORT1/
155 pulling from http://localhost:$HGPORT1/
161 searching for changes
156 searching for changes
162 adding changesets
157 adding changesets
163 adding manifests
158 adding manifests
164 adding file changes
159 adding file changes
165 added 1 changesets with 1 changes to 1 files
160 added 1 changesets with 1 changes to 1 files
166 new changesets 5fed3813f7f5
161 new changesets 5fed3813f7f5
167 changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=http://localhost:$HGPORT1/
162 changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=http://localhost:$HGPORT1/
168 (run 'hg update' to get a working copy)
163 (run 'hg update' to get a working copy)
169 $ cd ..
164 $ cd ..
170
165
171 clone from invalid URL
166 clone from invalid URL
172
167
173 $ hg clone http://localhost:$HGPORT/bad
168 $ hg clone http://localhost:$HGPORT/bad
174 abort: HTTP Error 404: Not Found
169 abort: HTTP Error 404: Not Found
175 [255]
170 [255]
176
171
177 test http authentication
172 test http authentication
178 + use the same server to test server side streaming preference
173 + use the same server to test server side streaming preference
179
174
180 $ cd test
175 $ cd test
181 $ cat << EOT > userpass.py
176 $ cat << EOT > userpass.py
182 > import base64
177 > import base64
183 > from mercurial.hgweb import common
178 > from mercurial.hgweb import common
184 > def perform_authentication(hgweb, req, op):
179 > def perform_authentication(hgweb, req, op):
185 > auth = req.env.get('HTTP_AUTHORIZATION')
180 > auth = req.env.get('HTTP_AUTHORIZATION')
186 > if not auth:
181 > if not auth:
187 > raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, 'who',
182 > raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, 'who',
188 > [('WWW-Authenticate', 'Basic Realm="mercurial"')])
183 > [('WWW-Authenticate', 'Basic Realm="mercurial"')])
189 > if base64.b64decode(auth.split()[1]).split(':', 1) != ['user', 'pass']:
184 > if base64.b64decode(auth.split()[1]).split(':', 1) != ['user', 'pass']:
190 > raise common.ErrorResponse(common.HTTP_FORBIDDEN, 'no')
185 > raise common.ErrorResponse(common.HTTP_FORBIDDEN, 'no')
191 > def extsetup():
186 > def extsetup():
192 > common.permhooks.insert(0, perform_authentication)
187 > common.permhooks.insert(0, perform_authentication)
193 > EOT
188 > EOT
194 $ hg serve --config extensions.x=userpass.py -p $HGPORT2 -d --pid-file=pid \
189 $ hg serve --config extensions.x=userpass.py -p $HGPORT2 -d --pid-file=pid \
195 > --config server.preferuncompressed=True \
190 > --config server.preferuncompressed=True \
196 > --config web.push_ssl=False --config web.allow_push=* -A ../access.log
191 > --config web.push_ssl=False --config web.allow_push=* -A ../access.log
197 $ cat pid >> $DAEMON_PIDS
192 $ cat pid >> $DAEMON_PIDS
198
193
199 $ cat << EOF > get_pass.py
194 $ cat << EOF > get_pass.py
200 > import getpass
195 > import getpass
201 > def newgetpass(arg):
196 > def newgetpass(arg):
202 > return "pass"
197 > return "pass"
203 > getpass.getpass = newgetpass
198 > getpass.getpass = newgetpass
204 > EOF
199 > EOF
205
200
206 $ hg id http://localhost:$HGPORT2/
201 $ hg id http://localhost:$HGPORT2/
207 abort: http authorization required for http://localhost:$HGPORT2/
202 abort: http authorization required for http://localhost:$HGPORT2/
208 [255]
203 [255]
209 $ hg id http://localhost:$HGPORT2/
204 $ hg id http://localhost:$HGPORT2/
210 abort: http authorization required for http://localhost:$HGPORT2/
205 abort: http authorization required for http://localhost:$HGPORT2/
211 [255]
206 [255]
212 $ hg id --config ui.interactive=true --config extensions.getpass=get_pass.py http://user@localhost:$HGPORT2/
207 $ hg id --config ui.interactive=true --config extensions.getpass=get_pass.py http://user@localhost:$HGPORT2/
213 http authorization required for http://localhost:$HGPORT2/
208 http authorization required for http://localhost:$HGPORT2/
214 realm: mercurial
209 realm: mercurial
215 user: user
210 user: user
216 password: 5fed3813f7f5
211 password: 5fed3813f7f5
217 $ hg id http://user:pass@localhost:$HGPORT2/
212 $ hg id http://user:pass@localhost:$HGPORT2/
218 5fed3813f7f5
213 5fed3813f7f5
219 $ echo '[auth]' >> .hg/hgrc
214 $ echo '[auth]' >> .hg/hgrc
220 $ echo 'l.schemes=http' >> .hg/hgrc
215 $ echo 'l.schemes=http' >> .hg/hgrc
221 $ echo 'l.prefix=lo' >> .hg/hgrc
216 $ echo 'l.prefix=lo' >> .hg/hgrc
222 $ echo 'l.username=user' >> .hg/hgrc
217 $ echo 'l.username=user' >> .hg/hgrc
223 $ echo 'l.password=pass' >> .hg/hgrc
218 $ echo 'l.password=pass' >> .hg/hgrc
224 $ hg id http://localhost:$HGPORT2/
219 $ hg id http://localhost:$HGPORT2/
225 5fed3813f7f5
220 5fed3813f7f5
226 $ hg id http://localhost:$HGPORT2/
221 $ hg id http://localhost:$HGPORT2/
227 5fed3813f7f5
222 5fed3813f7f5
228 $ hg id http://user@localhost:$HGPORT2/
223 $ hg id http://user@localhost:$HGPORT2/
229 5fed3813f7f5
224 5fed3813f7f5
230 $ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1
225 $ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1
231 streaming all changes
226 streaming all changes
232 7 files to transfer, 916 bytes of data
227 7 files to transfer, 916 bytes of data
233 transferred * bytes in * seconds (*/sec) (glob)
228 transferred * bytes in * seconds (*/sec) (glob)
234 searching for changes
229 searching for changes
235 no changes found
230 no changes found
236 updating to branch default
231 updating to branch default
237 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
232 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
238 --pull should override server's preferuncompressed
233 --pull should override server's preferuncompressed
239 $ hg clone --pull http://user:pass@localhost:$HGPORT2/ dest-pull 2>&1
234 $ hg clone --pull http://user:pass@localhost:$HGPORT2/ dest-pull 2>&1
240 requesting all changes
235 requesting all changes
241 adding changesets
236 adding changesets
242 adding manifests
237 adding manifests
243 adding file changes
238 adding file changes
244 added 2 changesets with 5 changes to 5 files
239 added 2 changesets with 5 changes to 5 files
245 new changesets 8b6053c928fe:5fed3813f7f5
240 new changesets 8b6053c928fe:5fed3813f7f5
246 updating to branch default
241 updating to branch default
247 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
242 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
248
243
249 $ hg id http://user2@localhost:$HGPORT2/
244 $ hg id http://user2@localhost:$HGPORT2/
250 abort: http authorization required for http://localhost:$HGPORT2/
245 abort: http authorization required for http://localhost:$HGPORT2/
251 [255]
246 [255]
252 $ hg id http://user:pass2@localhost:$HGPORT2/
247 $ hg id http://user:pass2@localhost:$HGPORT2/
253 abort: HTTP Error 403: no
248 abort: HTTP Error 403: no
254 [255]
249 [255]
255
250
256 $ hg -R dest tag -r tip top
251 $ hg -R dest tag -r tip top
257 $ hg -R dest push http://user:pass@localhost:$HGPORT2/
252 $ hg -R dest push http://user:pass@localhost:$HGPORT2/
258 pushing to http://user:***@localhost:$HGPORT2/
253 pushing to http://user:***@localhost:$HGPORT2/
259 searching for changes
254 searching for changes
260 remote: adding changesets
255 remote: adding changesets
261 remote: adding manifests
256 remote: adding manifests
262 remote: adding file changes
257 remote: adding file changes
263 remote: added 1 changesets with 1 changes to 1 files
258 remote: added 1 changesets with 1 changes to 1 files
264 $ hg rollback -q
259 $ hg rollback -q
265
260
266 $ sed 's/.*] "/"/' < ../access.log
261 $ sed 's/.*] "/"/' < ../access.log
267 "GET /?cmd=capabilities HTTP/1.1" 200 -
262 "GET /?cmd=capabilities HTTP/1.1" 200 -
268 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
263 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
269 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
264 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
270 "GET /?cmd=capabilities HTTP/1.1" 200 -
265 "GET /?cmd=capabilities HTTP/1.1" 200 -
271 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
266 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
272 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
267 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
273 "GET /?cmd=capabilities HTTP/1.1" 200 -
268 "GET /?cmd=capabilities HTTP/1.1" 200 -
274 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
269 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
275 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
270 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
276 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
271 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
277 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
272 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
278 "GET /?cmd=capabilities HTTP/1.1" 200 -
273 "GET /?cmd=capabilities HTTP/1.1" 200 -
279 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
274 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
280 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
275 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
281 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
276 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
282 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
277 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
283 "GET /?cmd=capabilities HTTP/1.1" 200 -
278 "GET /?cmd=capabilities HTTP/1.1" 200 -
284 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
279 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
285 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
280 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
286 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
281 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
287 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
282 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
288 "GET /?cmd=capabilities HTTP/1.1" 200 -
283 "GET /?cmd=capabilities HTTP/1.1" 200 -
289 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
284 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
290 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
285 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
291 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
286 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
292 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
287 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
293 "GET /?cmd=capabilities HTTP/1.1" 200 -
288 "GET /?cmd=capabilities HTTP/1.1" 200 -
294 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
289 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
295 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
290 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
296 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
291 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
297 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
292 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
298 "GET /?cmd=capabilities HTTP/1.1" 200 -
293 "GET /?cmd=capabilities HTTP/1.1" 200 -
299 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
294 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
300 "GET /?cmd=stream_out HTTP/1.1" 401 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
295 "GET /?cmd=stream_out HTTP/1.1" 401 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
301 "GET /?cmd=stream_out HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
296 "GET /?cmd=stream_out HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
302 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
297 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
303 "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D5fed3813f7f5e1824344fdc9cf8f63bb662c292d x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
298 "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D5fed3813f7f5e1824344fdc9cf8f63bb662c292d x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
304 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
299 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
305 "GET /?cmd=capabilities HTTP/1.1" 200 -
300 "GET /?cmd=capabilities HTTP/1.1" 200 -
306 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
301 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
307 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
302 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
308 "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$
303 "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$
309 "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
304 "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
310 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
305 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
311 "GET /?cmd=capabilities HTTP/1.1" 200 -
306 "GET /?cmd=capabilities HTTP/1.1" 200 -
312 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
307 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
313 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
308 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
314 "GET /?cmd=capabilities HTTP/1.1" 200 -
309 "GET /?cmd=capabilities HTTP/1.1" 200 -
315 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
310 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
316 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
311 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
317 "GET /?cmd=listkeys HTTP/1.1" 403 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
312 "GET /?cmd=listkeys HTTP/1.1" 403 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
318 "GET /?cmd=capabilities HTTP/1.1" 200 -
313 "GET /?cmd=capabilities HTTP/1.1" 200 -
319 "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$
314 "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$
320 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
315 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
321 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
316 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
322 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
317 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
323 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
318 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
324 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
319 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
325 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
320 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
326 "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=686173686564+5eb5abfefeea63c80dd7553bcc3783f37e0c5524* (glob)
321 "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=686173686564+5eb5abfefeea63c80dd7553bcc3783f37e0c5524* (glob)
327 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
322 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
328
323
329 $ cd ..
324 $ cd ..
330
325
331 clone of serve with repo in root and unserved subrepo (issue2970)
326 clone of serve with repo in root and unserved subrepo (issue2970)
332
327
333 $ hg --cwd test init sub
328 $ hg --cwd test init sub
334 $ echo empty > test/sub/empty
329 $ echo empty > test/sub/empty
335 $ hg --cwd test/sub add empty
330 $ hg --cwd test/sub add empty
336 $ hg --cwd test/sub commit -qm 'add empty'
331 $ hg --cwd test/sub commit -qm 'add empty'
337 $ hg --cwd test/sub tag -r 0 something
332 $ hg --cwd test/sub tag -r 0 something
338 $ echo sub = sub > test/.hgsub
333 $ echo sub = sub > test/.hgsub
339 $ hg --cwd test add .hgsub
334 $ hg --cwd test add .hgsub
340 $ hg --cwd test commit -qm 'add subrepo'
335 $ hg --cwd test commit -qm 'add subrepo'
341 $ hg clone http://localhost:$HGPORT noslash-clone
336 $ hg clone http://localhost:$HGPORT noslash-clone
342 requesting all changes
337 requesting all changes
343 adding changesets
338 adding changesets
344 adding manifests
339 adding manifests
345 adding file changes
340 adding file changes
346 added 3 changesets with 7 changes to 7 files
341 added 3 changesets with 7 changes to 7 files
347 new changesets 8b6053c928fe:56f9bc90cce6
342 new changesets 8b6053c928fe:56f9bc90cce6
348 updating to branch default
343 updating to branch default
349 abort: HTTP Error 404: Not Found
344 abort: HTTP Error 404: Not Found
350 [255]
345 [255]
351 $ hg clone http://localhost:$HGPORT/ slash-clone
346 $ hg clone http://localhost:$HGPORT/ slash-clone
352 requesting all changes
347 requesting all changes
353 adding changesets
348 adding changesets
354 adding manifests
349 adding manifests
355 adding file changes
350 adding file changes
356 added 3 changesets with 7 changes to 7 files
351 added 3 changesets with 7 changes to 7 files
357 new changesets 8b6053c928fe:56f9bc90cce6
352 new changesets 8b6053c928fe:56f9bc90cce6
358 updating to branch default
353 updating to branch default
359 abort: HTTP Error 404: Not Found
354 abort: HTTP Error 404: Not Found
360 [255]
355 [255]
361
356
362 check error log
357 check error log
363
358
364 $ cat error.log
359 $ cat error.log
365
360
366 Check error reporting while pulling/cloning
361 Check error reporting while pulling/cloning
367
362
368 $ $RUNTESTDIR/killdaemons.py
363 $ $RUNTESTDIR/killdaemons.py
369 $ hg serve -R test -p $HGPORT -d --pid-file=hg3.pid -E error.log --config extensions.crash=${TESTDIR}/crashgetbundler.py
364 $ hg serve -R test -p $HGPORT -d --pid-file=hg3.pid -E error.log --config extensions.crash=${TESTDIR}/crashgetbundler.py
370 $ cat hg3.pid >> $DAEMON_PIDS
365 $ cat hg3.pid >> $DAEMON_PIDS
371 $ hg clone http://localhost:$HGPORT/ abort-clone
366 $ hg clone http://localhost:$HGPORT/ abort-clone
372 requesting all changes
367 requesting all changes
373 abort: remote error:
368 abort: remote error:
374 this is an exercise
369 this is an exercise
375 [255]
370 [255]
376 $ cat error.log
371 $ cat error.log
377
372
378 disable pull-based clones
373 disable pull-based clones
379
374
380 $ hg serve -R test -p $HGPORT1 -d --pid-file=hg4.pid -E error.log --config server.disablefullbundle=True
375 $ hg serve -R test -p $HGPORT1 -d --pid-file=hg4.pid -E error.log --config server.disablefullbundle=True
381 $ cat hg4.pid >> $DAEMON_PIDS
376 $ cat hg4.pid >> $DAEMON_PIDS
382 $ hg clone http://localhost:$HGPORT1/ disable-pull-clone
377 $ hg clone http://localhost:$HGPORT1/ disable-pull-clone
383 requesting all changes
378 requesting all changes
384 abort: remote error:
379 abort: remote error:
385 server has pull-based clones disabled
380 server has pull-based clones disabled
386 [255]
381 [255]
387
382
388 ... but keep stream clones working
383 ... but keep stream clones working
389
384
390 $ hg clone --stream --noupdate http://localhost:$HGPORT1/ test-stream-clone
385 $ hg clone --stream --noupdate http://localhost:$HGPORT1/ test-stream-clone
391 streaming all changes
386 streaming all changes
392 * files to transfer, * of data (glob)
387 * files to transfer, * of data (glob)
393 transferred * in * seconds (* KB/sec) (glob)
388 transferred * in * seconds (* KB/sec) (glob)
394 searching for changes
389 searching for changes
395 no changes found
390 no changes found
396
391
397 ... and also keep partial clones and pulls working
392 ... and also keep partial clones and pulls working
398 $ hg clone http://localhost:$HGPORT1 --rev 0 test-partial-clone
393 $ hg clone http://localhost:$HGPORT1 --rev 0 test-partial-clone
399 adding changesets
394 adding changesets
400 adding manifests
395 adding manifests
401 adding file changes
396 adding file changes
402 added 1 changesets with 4 changes to 4 files
397 added 1 changesets with 4 changes to 4 files
403 new changesets 8b6053c928fe
398 new changesets 8b6053c928fe
404 updating to branch default
399 updating to branch default
405 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
400 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
406 $ hg pull -R test-partial-clone
401 $ hg pull -R test-partial-clone
407 pulling from http://localhost:$HGPORT1/
402 pulling from http://localhost:$HGPORT1/
408 searching for changes
403 searching for changes
409 adding changesets
404 adding changesets
410 adding manifests
405 adding manifests
411 adding file changes
406 adding file changes
412 added 2 changesets with 3 changes to 3 files
407 added 2 changesets with 3 changes to 3 files
413 new changesets 5fed3813f7f5:56f9bc90cce6
408 new changesets 5fed3813f7f5:56f9bc90cce6
414 (run 'hg update' to get a working copy)
409 (run 'hg update' to get a working copy)
415
410
416 $ cat error.log
411 $ cat error.log
@@ -1,465 +1,460 b''
1 #require killdaemons serve
1 #require killdaemons 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 #if windows
21 $ hg serve -p $HGPORT1 2>&1
20 $ hg serve -p $HGPORT1 2>&1
22 abort: cannot start server at 'localhost:$HGPORT1': * (glob)
21 abort: cannot start server at 'localhost:$HGPORT1': $EADDRINUSE$
23 [255]
22 [255]
24 #else
23
25 $ hg serve -p $HGPORT1 2>&1
26 abort: cannot start server at 'localhost:$HGPORT1': Address already in use
27 [255]
28 #endif
29 $ cd ..
24 $ cd ..
30 $ cat hg1.pid hg2.pid >> $DAEMON_PIDS
25 $ cat hg1.pid hg2.pid >> $DAEMON_PIDS
31
26
32 clone via stream
27 clone via stream
33
28
34 $ hg clone --stream http://localhost:$HGPORT/ copy 2>&1
29 $ hg clone --stream http://localhost:$HGPORT/ copy 2>&1
35 streaming all changes
30 streaming all changes
36 6 files to transfer, 606 bytes of data
31 6 files to transfer, 606 bytes of data
37 transferred * bytes in * seconds (*/sec) (glob)
32 transferred * bytes in * seconds (*/sec) (glob)
38 searching for changes
33 searching for changes
39 no changes found
34 no changes found
40 updating to branch default
35 updating to branch default
41 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
36 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
42 $ hg verify -R copy
37 $ hg verify -R copy
43 checking changesets
38 checking changesets
44 checking manifests
39 checking manifests
45 crosschecking files in changesets and manifests
40 crosschecking files in changesets and manifests
46 checking files
41 checking files
47 4 files, 1 changesets, 4 total revisions
42 4 files, 1 changesets, 4 total revisions
48
43
49 try to clone via stream, should use pull instead
44 try to clone via stream, should use pull instead
50
45
51 $ hg clone --stream http://localhost:$HGPORT1/ copy2
46 $ hg clone --stream http://localhost:$HGPORT1/ copy2
52 warning: stream clone requested but server has them disabled
47 warning: stream clone requested but server has them disabled
53 requesting all changes
48 requesting all changes
54 adding changesets
49 adding changesets
55 adding manifests
50 adding manifests
56 adding file changes
51 adding file changes
57 added 1 changesets with 4 changes to 4 files
52 added 1 changesets with 4 changes to 4 files
58 new changesets 8b6053c928fe
53 new changesets 8b6053c928fe
59 updating to branch default
54 updating to branch default
60 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
61
56
62 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
63
58
64 $ cat > $TESTTMP/removesupportedformat.py << EOF
59 $ cat > $TESTTMP/removesupportedformat.py << EOF
65 > from mercurial import localrepo
60 > from mercurial import localrepo
66 > def extsetup(ui):
61 > def extsetup(ui):
67 > localrepo.localrepository.supportedformats.remove('generaldelta')
62 > localrepo.localrepository.supportedformats.remove('generaldelta')
68 > EOF
63 > EOF
69
64
70 $ 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
71 warning: stream clone requested but client is missing requirements: generaldelta
66 warning: stream clone requested but client is missing requirements: generaldelta
72 (see https://www.mercurial-scm.org/wiki/MissingRequirement for more information)
67 (see https://www.mercurial-scm.org/wiki/MissingRequirement for more information)
73 requesting all changes
68 requesting all changes
74 adding changesets
69 adding changesets
75 adding manifests
70 adding manifests
76 adding file changes
71 adding file changes
77 added 1 changesets with 4 changes to 4 files
72 added 1 changesets with 4 changes to 4 files
78 new changesets 8b6053c928fe
73 new changesets 8b6053c928fe
79 updating to branch default
74 updating to branch default
80 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
81
76
82 clone via pull
77 clone via pull
83
78
84 $ hg clone http://localhost:$HGPORT1/ copy-pull
79 $ hg clone http://localhost:$HGPORT1/ copy-pull
85 requesting all changes
80 requesting all changes
86 adding changesets
81 adding changesets
87 adding manifests
82 adding manifests
88 adding file changes
83 adding file changes
89 added 1 changesets with 4 changes to 4 files
84 added 1 changesets with 4 changes to 4 files
90 new changesets 8b6053c928fe
85 new changesets 8b6053c928fe
91 updating to branch default
86 updating to branch default
92 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
93 $ hg verify -R copy-pull
88 $ hg verify -R copy-pull
94 checking changesets
89 checking changesets
95 checking manifests
90 checking manifests
96 crosschecking files in changesets and manifests
91 crosschecking files in changesets and manifests
97 checking files
92 checking files
98 4 files, 1 changesets, 4 total revisions
93 4 files, 1 changesets, 4 total revisions
99 $ cd test
94 $ cd test
100 $ echo bar > bar
95 $ echo bar > bar
101 $ hg commit -A -d '1 0' -m 2
96 $ hg commit -A -d '1 0' -m 2
102 adding bar
97 adding bar
103 $ cd ..
98 $ cd ..
104
99
105 clone over http with --update
100 clone over http with --update
106
101
107 $ hg clone http://localhost:$HGPORT1/ updated --update 0
102 $ hg clone http://localhost:$HGPORT1/ updated --update 0
108 requesting all changes
103 requesting all changes
109 adding changesets
104 adding changesets
110 adding manifests
105 adding manifests
111 adding file changes
106 adding file changes
112 added 2 changesets with 5 changes to 5 files
107 added 2 changesets with 5 changes to 5 files
113 new changesets 8b6053c928fe:5fed3813f7f5
108 new changesets 8b6053c928fe:5fed3813f7f5
114 updating to branch default
109 updating to branch default
115 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
116 $ hg log -r . -R updated
111 $ hg log -r . -R updated
117 changeset: 0:8b6053c928fe
112 changeset: 0:8b6053c928fe
118 user: test
113 user: test
119 date: Thu Jan 01 00:00:00 1970 +0000
114 date: Thu Jan 01 00:00:00 1970 +0000
120 summary: 1
115 summary: 1
121
116
122 $ rm -rf updated
117 $ rm -rf updated
123
118
124 incoming via HTTP
119 incoming via HTTP
125
120
126 $ hg clone http://localhost:$HGPORT1/ --rev 0 partial
121 $ hg clone http://localhost:$HGPORT1/ --rev 0 partial
127 adding changesets
122 adding changesets
128 adding manifests
123 adding manifests
129 adding file changes
124 adding file changes
130 added 1 changesets with 4 changes to 4 files
125 added 1 changesets with 4 changes to 4 files
131 new changesets 8b6053c928fe
126 new changesets 8b6053c928fe
132 updating to branch default
127 updating to branch default
133 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
134 $ cd partial
129 $ cd partial
135 $ touch LOCAL
130 $ touch LOCAL
136 $ hg ci -qAm LOCAL
131 $ hg ci -qAm LOCAL
137 $ hg incoming http://localhost:$HGPORT1/ --template '{desc}\n'
132 $ hg incoming http://localhost:$HGPORT1/ --template '{desc}\n'
138 comparing with http://localhost:$HGPORT1/
133 comparing with http://localhost:$HGPORT1/
139 searching for changes
134 searching for changes
140 2
135 2
141 $ cd ..
136 $ cd ..
142
137
143 pull
138 pull
144
139
145 $ cd copy-pull
140 $ cd copy-pull
146 $ cat >> .hg/hgrc <<EOF
141 $ cat >> .hg/hgrc <<EOF
147 > [hooks]
142 > [hooks]
148 > changegroup = sh -c "printenv.py changegroup"
143 > changegroup = sh -c "printenv.py changegroup"
149 > EOF
144 > EOF
150 $ hg pull
145 $ hg pull
151 pulling from http://localhost:$HGPORT1/
146 pulling from http://localhost:$HGPORT1/
152 searching for changes
147 searching for changes
153 adding changesets
148 adding changesets
154 adding manifests
149 adding manifests
155 adding file changes
150 adding file changes
156 added 1 changesets with 1 changes to 1 files
151 added 1 changesets with 1 changes to 1 files
157 new changesets 5fed3813f7f5
152 new changesets 5fed3813f7f5
158 changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=http://localhost:$HGPORT1/
153 changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=http://localhost:$HGPORT1/
159 (run 'hg update' to get a working copy)
154 (run 'hg update' to get a working copy)
160 $ cd ..
155 $ cd ..
161
156
162 clone from invalid URL
157 clone from invalid URL
163
158
164 $ hg clone http://localhost:$HGPORT/bad
159 $ hg clone http://localhost:$HGPORT/bad
165 abort: HTTP Error 404: Not Found
160 abort: HTTP Error 404: Not Found
166 [255]
161 [255]
167
162
168 test http authentication
163 test http authentication
169 + use the same server to test server side streaming preference
164 + use the same server to test server side streaming preference
170
165
171 $ cd test
166 $ cd test
172 $ cat << EOT > userpass.py
167 $ cat << EOT > userpass.py
173 > import base64
168 > import base64
174 > from mercurial.hgweb import common
169 > from mercurial.hgweb import common
175 > def perform_authentication(hgweb, req, op):
170 > def perform_authentication(hgweb, req, op):
176 > auth = req.env.get('HTTP_AUTHORIZATION')
171 > auth = req.env.get('HTTP_AUTHORIZATION')
177 > if not auth:
172 > if not auth:
178 > raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, 'who',
173 > raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, 'who',
179 > [('WWW-Authenticate', 'Basic Realm="mercurial"')])
174 > [('WWW-Authenticate', 'Basic Realm="mercurial"')])
180 > if base64.b64decode(auth.split()[1]).split(':', 1) != ['user', 'pass']:
175 > if base64.b64decode(auth.split()[1]).split(':', 1) != ['user', 'pass']:
181 > raise common.ErrorResponse(common.HTTP_FORBIDDEN, 'no')
176 > raise common.ErrorResponse(common.HTTP_FORBIDDEN, 'no')
182 > def extsetup():
177 > def extsetup():
183 > common.permhooks.insert(0, perform_authentication)
178 > common.permhooks.insert(0, perform_authentication)
184 > EOT
179 > EOT
185 $ hg serve --config extensions.x=userpass.py -p $HGPORT2 -d --pid-file=pid \
180 $ hg serve --config extensions.x=userpass.py -p $HGPORT2 -d --pid-file=pid \
186 > --config server.preferuncompressed=True \
181 > --config server.preferuncompressed=True \
187 > --config web.push_ssl=False --config web.allow_push=* -A ../access.log
182 > --config web.push_ssl=False --config web.allow_push=* -A ../access.log
188 $ cat pid >> $DAEMON_PIDS
183 $ cat pid >> $DAEMON_PIDS
189
184
190 $ cat << EOF > get_pass.py
185 $ cat << EOF > get_pass.py
191 > import getpass
186 > import getpass
192 > def newgetpass(arg):
187 > def newgetpass(arg):
193 > return "pass"
188 > return "pass"
194 > getpass.getpass = newgetpass
189 > getpass.getpass = newgetpass
195 > EOF
190 > EOF
196
191
197 $ hg id http://localhost:$HGPORT2/
192 $ hg id http://localhost:$HGPORT2/
198 abort: http authorization required for http://localhost:$HGPORT2/
193 abort: http authorization required for http://localhost:$HGPORT2/
199 [255]
194 [255]
200 $ hg id http://localhost:$HGPORT2/
195 $ hg id http://localhost:$HGPORT2/
201 abort: http authorization required for http://localhost:$HGPORT2/
196 abort: http authorization required for http://localhost:$HGPORT2/
202 [255]
197 [255]
203 $ hg id --config ui.interactive=true --config extensions.getpass=get_pass.py http://user@localhost:$HGPORT2/
198 $ hg id --config ui.interactive=true --config extensions.getpass=get_pass.py http://user@localhost:$HGPORT2/
204 http authorization required for http://localhost:$HGPORT2/
199 http authorization required for http://localhost:$HGPORT2/
205 realm: mercurial
200 realm: mercurial
206 user: user
201 user: user
207 password: 5fed3813f7f5
202 password: 5fed3813f7f5
208 $ hg id http://user:pass@localhost:$HGPORT2/
203 $ hg id http://user:pass@localhost:$HGPORT2/
209 5fed3813f7f5
204 5fed3813f7f5
210 $ echo '[auth]' >> .hg/hgrc
205 $ echo '[auth]' >> .hg/hgrc
211 $ echo 'l.schemes=http' >> .hg/hgrc
206 $ echo 'l.schemes=http' >> .hg/hgrc
212 $ echo 'l.prefix=lo' >> .hg/hgrc
207 $ echo 'l.prefix=lo' >> .hg/hgrc
213 $ echo 'l.username=user' >> .hg/hgrc
208 $ echo 'l.username=user' >> .hg/hgrc
214 $ echo 'l.password=pass' >> .hg/hgrc
209 $ echo 'l.password=pass' >> .hg/hgrc
215 $ hg id http://localhost:$HGPORT2/
210 $ hg id http://localhost:$HGPORT2/
216 5fed3813f7f5
211 5fed3813f7f5
217 $ hg id http://localhost:$HGPORT2/
212 $ hg id http://localhost:$HGPORT2/
218 5fed3813f7f5
213 5fed3813f7f5
219 $ hg id http://user@localhost:$HGPORT2/
214 $ hg id http://user@localhost:$HGPORT2/
220 5fed3813f7f5
215 5fed3813f7f5
221 $ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1
216 $ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1
222 streaming all changes
217 streaming all changes
223 7 files to transfer, 916 bytes of data
218 7 files to transfer, 916 bytes of data
224 transferred * bytes in * seconds (*/sec) (glob)
219 transferred * bytes in * seconds (*/sec) (glob)
225 searching for changes
220 searching for changes
226 no changes found
221 no changes found
227 updating to branch default
222 updating to branch default
228 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
223 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
229 --pull should override server's preferuncompressed
224 --pull should override server's preferuncompressed
230 $ hg clone --pull http://user:pass@localhost:$HGPORT2/ dest-pull 2>&1
225 $ hg clone --pull http://user:pass@localhost:$HGPORT2/ dest-pull 2>&1
231 requesting all changes
226 requesting all changes
232 adding changesets
227 adding changesets
233 adding manifests
228 adding manifests
234 adding file changes
229 adding file changes
235 added 2 changesets with 5 changes to 5 files
230 added 2 changesets with 5 changes to 5 files
236 new changesets 8b6053c928fe:5fed3813f7f5
231 new changesets 8b6053c928fe:5fed3813f7f5
237 updating to branch default
232 updating to branch default
238 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
233 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
239
234
240 $ hg id http://user2@localhost:$HGPORT2/
235 $ hg id http://user2@localhost:$HGPORT2/
241 abort: http authorization required for http://localhost:$HGPORT2/
236 abort: http authorization required for http://localhost:$HGPORT2/
242 [255]
237 [255]
243 $ hg id http://user:pass2@localhost:$HGPORT2/
238 $ hg id http://user:pass2@localhost:$HGPORT2/
244 abort: HTTP Error 403: no
239 abort: HTTP Error 403: no
245 [255]
240 [255]
246
241
247 $ hg -R dest tag -r tip top
242 $ hg -R dest tag -r tip top
248 $ hg -R dest push http://user:pass@localhost:$HGPORT2/
243 $ hg -R dest push http://user:pass@localhost:$HGPORT2/
249 pushing to http://user:***@localhost:$HGPORT2/
244 pushing to http://user:***@localhost:$HGPORT2/
250 searching for changes
245 searching for changes
251 remote: adding changesets
246 remote: adding changesets
252 remote: adding manifests
247 remote: adding manifests
253 remote: adding file changes
248 remote: adding file changes
254 remote: added 1 changesets with 1 changes to 1 files
249 remote: added 1 changesets with 1 changes to 1 files
255 $ hg rollback -q
250 $ hg rollback -q
256
251
257 $ sed 's/.*] "/"/' < ../access.log
252 $ sed 's/.*] "/"/' < ../access.log
258 "GET /?cmd=capabilities HTTP/1.1" 200 -
253 "GET /?cmd=capabilities HTTP/1.1" 200 -
259 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
254 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
260 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
255 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
261 "GET /?cmd=capabilities HTTP/1.1" 200 -
256 "GET /?cmd=capabilities HTTP/1.1" 200 -
262 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
257 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
263 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
258 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
264 "GET /?cmd=capabilities HTTP/1.1" 200 -
259 "GET /?cmd=capabilities HTTP/1.1" 200 -
265 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
260 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
266 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
261 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
267 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
262 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
268 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
263 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
269 "GET /?cmd=capabilities HTTP/1.1" 200 -
264 "GET /?cmd=capabilities HTTP/1.1" 200 -
270 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
265 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
271 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
266 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
272 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
267 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
273 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
268 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
274 "GET /?cmd=capabilities HTTP/1.1" 200 -
269 "GET /?cmd=capabilities HTTP/1.1" 200 -
275 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
270 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
276 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
271 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
277 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
272 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
278 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
273 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
279 "GET /?cmd=capabilities HTTP/1.1" 200 -
274 "GET /?cmd=capabilities HTTP/1.1" 200 -
280 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
275 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
281 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
276 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
282 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
277 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
283 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
278 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
284 "GET /?cmd=capabilities HTTP/1.1" 200 -
279 "GET /?cmd=capabilities HTTP/1.1" 200 -
285 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
280 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
286 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
281 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
287 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
282 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
288 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
283 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
289 "GET /?cmd=capabilities HTTP/1.1" 200 -
284 "GET /?cmd=capabilities HTTP/1.1" 200 -
290 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
285 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
291 "GET /?cmd=stream_out HTTP/1.1" 401 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
286 "GET /?cmd=stream_out HTTP/1.1" 401 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
292 "GET /?cmd=stream_out HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
287 "GET /?cmd=stream_out HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
293 "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D5fed3813f7f5e1824344fdc9cf8f63bb662c292d x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
288 "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D5fed3813f7f5e1824344fdc9cf8f63bb662c292d x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
294 "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:$USUAL_BUNDLE_CAPS$&cg=0&common=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
289 "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:$USUAL_BUNDLE_CAPS$&cg=0&common=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
295 "GET /?cmd=capabilities HTTP/1.1" 200 -
290 "GET /?cmd=capabilities HTTP/1.1" 200 -
296 "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$
291 "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$
297 "GET /?cmd=getbundle HTTP/1.1" 401 - x-hgarg-1:$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
292 "GET /?cmd=getbundle HTTP/1.1" 401 - x-hgarg-1:$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
298 "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
293 "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
299 "GET /?cmd=capabilities HTTP/1.1" 200 -
294 "GET /?cmd=capabilities HTTP/1.1" 200 -
300 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
295 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
301 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
296 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
302 "GET /?cmd=capabilities HTTP/1.1" 200 -
297 "GET /?cmd=capabilities HTTP/1.1" 200 -
303 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
298 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
304 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
299 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
305 "GET /?cmd=listkeys HTTP/1.1" 403 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
300 "GET /?cmd=listkeys HTTP/1.1" 403 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
306 "GET /?cmd=capabilities HTTP/1.1" 200 -
301 "GET /?cmd=capabilities HTTP/1.1" 200 -
307 "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$
302 "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$
308 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
303 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
309 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
304 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
310 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
305 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
311 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
306 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
312 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
307 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
313 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
308 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
314 "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=666f726365* (glob)
309 "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=666f726365* (glob)
315 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
310 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$
316
311
317 $ cd ..
312 $ cd ..
318
313
319 clone of serve with repo in root and unserved subrepo (issue2970)
314 clone of serve with repo in root and unserved subrepo (issue2970)
320
315
321 $ hg --cwd test init sub
316 $ hg --cwd test init sub
322 $ echo empty > test/sub/empty
317 $ echo empty > test/sub/empty
323 $ hg --cwd test/sub add empty
318 $ hg --cwd test/sub add empty
324 $ hg --cwd test/sub commit -qm 'add empty'
319 $ hg --cwd test/sub commit -qm 'add empty'
325 $ hg --cwd test/sub tag -r 0 something
320 $ hg --cwd test/sub tag -r 0 something
326 $ echo sub = sub > test/.hgsub
321 $ echo sub = sub > test/.hgsub
327 $ hg --cwd test add .hgsub
322 $ hg --cwd test add .hgsub
328 $ hg --cwd test commit -qm 'add subrepo'
323 $ hg --cwd test commit -qm 'add subrepo'
329 $ hg clone http://localhost:$HGPORT noslash-clone
324 $ hg clone http://localhost:$HGPORT noslash-clone
330 requesting all changes
325 requesting all changes
331 adding changesets
326 adding changesets
332 adding manifests
327 adding manifests
333 adding file changes
328 adding file changes
334 added 3 changesets with 7 changes to 7 files
329 added 3 changesets with 7 changes to 7 files
335 new changesets 8b6053c928fe:56f9bc90cce6
330 new changesets 8b6053c928fe:56f9bc90cce6
336 updating to branch default
331 updating to branch default
337 abort: HTTP Error 404: Not Found
332 abort: HTTP Error 404: Not Found
338 [255]
333 [255]
339 $ hg clone http://localhost:$HGPORT/ slash-clone
334 $ hg clone http://localhost:$HGPORT/ slash-clone
340 requesting all changes
335 requesting all changes
341 adding changesets
336 adding changesets
342 adding manifests
337 adding manifests
343 adding file changes
338 adding file changes
344 added 3 changesets with 7 changes to 7 files
339 added 3 changesets with 7 changes to 7 files
345 new changesets 8b6053c928fe:56f9bc90cce6
340 new changesets 8b6053c928fe:56f9bc90cce6
346 updating to branch default
341 updating to branch default
347 abort: HTTP Error 404: Not Found
342 abort: HTTP Error 404: Not Found
348 [255]
343 [255]
349
344
350 check error log
345 check error log
351
346
352 $ cat error.log
347 $ cat error.log
353
348
354 check abort error reporting while pulling/cloning
349 check abort error reporting while pulling/cloning
355
350
356 $ $RUNTESTDIR/killdaemons.py
351 $ $RUNTESTDIR/killdaemons.py
357 $ hg serve -R test -p $HGPORT -d --pid-file=hg3.pid -E error.log --config extensions.crash=${TESTDIR}/crashgetbundler.py
352 $ hg serve -R test -p $HGPORT -d --pid-file=hg3.pid -E error.log --config extensions.crash=${TESTDIR}/crashgetbundler.py
358 $ cat hg3.pid >> $DAEMON_PIDS
353 $ cat hg3.pid >> $DAEMON_PIDS
359 $ hg clone http://localhost:$HGPORT/ abort-clone
354 $ hg clone http://localhost:$HGPORT/ abort-clone
360 requesting all changes
355 requesting all changes
361 remote: abort: this is an exercise
356 remote: abort: this is an exercise
362 abort: pull failed on remote
357 abort: pull failed on remote
363 [255]
358 [255]
364 $ cat error.log
359 $ cat error.log
365
360
366 disable pull-based clones
361 disable pull-based clones
367
362
368 $ hg serve -R test -p $HGPORT1 -d --pid-file=hg4.pid -E error.log --config server.disablefullbundle=True
363 $ hg serve -R test -p $HGPORT1 -d --pid-file=hg4.pid -E error.log --config server.disablefullbundle=True
369 $ cat hg4.pid >> $DAEMON_PIDS
364 $ cat hg4.pid >> $DAEMON_PIDS
370 $ hg clone http://localhost:$HGPORT1/ disable-pull-clone
365 $ hg clone http://localhost:$HGPORT1/ disable-pull-clone
371 requesting all changes
366 requesting all changes
372 remote: abort: server has pull-based clones disabled
367 remote: abort: server has pull-based clones disabled
373 abort: pull failed on remote
368 abort: pull failed on remote
374 (remove --pull if specified or upgrade Mercurial)
369 (remove --pull if specified or upgrade Mercurial)
375 [255]
370 [255]
376
371
377 ... but keep stream clones working
372 ... but keep stream clones working
378
373
379 $ hg clone --stream --noupdate http://localhost:$HGPORT1/ test-stream-clone
374 $ hg clone --stream --noupdate http://localhost:$HGPORT1/ test-stream-clone
380 streaming all changes
375 streaming all changes
381 * files to transfer, * of data (glob)
376 * files to transfer, * of data (glob)
382 transferred * in * seconds (*/sec) (glob)
377 transferred * in * seconds (*/sec) (glob)
383 searching for changes
378 searching for changes
384 no changes found
379 no changes found
385 $ cat error.log
380 $ cat error.log
386
381
387 ... and also keep partial clones and pulls working
382 ... and also keep partial clones and pulls working
388 $ hg clone http://localhost:$HGPORT1 --rev 0 test-partial-clone
383 $ hg clone http://localhost:$HGPORT1 --rev 0 test-partial-clone
389 adding changesets
384 adding changesets
390 adding manifests
385 adding manifests
391 adding file changes
386 adding file changes
392 added 1 changesets with 4 changes to 4 files
387 added 1 changesets with 4 changes to 4 files
393 new changesets 8b6053c928fe
388 new changesets 8b6053c928fe
394 updating to branch default
389 updating to branch default
395 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
390 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
396 $ hg pull -R test-partial-clone
391 $ hg pull -R test-partial-clone
397 pulling from http://localhost:$HGPORT1/
392 pulling from http://localhost:$HGPORT1/
398 searching for changes
393 searching for changes
399 adding changesets
394 adding changesets
400 adding manifests
395 adding manifests
401 adding file changes
396 adding file changes
402 added 2 changesets with 3 changes to 3 files
397 added 2 changesets with 3 changes to 3 files
403 new changesets 5fed3813f7f5:56f9bc90cce6
398 new changesets 5fed3813f7f5:56f9bc90cce6
404 (run 'hg update' to get a working copy)
399 (run 'hg update' to get a working copy)
405
400
406 corrupt cookies file should yield a warning
401 corrupt cookies file should yield a warning
407
402
408 $ cat > $TESTTMP/cookies.txt << EOF
403 $ cat > $TESTTMP/cookies.txt << EOF
409 > bad format
404 > bad format
410 > EOF
405 > EOF
411
406
412 $ hg --config auth.cookiefile=$TESTTMP/cookies.txt id http://localhost:$HGPORT/
407 $ hg --config auth.cookiefile=$TESTTMP/cookies.txt id http://localhost:$HGPORT/
413 (error loading cookie file $TESTTMP/cookies.txt: '*/cookies.txt' does not look like a Netscape format cookies file; continuing without cookies) (glob)
408 (error loading cookie file $TESTTMP/cookies.txt: '*/cookies.txt' does not look like a Netscape format cookies file; continuing without cookies) (glob)
414 56f9bc90cce6
409 56f9bc90cce6
415
410
416 $ killdaemons.py
411 $ killdaemons.py
417
412
418 Create dummy authentication handler that looks for cookies. It doesn't do anything
413 Create dummy authentication handler that looks for cookies. It doesn't do anything
419 useful. It just raises an HTTP 500 with details about the Cookie request header.
414 useful. It just raises an HTTP 500 with details about the Cookie request header.
420 We raise HTTP 500 because its message is printed in the abort message.
415 We raise HTTP 500 because its message is printed in the abort message.
421
416
422 $ cat > cookieauth.py << EOF
417 $ cat > cookieauth.py << EOF
423 > from mercurial import util
418 > from mercurial import util
424 > from mercurial.hgweb import common
419 > from mercurial.hgweb import common
425 > def perform_authentication(hgweb, req, op):
420 > def perform_authentication(hgweb, req, op):
426 > cookie = req.env.get('HTTP_COOKIE')
421 > cookie = req.env.get('HTTP_COOKIE')
427 > if not cookie:
422 > if not cookie:
428 > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, 'no-cookie')
423 > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, 'no-cookie')
429 > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, 'Cookie: %s' % cookie)
424 > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, 'Cookie: %s' % cookie)
430 > def extsetup():
425 > def extsetup():
431 > common.permhooks.insert(0, perform_authentication)
426 > common.permhooks.insert(0, perform_authentication)
432 > EOF
427 > EOF
433
428
434 $ hg serve --config extensions.cookieauth=cookieauth.py -R test -p $HGPORT -d --pid-file=pid
429 $ hg serve --config extensions.cookieauth=cookieauth.py -R test -p $HGPORT -d --pid-file=pid
435 $ cat pid > $DAEMON_PIDS
430 $ cat pid > $DAEMON_PIDS
436
431
437 Request without cookie sent should fail due to lack of cookie
432 Request without cookie sent should fail due to lack of cookie
438
433
439 $ hg id http://localhost:$HGPORT
434 $ hg id http://localhost:$HGPORT
440 abort: HTTP Error 500: no-cookie
435 abort: HTTP Error 500: no-cookie
441 [255]
436 [255]
442
437
443 Populate a cookies file
438 Populate a cookies file
444
439
445 $ cat > cookies.txt << EOF
440 $ cat > cookies.txt << EOF
446 > # HTTP Cookie File
441 > # HTTP Cookie File
447 > # Expiration is 2030-01-01 at midnight
442 > # Expiration is 2030-01-01 at midnight
448 > .example.com TRUE / FALSE 1893456000 hgkey examplevalue
443 > .example.com TRUE / FALSE 1893456000 hgkey examplevalue
449 > EOF
444 > EOF
450
445
451 Should not send a cookie for another domain
446 Should not send a cookie for another domain
452
447
453 $ hg --config auth.cookiefile=cookies.txt id http://localhost:$HGPORT/
448 $ hg --config auth.cookiefile=cookies.txt id http://localhost:$HGPORT/
454 abort: HTTP Error 500: no-cookie
449 abort: HTTP Error 500: no-cookie
455 [255]
450 [255]
456
451
457 Add a cookie entry for our test server and verify it is sent
452 Add a cookie entry for our test server and verify it is sent
458
453
459 $ cat >> cookies.txt << EOF
454 $ cat >> cookies.txt << EOF
460 > localhost.local FALSE / FALSE 1893456000 hgkey localhostvalue
455 > localhost.local FALSE / FALSE 1893456000 hgkey localhostvalue
461 > EOF
456 > EOF
462
457
463 $ hg --config auth.cookiefile=cookies.txt id http://localhost:$HGPORT/
458 $ hg --config auth.cookiefile=cookies.txt id http://localhost:$HGPORT/
464 abort: HTTP Error 500: Cookie: hgkey=localhostvalue
459 abort: HTTP Error 500: Cookie: hgkey=localhostvalue
465 [255]
460 [255]
@@ -1,671 +1,666 b''
1 #require serve ssl
1 #require serve ssl
2
2
3 Proper https client requires the built-in ssl from Python 2.6.
3 Proper https client requires the built-in ssl from Python 2.6.
4
4
5 Make server certificates:
5 Make server certificates:
6
6
7 $ CERTSDIR="$TESTDIR/sslcerts"
7 $ CERTSDIR="$TESTDIR/sslcerts"
8 $ cat "$CERTSDIR/priv.pem" "$CERTSDIR/pub.pem" >> server.pem
8 $ cat "$CERTSDIR/priv.pem" "$CERTSDIR/pub.pem" >> server.pem
9 $ PRIV=`pwd`/server.pem
9 $ PRIV=`pwd`/server.pem
10 $ cat "$CERTSDIR/priv.pem" "$CERTSDIR/pub-not-yet.pem" > server-not-yet.pem
10 $ cat "$CERTSDIR/priv.pem" "$CERTSDIR/pub-not-yet.pem" > server-not-yet.pem
11 $ cat "$CERTSDIR/priv.pem" "$CERTSDIR/pub-expired.pem" > server-expired.pem
11 $ cat "$CERTSDIR/priv.pem" "$CERTSDIR/pub-expired.pem" > server-expired.pem
12
12
13 $ hg init test
13 $ hg init test
14 $ cd test
14 $ cd test
15 $ echo foo>foo
15 $ echo foo>foo
16 $ mkdir foo.d foo.d/bAr.hg.d foo.d/baR.d.hg
16 $ mkdir foo.d foo.d/bAr.hg.d foo.d/baR.d.hg
17 $ echo foo>foo.d/foo
17 $ echo foo>foo.d/foo
18 $ echo bar>foo.d/bAr.hg.d/BaR
18 $ echo bar>foo.d/bAr.hg.d/BaR
19 $ echo bar>foo.d/baR.d.hg/bAR
19 $ echo bar>foo.d/baR.d.hg/bAR
20 $ hg commit -A -m 1
20 $ hg commit -A -m 1
21 adding foo
21 adding foo
22 adding foo.d/bAr.hg.d/BaR
22 adding foo.d/bAr.hg.d/BaR
23 adding foo.d/baR.d.hg/bAR
23 adding foo.d/baR.d.hg/bAR
24 adding foo.d/foo
24 adding foo.d/foo
25 $ hg serve -p $HGPORT -d --pid-file=../hg0.pid --certificate=$PRIV
25 $ hg serve -p $HGPORT -d --pid-file=../hg0.pid --certificate=$PRIV
26 $ cat ../hg0.pid >> $DAEMON_PIDS
26 $ cat ../hg0.pid >> $DAEMON_PIDS
27
27
28 cacert not found
28 cacert not found
29
29
30 $ hg in --config web.cacerts=no-such.pem https://localhost:$HGPORT/
30 $ hg in --config web.cacerts=no-such.pem https://localhost:$HGPORT/
31 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
31 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
32 abort: could not find web.cacerts: no-such.pem
32 abort: could not find web.cacerts: no-such.pem
33 [255]
33 [255]
34
34
35 Test server address cannot be reused
35 Test server address cannot be reused
36
36
37 #if windows
38 $ hg serve -p $HGPORT --certificate=$PRIV 2>&1
37 $ hg serve -p $HGPORT --certificate=$PRIV 2>&1
39 abort: cannot start server at 'localhost:$HGPORT': * (glob)
38 abort: cannot start server at 'localhost:$HGPORT': $EADDRINUSE$
40 [255]
39 [255]
41 #else
40
42 $ hg serve -p $HGPORT --certificate=$PRIV 2>&1
43 abort: cannot start server at 'localhost:$HGPORT': Address already in use
44 [255]
45 #endif
46 $ cd ..
41 $ cd ..
47
42
48 Our test cert is not signed by a trusted CA. It should fail to verify if
43 Our test cert is not signed by a trusted CA. It should fail to verify if
49 we are able to load CA certs.
44 we are able to load CA certs.
50
45
51 #if sslcontext defaultcacerts no-defaultcacertsloaded
46 #if sslcontext defaultcacerts no-defaultcacertsloaded
52 $ hg clone https://localhost:$HGPORT/ copy-pull
47 $ hg clone https://localhost:$HGPORT/ copy-pull
53 (an attempt was made to load CA certificates but none were loaded; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error)
48 (an attempt was made to load CA certificates but none were loaded; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error)
54 abort: error: *certificate verify failed* (glob)
49 abort: error: *certificate verify failed* (glob)
55 [255]
50 [255]
56 #endif
51 #endif
57
52
58 #if no-sslcontext defaultcacerts
53 #if no-sslcontext defaultcacerts
59 $ hg clone https://localhost:$HGPORT/ copy-pull
54 $ hg clone https://localhost:$HGPORT/ copy-pull
60 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
55 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
61 (using CA certificates from *; if you see this message, your Mercurial install is not properly configured; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this message) (glob) (?)
56 (using CA certificates from *; if you see this message, your Mercurial install is not properly configured; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this message) (glob) (?)
62 abort: error: *certificate verify failed* (glob)
57 abort: error: *certificate verify failed* (glob)
63 [255]
58 [255]
64 #endif
59 #endif
65
60
66 #if no-sslcontext windows
61 #if no-sslcontext windows
67 $ hg clone https://localhost:$HGPORT/ copy-pull
62 $ hg clone https://localhost:$HGPORT/ copy-pull
68 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info
63 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info
69 (unable to load Windows CA certificates; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this message)
64 (unable to load Windows CA certificates; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this message)
70 abort: error: *certificate verify failed* (glob)
65 abort: error: *certificate verify failed* (glob)
71 [255]
66 [255]
72 #endif
67 #endif
73
68
74 #if no-sslcontext osx
69 #if no-sslcontext osx
75 $ hg clone https://localhost:$HGPORT/ copy-pull
70 $ hg clone https://localhost:$HGPORT/ copy-pull
76 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info
71 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info
77 (unable to load CA certificates; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this message)
72 (unable to load CA certificates; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this message)
78 abort: localhost certificate error: no certificate received
73 abort: localhost certificate error: no certificate received
79 (set hostsecurity.localhost:certfingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e config setting or use --insecure to connect insecurely)
74 (set hostsecurity.localhost:certfingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e config setting or use --insecure to connect insecurely)
80 [255]
75 [255]
81 #endif
76 #endif
82
77
83 #if defaultcacertsloaded
78 #if defaultcacertsloaded
84 $ hg clone https://localhost:$HGPORT/ copy-pull
79 $ hg clone https://localhost:$HGPORT/ copy-pull
85 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
80 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
86 (using CA certificates from *; if you see this message, your Mercurial install is not properly configured; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this message) (glob) (?)
81 (using CA certificates from *; if you see this message, your Mercurial install is not properly configured; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this message) (glob) (?)
87 (the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
82 (the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
88 abort: error: *certificate verify failed* (glob)
83 abort: error: *certificate verify failed* (glob)
89 [255]
84 [255]
90 #endif
85 #endif
91
86
92 #if no-defaultcacerts
87 #if no-defaultcacerts
93 $ hg clone https://localhost:$HGPORT/ copy-pull
88 $ hg clone https://localhost:$HGPORT/ copy-pull
94 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
89 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
95 (unable to load * certificates; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this message) (glob) (?)
90 (unable to load * certificates; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this message) (glob) (?)
96 abort: localhost certificate error: no certificate received
91 abort: localhost certificate error: no certificate received
97 (set hostsecurity.localhost:certfingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e config setting or use --insecure to connect insecurely)
92 (set hostsecurity.localhost:certfingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e config setting or use --insecure to connect insecurely)
98 [255]
93 [255]
99 #endif
94 #endif
100
95
101 Specifying a per-host certificate file that doesn't exist will abort. The full
96 Specifying a per-host certificate file that doesn't exist will abort. The full
102 C:/path/to/msysroot will print on Windows.
97 C:/path/to/msysroot will print on Windows.
103
98
104 $ hg --config hostsecurity.localhost:verifycertsfile=/does/not/exist clone https://localhost:$HGPORT/
99 $ hg --config hostsecurity.localhost:verifycertsfile=/does/not/exist clone https://localhost:$HGPORT/
105 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
100 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
106 abort: path specified by hostsecurity.localhost:verifycertsfile does not exist: */does/not/exist (glob)
101 abort: path specified by hostsecurity.localhost:verifycertsfile does not exist: */does/not/exist (glob)
107 [255]
102 [255]
108
103
109 A malformed per-host certificate file will raise an error
104 A malformed per-host certificate file will raise an error
110
105
111 $ echo baddata > badca.pem
106 $ echo baddata > badca.pem
112 #if sslcontext
107 #if sslcontext
113 $ hg --config hostsecurity.localhost:verifycertsfile=badca.pem clone https://localhost:$HGPORT/
108 $ hg --config hostsecurity.localhost:verifycertsfile=badca.pem clone https://localhost:$HGPORT/
114 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
109 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
115 abort: error loading CA file badca.pem: * (glob)
110 abort: error loading CA file badca.pem: * (glob)
116 (file is empty or malformed?)
111 (file is empty or malformed?)
117 [255]
112 [255]
118 #else
113 #else
119 $ hg --config hostsecurity.localhost:verifycertsfile=badca.pem clone https://localhost:$HGPORT/
114 $ hg --config hostsecurity.localhost:verifycertsfile=badca.pem clone https://localhost:$HGPORT/
120 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
115 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
121 abort: error: * (glob)
116 abort: error: * (glob)
122 [255]
117 [255]
123 #endif
118 #endif
124
119
125 A per-host certificate mismatching the server will fail verification
120 A per-host certificate mismatching the server will fail verification
126
121
127 (modern ssl is able to discern whether the loaded cert is a CA cert)
122 (modern ssl is able to discern whether the loaded cert is a CA cert)
128 #if sslcontext
123 #if sslcontext
129 $ hg --config hostsecurity.localhost:verifycertsfile="$CERTSDIR/client-cert.pem" clone https://localhost:$HGPORT/
124 $ hg --config hostsecurity.localhost:verifycertsfile="$CERTSDIR/client-cert.pem" clone https://localhost:$HGPORT/
130 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
125 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
131 (an attempt was made to load CA certificates but none were loaded; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error)
126 (an attempt was made to load CA certificates but none were loaded; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error)
132 (the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
127 (the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
133 abort: error: *certificate verify failed* (glob)
128 abort: error: *certificate verify failed* (glob)
134 [255]
129 [255]
135 #else
130 #else
136 $ hg --config hostsecurity.localhost:verifycertsfile="$CERTSDIR/client-cert.pem" clone https://localhost:$HGPORT/
131 $ hg --config hostsecurity.localhost:verifycertsfile="$CERTSDIR/client-cert.pem" clone https://localhost:$HGPORT/
137 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
132 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
138 abort: error: *certificate verify failed* (glob)
133 abort: error: *certificate verify failed* (glob)
139 [255]
134 [255]
140 #endif
135 #endif
141
136
142 A per-host certificate matching the server's cert will be accepted
137 A per-host certificate matching the server's cert will be accepted
143
138
144 $ hg --config hostsecurity.localhost:verifycertsfile="$CERTSDIR/pub.pem" clone -U https://localhost:$HGPORT/ perhostgood1
139 $ hg --config hostsecurity.localhost:verifycertsfile="$CERTSDIR/pub.pem" clone -U https://localhost:$HGPORT/ perhostgood1
145 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
140 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
146 requesting all changes
141 requesting all changes
147 adding changesets
142 adding changesets
148 adding manifests
143 adding manifests
149 adding file changes
144 adding file changes
150 added 1 changesets with 4 changes to 4 files
145 added 1 changesets with 4 changes to 4 files
151 new changesets 8b6053c928fe
146 new changesets 8b6053c928fe
152
147
153 A per-host certificate with multiple certs and one matching will be accepted
148 A per-host certificate with multiple certs and one matching will be accepted
154
149
155 $ cat "$CERTSDIR/client-cert.pem" "$CERTSDIR/pub.pem" > perhost.pem
150 $ cat "$CERTSDIR/client-cert.pem" "$CERTSDIR/pub.pem" > perhost.pem
156 $ hg --config hostsecurity.localhost:verifycertsfile=perhost.pem clone -U https://localhost:$HGPORT/ perhostgood2
151 $ hg --config hostsecurity.localhost:verifycertsfile=perhost.pem clone -U https://localhost:$HGPORT/ perhostgood2
157 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
152 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
158 requesting all changes
153 requesting all changes
159 adding changesets
154 adding changesets
160 adding manifests
155 adding manifests
161 adding file changes
156 adding file changes
162 added 1 changesets with 4 changes to 4 files
157 added 1 changesets with 4 changes to 4 files
163 new changesets 8b6053c928fe
158 new changesets 8b6053c928fe
164
159
165 Defining both per-host certificate and a fingerprint will print a warning
160 Defining both per-host certificate and a fingerprint will print a warning
166
161
167 $ hg --config hostsecurity.localhost:verifycertsfile="$CERTSDIR/pub.pem" --config hostsecurity.localhost:fingerprints=sha1:ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03 clone -U https://localhost:$HGPORT/ caandfingerwarning
162 $ hg --config hostsecurity.localhost:verifycertsfile="$CERTSDIR/pub.pem" --config hostsecurity.localhost:fingerprints=sha1:ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03 clone -U https://localhost:$HGPORT/ caandfingerwarning
168 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
163 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
169 (hostsecurity.localhost:verifycertsfile ignored when host fingerprints defined; using host fingerprints for verification)
164 (hostsecurity.localhost:verifycertsfile ignored when host fingerprints defined; using host fingerprints for verification)
170 requesting all changes
165 requesting all changes
171 adding changesets
166 adding changesets
172 adding manifests
167 adding manifests
173 adding file changes
168 adding file changes
174 added 1 changesets with 4 changes to 4 files
169 added 1 changesets with 4 changes to 4 files
175 new changesets 8b6053c928fe
170 new changesets 8b6053c928fe
176
171
177 $ DISABLECACERTS="--config devel.disableloaddefaultcerts=true"
172 $ DISABLECACERTS="--config devel.disableloaddefaultcerts=true"
178
173
179 Inability to verify peer certificate will result in abort
174 Inability to verify peer certificate will result in abort
180
175
181 $ hg clone https://localhost:$HGPORT/ copy-pull $DISABLECACERTS
176 $ hg clone https://localhost:$HGPORT/ copy-pull $DISABLECACERTS
182 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
177 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
183 abort: unable to verify security of localhost (no loaded CA certificates); refusing to connect
178 abort: unable to verify security of localhost (no loaded CA certificates); refusing to connect
184 (see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error or set hostsecurity.localhost:fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e to trust this server)
179 (see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error or set hostsecurity.localhost:fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e to trust this server)
185 [255]
180 [255]
186
181
187 $ hg clone --insecure https://localhost:$HGPORT/ copy-pull
182 $ hg clone --insecure https://localhost:$HGPORT/ copy-pull
188 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
183 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
189 warning: connection security to localhost is disabled per current settings; communication is susceptible to eavesdropping and tampering
184 warning: connection security to localhost is disabled per current settings; communication is susceptible to eavesdropping and tampering
190 requesting all changes
185 requesting all changes
191 adding changesets
186 adding changesets
192 adding manifests
187 adding manifests
193 adding file changes
188 adding file changes
194 added 1 changesets with 4 changes to 4 files
189 added 1 changesets with 4 changes to 4 files
195 new changesets 8b6053c928fe
190 new changesets 8b6053c928fe
196 updating to branch default
191 updating to branch default
197 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
192 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
198 $ hg verify -R copy-pull
193 $ hg verify -R copy-pull
199 checking changesets
194 checking changesets
200 checking manifests
195 checking manifests
201 crosschecking files in changesets and manifests
196 crosschecking files in changesets and manifests
202 checking files
197 checking files
203 4 files, 1 changesets, 4 total revisions
198 4 files, 1 changesets, 4 total revisions
204 $ cd test
199 $ cd test
205 $ echo bar > bar
200 $ echo bar > bar
206 $ hg commit -A -d '1 0' -m 2
201 $ hg commit -A -d '1 0' -m 2
207 adding bar
202 adding bar
208 $ cd ..
203 $ cd ..
209
204
210 pull without cacert
205 pull without cacert
211
206
212 $ cd copy-pull
207 $ cd copy-pull
213 $ cat >> .hg/hgrc <<EOF
208 $ cat >> .hg/hgrc <<EOF
214 > [hooks]
209 > [hooks]
215 > changegroup = sh -c "printenv.py changegroup"
210 > changegroup = sh -c "printenv.py changegroup"
216 > EOF
211 > EOF
217 $ hg pull $DISABLECACERTS
212 $ hg pull $DISABLECACERTS
218 pulling from https://localhost:$HGPORT/
213 pulling from https://localhost:$HGPORT/
219 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
214 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
220 abort: unable to verify security of localhost (no loaded CA certificates); refusing to connect
215 abort: unable to verify security of localhost (no loaded CA certificates); refusing to connect
221 (see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error or set hostsecurity.localhost:fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e to trust this server)
216 (see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error or set hostsecurity.localhost:fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e to trust this server)
222 [255]
217 [255]
223
218
224 $ hg pull --insecure
219 $ hg pull --insecure
225 pulling from https://localhost:$HGPORT/
220 pulling from https://localhost:$HGPORT/
226 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
221 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
227 warning: connection security to localhost is disabled per current settings; communication is susceptible to eavesdropping and tampering
222 warning: connection security to localhost is disabled per current settings; communication is susceptible to eavesdropping and tampering
228 searching for changes
223 searching for changes
229 adding changesets
224 adding changesets
230 adding manifests
225 adding manifests
231 adding file changes
226 adding file changes
232 added 1 changesets with 1 changes to 1 files
227 added 1 changesets with 1 changes to 1 files
233 new changesets 5fed3813f7f5
228 new changesets 5fed3813f7f5
234 changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=https://localhost:$HGPORT/
229 changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=https://localhost:$HGPORT/
235 (run 'hg update' to get a working copy)
230 (run 'hg update' to get a working copy)
236 $ cd ..
231 $ cd ..
237
232
238 cacert configured in local repo
233 cacert configured in local repo
239
234
240 $ cp copy-pull/.hg/hgrc copy-pull/.hg/hgrc.bu
235 $ cp copy-pull/.hg/hgrc copy-pull/.hg/hgrc.bu
241 $ echo "[web]" >> copy-pull/.hg/hgrc
236 $ echo "[web]" >> copy-pull/.hg/hgrc
242 $ echo "cacerts=$CERTSDIR/pub.pem" >> copy-pull/.hg/hgrc
237 $ echo "cacerts=$CERTSDIR/pub.pem" >> copy-pull/.hg/hgrc
243 $ hg -R copy-pull pull
238 $ hg -R copy-pull pull
244 pulling from https://localhost:$HGPORT/
239 pulling from https://localhost:$HGPORT/
245 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
240 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
246 searching for changes
241 searching for changes
247 no changes found
242 no changes found
248 $ mv copy-pull/.hg/hgrc.bu copy-pull/.hg/hgrc
243 $ mv copy-pull/.hg/hgrc.bu copy-pull/.hg/hgrc
249
244
250 cacert configured globally, also testing expansion of environment
245 cacert configured globally, also testing expansion of environment
251 variables in the filename
246 variables in the filename
252
247
253 $ echo "[web]" >> $HGRCPATH
248 $ echo "[web]" >> $HGRCPATH
254 $ echo 'cacerts=$P/pub.pem' >> $HGRCPATH
249 $ echo 'cacerts=$P/pub.pem' >> $HGRCPATH
255 $ P="$CERTSDIR" hg -R copy-pull pull
250 $ P="$CERTSDIR" hg -R copy-pull pull
256 pulling from https://localhost:$HGPORT/
251 pulling from https://localhost:$HGPORT/
257 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
252 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
258 searching for changes
253 searching for changes
259 no changes found
254 no changes found
260 $ P="$CERTSDIR" hg -R copy-pull pull --insecure
255 $ P="$CERTSDIR" hg -R copy-pull pull --insecure
261 pulling from https://localhost:$HGPORT/
256 pulling from https://localhost:$HGPORT/
262 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
257 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
263 warning: connection security to localhost is disabled per current settings; communication is susceptible to eavesdropping and tampering
258 warning: connection security to localhost is disabled per current settings; communication is susceptible to eavesdropping and tampering
264 searching for changes
259 searching for changes
265 no changes found
260 no changes found
266
261
267 empty cacert file
262 empty cacert file
268
263
269 $ touch emptycafile
264 $ touch emptycafile
270
265
271 #if sslcontext
266 #if sslcontext
272 $ hg --config web.cacerts=emptycafile -R copy-pull pull
267 $ hg --config web.cacerts=emptycafile -R copy-pull pull
273 pulling from https://localhost:$HGPORT/
268 pulling from https://localhost:$HGPORT/
274 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
269 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
275 abort: error loading CA file emptycafile: * (glob)
270 abort: error loading CA file emptycafile: * (glob)
276 (file is empty or malformed?)
271 (file is empty or malformed?)
277 [255]
272 [255]
278 #else
273 #else
279 $ hg --config web.cacerts=emptycafile -R copy-pull pull
274 $ hg --config web.cacerts=emptycafile -R copy-pull pull
280 pulling from https://localhost:$HGPORT/
275 pulling from https://localhost:$HGPORT/
281 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
276 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
282 abort: error: * (glob)
277 abort: error: * (glob)
283 [255]
278 [255]
284 #endif
279 #endif
285
280
286 cacert mismatch
281 cacert mismatch
287
282
288 $ hg -R copy-pull pull --config web.cacerts="$CERTSDIR/pub.pem" \
283 $ hg -R copy-pull pull --config web.cacerts="$CERTSDIR/pub.pem" \
289 > https://$LOCALIP:$HGPORT/
284 > https://$LOCALIP:$HGPORT/
290 pulling from https://*:$HGPORT/ (glob)
285 pulling from https://*:$HGPORT/ (glob)
291 warning: connecting to $LOCALIP using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
286 warning: connecting to $LOCALIP using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
292 abort: $LOCALIP certificate error: certificate is for localhost (glob)
287 abort: $LOCALIP certificate error: certificate is for localhost (glob)
293 (set hostsecurity.$LOCALIP:certfingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e config setting or use --insecure to connect insecurely)
288 (set hostsecurity.$LOCALIP:certfingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e config setting or use --insecure to connect insecurely)
294 [255]
289 [255]
295 $ hg -R copy-pull pull --config web.cacerts="$CERTSDIR/pub.pem" \
290 $ hg -R copy-pull pull --config web.cacerts="$CERTSDIR/pub.pem" \
296 > https://$LOCALIP:$HGPORT/ --insecure
291 > https://$LOCALIP:$HGPORT/ --insecure
297 pulling from https://*:$HGPORT/ (glob)
292 pulling from https://*:$HGPORT/ (glob)
298 warning: connecting to $LOCALIP using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
293 warning: connecting to $LOCALIP using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
299 warning: connection security to $LOCALIP is disabled per current settings; communication is susceptible to eavesdropping and tampering (glob)
294 warning: connection security to $LOCALIP is disabled per current settings; communication is susceptible to eavesdropping and tampering (glob)
300 searching for changes
295 searching for changes
301 no changes found
296 no changes found
302 $ hg -R copy-pull pull --config web.cacerts="$CERTSDIR/pub-other.pem"
297 $ hg -R copy-pull pull --config web.cacerts="$CERTSDIR/pub-other.pem"
303 pulling from https://localhost:$HGPORT/
298 pulling from https://localhost:$HGPORT/
304 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
299 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
305 (the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
300 (the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
306 abort: error: *certificate verify failed* (glob)
301 abort: error: *certificate verify failed* (glob)
307 [255]
302 [255]
308 $ hg -R copy-pull pull --config web.cacerts="$CERTSDIR/pub-other.pem" \
303 $ hg -R copy-pull pull --config web.cacerts="$CERTSDIR/pub-other.pem" \
309 > --insecure
304 > --insecure
310 pulling from https://localhost:$HGPORT/
305 pulling from https://localhost:$HGPORT/
311 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
306 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
312 warning: connection security to localhost is disabled per current settings; communication is susceptible to eavesdropping and tampering
307 warning: connection security to localhost is disabled per current settings; communication is susceptible to eavesdropping and tampering
313 searching for changes
308 searching for changes
314 no changes found
309 no changes found
315
310
316 Test server cert which isn't valid yet
311 Test server cert which isn't valid yet
317
312
318 $ hg serve -R test -p $HGPORT1 -d --pid-file=hg1.pid --certificate=server-not-yet.pem
313 $ hg serve -R test -p $HGPORT1 -d --pid-file=hg1.pid --certificate=server-not-yet.pem
319 $ cat hg1.pid >> $DAEMON_PIDS
314 $ cat hg1.pid >> $DAEMON_PIDS
320 $ hg -R copy-pull pull --config web.cacerts="$CERTSDIR/pub-not-yet.pem" \
315 $ hg -R copy-pull pull --config web.cacerts="$CERTSDIR/pub-not-yet.pem" \
321 > https://localhost:$HGPORT1/
316 > https://localhost:$HGPORT1/
322 pulling from https://localhost:$HGPORT1/
317 pulling from https://localhost:$HGPORT1/
323 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
318 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
324 (the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
319 (the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
325 abort: error: *certificate verify failed* (glob)
320 abort: error: *certificate verify failed* (glob)
326 [255]
321 [255]
327
322
328 Test server cert which no longer is valid
323 Test server cert which no longer is valid
329
324
330 $ hg serve -R test -p $HGPORT2 -d --pid-file=hg2.pid --certificate=server-expired.pem
325 $ hg serve -R test -p $HGPORT2 -d --pid-file=hg2.pid --certificate=server-expired.pem
331 $ cat hg2.pid >> $DAEMON_PIDS
326 $ cat hg2.pid >> $DAEMON_PIDS
332 $ hg -R copy-pull pull --config web.cacerts="$CERTSDIR/pub-expired.pem" \
327 $ hg -R copy-pull pull --config web.cacerts="$CERTSDIR/pub-expired.pem" \
333 > https://localhost:$HGPORT2/
328 > https://localhost:$HGPORT2/
334 pulling from https://localhost:$HGPORT2/
329 pulling from https://localhost:$HGPORT2/
335 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
330 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
336 (the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
331 (the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
337 abort: error: *certificate verify failed* (glob)
332 abort: error: *certificate verify failed* (glob)
338 [255]
333 [255]
339
334
340 Disabling the TLS 1.0 warning works
335 Disabling the TLS 1.0 warning works
341 $ hg -R copy-pull id https://localhost:$HGPORT/ \
336 $ hg -R copy-pull id https://localhost:$HGPORT/ \
342 > --config hostsecurity.localhost:fingerprints=sha1:ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03 \
337 > --config hostsecurity.localhost:fingerprints=sha1:ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03 \
343 > --config hostsecurity.disabletls10warning=true
338 > --config hostsecurity.disabletls10warning=true
344 5fed3813f7f5
339 5fed3813f7f5
345
340
346 Error message for setting ciphers is different depending on SSLContext support
341 Error message for setting ciphers is different depending on SSLContext support
347
342
348 #if no-sslcontext
343 #if no-sslcontext
349 $ P="$CERTSDIR" hg --config hostsecurity.ciphers=invalid -R copy-pull id https://localhost:$HGPORT/
344 $ P="$CERTSDIR" hg --config hostsecurity.ciphers=invalid -R copy-pull id https://localhost:$HGPORT/
350 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info
345 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info
351 abort: *No cipher can be selected. (glob)
346 abort: *No cipher can be selected. (glob)
352 [255]
347 [255]
353
348
354 $ P="$CERTSDIR" hg --config hostsecurity.ciphers=HIGH -R copy-pull id https://localhost:$HGPORT/
349 $ P="$CERTSDIR" hg --config hostsecurity.ciphers=HIGH -R copy-pull id https://localhost:$HGPORT/
355 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info
350 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info
356 5fed3813f7f5
351 5fed3813f7f5
357 #endif
352 #endif
358
353
359 #if sslcontext
354 #if sslcontext
360 Setting ciphers to an invalid value aborts
355 Setting ciphers to an invalid value aborts
361 $ P="$CERTSDIR" hg --config hostsecurity.ciphers=invalid -R copy-pull id https://localhost:$HGPORT/
356 $ P="$CERTSDIR" hg --config hostsecurity.ciphers=invalid -R copy-pull id https://localhost:$HGPORT/
362 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
357 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
363 abort: could not set ciphers: No cipher can be selected.
358 abort: could not set ciphers: No cipher can be selected.
364 (change cipher string (invalid) in config)
359 (change cipher string (invalid) in config)
365 [255]
360 [255]
366
361
367 $ P="$CERTSDIR" hg --config hostsecurity.localhost:ciphers=invalid -R copy-pull id https://localhost:$HGPORT/
362 $ P="$CERTSDIR" hg --config hostsecurity.localhost:ciphers=invalid -R copy-pull id https://localhost:$HGPORT/
368 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
363 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
369 abort: could not set ciphers: No cipher can be selected.
364 abort: could not set ciphers: No cipher can be selected.
370 (change cipher string (invalid) in config)
365 (change cipher string (invalid) in config)
371 [255]
366 [255]
372
367
373 Changing the cipher string works
368 Changing the cipher string works
374
369
375 $ P="$CERTSDIR" hg --config hostsecurity.ciphers=HIGH -R copy-pull id https://localhost:$HGPORT/
370 $ P="$CERTSDIR" hg --config hostsecurity.ciphers=HIGH -R copy-pull id https://localhost:$HGPORT/
376 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
371 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
377 5fed3813f7f5
372 5fed3813f7f5
378 #endif
373 #endif
379
374
380 Fingerprints
375 Fingerprints
381
376
382 - works without cacerts (hostfingerprints)
377 - works without cacerts (hostfingerprints)
383 $ hg -R copy-pull id https://localhost:$HGPORT/ --insecure --config hostfingerprints.localhost=ec:d8:7c:d6:b3:86:d0:4f:c1:b8:b4:1c:9d:8f:5e:16:8e:ef:1c:03
378 $ hg -R copy-pull id https://localhost:$HGPORT/ --insecure --config hostfingerprints.localhost=ec:d8:7c:d6:b3:86:d0:4f:c1:b8:b4:1c:9d:8f:5e:16:8e:ef:1c:03
384 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
379 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
385 (SHA-1 fingerprint for localhost found in legacy [hostfingerprints] section; if you trust this fingerprint, remove the old SHA-1 fingerprint from [hostfingerprints] and add the following entry to the new [hostsecurity] section: localhost:fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e)
380 (SHA-1 fingerprint for localhost found in legacy [hostfingerprints] section; if you trust this fingerprint, remove the old SHA-1 fingerprint from [hostfingerprints] and add the following entry to the new [hostsecurity] section: localhost:fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e)
386 5fed3813f7f5
381 5fed3813f7f5
387
382
388 - works without cacerts (hostsecurity)
383 - works without cacerts (hostsecurity)
389 $ hg -R copy-pull id https://localhost:$HGPORT/ --config hostsecurity.localhost:fingerprints=sha1:ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03
384 $ hg -R copy-pull id https://localhost:$HGPORT/ --config hostsecurity.localhost:fingerprints=sha1:ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03
390 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
385 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
391 5fed3813f7f5
386 5fed3813f7f5
392
387
393 $ hg -R copy-pull id https://localhost:$HGPORT/ --config hostsecurity.localhost:fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e
388 $ hg -R copy-pull id https://localhost:$HGPORT/ --config hostsecurity.localhost:fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e
394 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
389 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
395 5fed3813f7f5
390 5fed3813f7f5
396
391
397 - multiple fingerprints specified and first matches
392 - multiple fingerprints specified and first matches
398 $ hg --config 'hostfingerprints.localhost=ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03, deadbeefdeadbeefdeadbeefdeadbeefdeadbeef' -R copy-pull id https://localhost:$HGPORT/ --insecure
393 $ hg --config 'hostfingerprints.localhost=ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03, deadbeefdeadbeefdeadbeefdeadbeefdeadbeef' -R copy-pull id https://localhost:$HGPORT/ --insecure
399 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
394 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
400 (SHA-1 fingerprint for localhost found in legacy [hostfingerprints] section; if you trust this fingerprint, remove the old SHA-1 fingerprint from [hostfingerprints] and add the following entry to the new [hostsecurity] section: localhost:fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e)
395 (SHA-1 fingerprint for localhost found in legacy [hostfingerprints] section; if you trust this fingerprint, remove the old SHA-1 fingerprint from [hostfingerprints] and add the following entry to the new [hostsecurity] section: localhost:fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e)
401 5fed3813f7f5
396 5fed3813f7f5
402
397
403 $ hg --config 'hostsecurity.localhost:fingerprints=sha1:ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03, sha1:deadbeefdeadbeefdeadbeefdeadbeefdeadbeef' -R copy-pull id https://localhost:$HGPORT/
398 $ hg --config 'hostsecurity.localhost:fingerprints=sha1:ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03, sha1:deadbeefdeadbeefdeadbeefdeadbeefdeadbeef' -R copy-pull id https://localhost:$HGPORT/
404 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
399 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
405 5fed3813f7f5
400 5fed3813f7f5
406
401
407 - multiple fingerprints specified and last matches
402 - multiple fingerprints specified and last matches
408 $ hg --config 'hostfingerprints.localhost=deadbeefdeadbeefdeadbeefdeadbeefdeadbeef, ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03' -R copy-pull id https://localhost:$HGPORT/ --insecure
403 $ hg --config 'hostfingerprints.localhost=deadbeefdeadbeefdeadbeefdeadbeefdeadbeef, ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03' -R copy-pull id https://localhost:$HGPORT/ --insecure
409 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
404 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
410 (SHA-1 fingerprint for localhost found in legacy [hostfingerprints] section; if you trust this fingerprint, remove the old SHA-1 fingerprint from [hostfingerprints] and add the following entry to the new [hostsecurity] section: localhost:fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e)
405 (SHA-1 fingerprint for localhost found in legacy [hostfingerprints] section; if you trust this fingerprint, remove the old SHA-1 fingerprint from [hostfingerprints] and add the following entry to the new [hostsecurity] section: localhost:fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e)
411 5fed3813f7f5
406 5fed3813f7f5
412
407
413 $ hg --config 'hostsecurity.localhost:fingerprints=sha1:deadbeefdeadbeefdeadbeefdeadbeefdeadbeef, sha1:ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03' -R copy-pull id https://localhost:$HGPORT/
408 $ hg --config 'hostsecurity.localhost:fingerprints=sha1:deadbeefdeadbeefdeadbeefdeadbeefdeadbeef, sha1:ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03' -R copy-pull id https://localhost:$HGPORT/
414 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
409 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
415 5fed3813f7f5
410 5fed3813f7f5
416
411
417 - multiple fingerprints specified and none match
412 - multiple fingerprints specified and none match
418
413
419 $ hg --config 'hostfingerprints.localhost=deadbeefdeadbeefdeadbeefdeadbeefdeadbeef, aeadbeefdeadbeefdeadbeefdeadbeefdeadbeef' -R copy-pull id https://localhost:$HGPORT/ --insecure
414 $ hg --config 'hostfingerprints.localhost=deadbeefdeadbeefdeadbeefdeadbeefdeadbeef, aeadbeefdeadbeefdeadbeefdeadbeefdeadbeef' -R copy-pull id https://localhost:$HGPORT/ --insecure
420 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
415 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
421 abort: certificate for localhost has unexpected fingerprint ec:d8:7c:d6:b3:86:d0:4f:c1:b8:b4:1c:9d:8f:5e:16:8e:ef:1c:03
416 abort: certificate for localhost has unexpected fingerprint ec:d8:7c:d6:b3:86:d0:4f:c1:b8:b4:1c:9d:8f:5e:16:8e:ef:1c:03
422 (check hostfingerprint configuration)
417 (check hostfingerprint configuration)
423 [255]
418 [255]
424
419
425 $ hg --config 'hostsecurity.localhost:fingerprints=sha1:deadbeefdeadbeefdeadbeefdeadbeefdeadbeef, sha1:aeadbeefdeadbeefdeadbeefdeadbeefdeadbeef' -R copy-pull id https://localhost:$HGPORT/
420 $ hg --config 'hostsecurity.localhost:fingerprints=sha1:deadbeefdeadbeefdeadbeefdeadbeefdeadbeef, sha1:aeadbeefdeadbeefdeadbeefdeadbeefdeadbeef' -R copy-pull id https://localhost:$HGPORT/
426 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
421 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
427 abort: certificate for localhost has unexpected fingerprint sha1:ec:d8:7c:d6:b3:86:d0:4f:c1:b8:b4:1c:9d:8f:5e:16:8e:ef:1c:03
422 abort: certificate for localhost has unexpected fingerprint sha1:ec:d8:7c:d6:b3:86:d0:4f:c1:b8:b4:1c:9d:8f:5e:16:8e:ef:1c:03
428 (check hostsecurity configuration)
423 (check hostsecurity configuration)
429 [255]
424 [255]
430
425
431 - fails when cert doesn't match hostname (port is ignored)
426 - fails when cert doesn't match hostname (port is ignored)
432 $ hg -R copy-pull id https://localhost:$HGPORT1/ --config hostfingerprints.localhost=ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03
427 $ hg -R copy-pull id https://localhost:$HGPORT1/ --config hostfingerprints.localhost=ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03
433 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
428 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
434 abort: certificate for localhost has unexpected fingerprint f4:2f:5a:0c:3e:52:5b:db:e7:24:a8:32:1d:18:97:6d:69:b5:87:84
429 abort: certificate for localhost has unexpected fingerprint f4:2f:5a:0c:3e:52:5b:db:e7:24:a8:32:1d:18:97:6d:69:b5:87:84
435 (check hostfingerprint configuration)
430 (check hostfingerprint configuration)
436 [255]
431 [255]
437
432
438
433
439 - ignores that certificate doesn't match hostname
434 - ignores that certificate doesn't match hostname
440 $ hg -R copy-pull id https://$LOCALIP:$HGPORT/ --config hostfingerprints.$LOCALIP=ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03
435 $ hg -R copy-pull id https://$LOCALIP:$HGPORT/ --config hostfingerprints.$LOCALIP=ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03
441 warning: connecting to $LOCALIP using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
436 warning: connecting to $LOCALIP using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
442 (SHA-1 fingerprint for $LOCALIP found in legacy [hostfingerprints] section; if you trust this fingerprint, remove the old SHA-1 fingerprint from [hostfingerprints] and add the following entry to the new [hostsecurity] section: $LOCALIP:fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e)
437 (SHA-1 fingerprint for $LOCALIP found in legacy [hostfingerprints] section; if you trust this fingerprint, remove the old SHA-1 fingerprint from [hostfingerprints] and add the following entry to the new [hostsecurity] section: $LOCALIP:fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e)
443 5fed3813f7f5
438 5fed3813f7f5
444
439
445 Ports used by next test. Kill servers.
440 Ports used by next test. Kill servers.
446
441
447 $ killdaemons.py hg0.pid
442 $ killdaemons.py hg0.pid
448 $ killdaemons.py hg1.pid
443 $ killdaemons.py hg1.pid
449 $ killdaemons.py hg2.pid
444 $ killdaemons.py hg2.pid
450
445
451 #if sslcontext tls1.2
446 #if sslcontext tls1.2
452 Start servers running supported TLS versions
447 Start servers running supported TLS versions
453
448
454 $ cd test
449 $ cd test
455 $ hg serve -p $HGPORT -d --pid-file=../hg0.pid --certificate=$PRIV \
450 $ hg serve -p $HGPORT -d --pid-file=../hg0.pid --certificate=$PRIV \
456 > --config devel.serverexactprotocol=tls1.0
451 > --config devel.serverexactprotocol=tls1.0
457 $ cat ../hg0.pid >> $DAEMON_PIDS
452 $ cat ../hg0.pid >> $DAEMON_PIDS
458 $ hg serve -p $HGPORT1 -d --pid-file=../hg1.pid --certificate=$PRIV \
453 $ hg serve -p $HGPORT1 -d --pid-file=../hg1.pid --certificate=$PRIV \
459 > --config devel.serverexactprotocol=tls1.1
454 > --config devel.serverexactprotocol=tls1.1
460 $ cat ../hg1.pid >> $DAEMON_PIDS
455 $ cat ../hg1.pid >> $DAEMON_PIDS
461 $ hg serve -p $HGPORT2 -d --pid-file=../hg2.pid --certificate=$PRIV \
456 $ hg serve -p $HGPORT2 -d --pid-file=../hg2.pid --certificate=$PRIV \
462 > --config devel.serverexactprotocol=tls1.2
457 > --config devel.serverexactprotocol=tls1.2
463 $ cat ../hg2.pid >> $DAEMON_PIDS
458 $ cat ../hg2.pid >> $DAEMON_PIDS
464 $ cd ..
459 $ cd ..
465
460
466 Clients talking same TLS versions work
461 Clients talking same TLS versions work
467
462
468 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.0 id https://localhost:$HGPORT/
463 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.0 id https://localhost:$HGPORT/
469 5fed3813f7f5
464 5fed3813f7f5
470 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.1 id https://localhost:$HGPORT1/
465 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.1 id https://localhost:$HGPORT1/
471 5fed3813f7f5
466 5fed3813f7f5
472 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.2 id https://localhost:$HGPORT2/
467 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.2 id https://localhost:$HGPORT2/
473 5fed3813f7f5
468 5fed3813f7f5
474
469
475 Clients requiring newer TLS version than what server supports fail
470 Clients requiring newer TLS version than what server supports fail
476
471
477 $ P="$CERTSDIR" hg id https://localhost:$HGPORT/
472 $ P="$CERTSDIR" hg id https://localhost:$HGPORT/
478 (could not negotiate a common security protocol (tls1.1+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support)
473 (could not negotiate a common security protocol (tls1.1+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support)
479 (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
474 (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
480 (see https://mercurial-scm.org/wiki/SecureConnections for more info)
475 (see https://mercurial-scm.org/wiki/SecureConnections for more info)
481 abort: error: *unsupported protocol* (glob)
476 abort: error: *unsupported protocol* (glob)
482 [255]
477 [255]
483
478
484 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.1 id https://localhost:$HGPORT/
479 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.1 id https://localhost:$HGPORT/
485 (could not negotiate a common security protocol (tls1.1+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support)
480 (could not negotiate a common security protocol (tls1.1+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support)
486 (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
481 (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
487 (see https://mercurial-scm.org/wiki/SecureConnections for more info)
482 (see https://mercurial-scm.org/wiki/SecureConnections for more info)
488 abort: error: *unsupported protocol* (glob)
483 abort: error: *unsupported protocol* (glob)
489 [255]
484 [255]
490 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.2 id https://localhost:$HGPORT/
485 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.2 id https://localhost:$HGPORT/
491 (could not negotiate a common security protocol (tls1.2+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support)
486 (could not negotiate a common security protocol (tls1.2+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support)
492 (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
487 (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
493 (see https://mercurial-scm.org/wiki/SecureConnections for more info)
488 (see https://mercurial-scm.org/wiki/SecureConnections for more info)
494 abort: error: *unsupported protocol* (glob)
489 abort: error: *unsupported protocol* (glob)
495 [255]
490 [255]
496 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.2 id https://localhost:$HGPORT1/
491 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.2 id https://localhost:$HGPORT1/
497 (could not negotiate a common security protocol (tls1.2+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support)
492 (could not negotiate a common security protocol (tls1.2+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support)
498 (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
493 (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
499 (see https://mercurial-scm.org/wiki/SecureConnections for more info)
494 (see https://mercurial-scm.org/wiki/SecureConnections for more info)
500 abort: error: *unsupported protocol* (glob)
495 abort: error: *unsupported protocol* (glob)
501 [255]
496 [255]
502
497
503 --insecure will allow TLS 1.0 connections and override configs
498 --insecure will allow TLS 1.0 connections and override configs
504
499
505 $ hg --config hostsecurity.minimumprotocol=tls1.2 id --insecure https://localhost:$HGPORT1/
500 $ hg --config hostsecurity.minimumprotocol=tls1.2 id --insecure https://localhost:$HGPORT1/
506 warning: connection security to localhost is disabled per current settings; communication is susceptible to eavesdropping and tampering
501 warning: connection security to localhost is disabled per current settings; communication is susceptible to eavesdropping and tampering
507 5fed3813f7f5
502 5fed3813f7f5
508
503
509 The per-host config option overrides the default
504 The per-host config option overrides the default
510
505
511 $ P="$CERTSDIR" hg id https://localhost:$HGPORT/ \
506 $ P="$CERTSDIR" hg id https://localhost:$HGPORT/ \
512 > --config hostsecurity.minimumprotocol=tls1.2 \
507 > --config hostsecurity.minimumprotocol=tls1.2 \
513 > --config hostsecurity.localhost:minimumprotocol=tls1.0
508 > --config hostsecurity.localhost:minimumprotocol=tls1.0
514 5fed3813f7f5
509 5fed3813f7f5
515
510
516 The per-host config option by itself works
511 The per-host config option by itself works
517
512
518 $ P="$CERTSDIR" hg id https://localhost:$HGPORT/ \
513 $ P="$CERTSDIR" hg id https://localhost:$HGPORT/ \
519 > --config hostsecurity.localhost:minimumprotocol=tls1.2
514 > --config hostsecurity.localhost:minimumprotocol=tls1.2
520 (could not negotiate a common security protocol (tls1.2+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support)
515 (could not negotiate a common security protocol (tls1.2+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support)
521 (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
516 (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
522 (see https://mercurial-scm.org/wiki/SecureConnections for more info)
517 (see https://mercurial-scm.org/wiki/SecureConnections for more info)
523 abort: error: *unsupported protocol* (glob)
518 abort: error: *unsupported protocol* (glob)
524 [255]
519 [255]
525
520
526 .hg/hgrc file [hostsecurity] settings are applied to remote ui instances (issue5305)
521 .hg/hgrc file [hostsecurity] settings are applied to remote ui instances (issue5305)
527
522
528 $ cat >> copy-pull/.hg/hgrc << EOF
523 $ cat >> copy-pull/.hg/hgrc << EOF
529 > [hostsecurity]
524 > [hostsecurity]
530 > localhost:minimumprotocol=tls1.2
525 > localhost:minimumprotocol=tls1.2
531 > EOF
526 > EOF
532 $ P="$CERTSDIR" hg -R copy-pull id https://localhost:$HGPORT/
527 $ P="$CERTSDIR" hg -R copy-pull id https://localhost:$HGPORT/
533 (could not negotiate a common security protocol (tls1.2+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support)
528 (could not negotiate a common security protocol (tls1.2+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support)
534 (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
529 (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
535 (see https://mercurial-scm.org/wiki/SecureConnections for more info)
530 (see https://mercurial-scm.org/wiki/SecureConnections for more info)
536 abort: error: *unsupported protocol* (glob)
531 abort: error: *unsupported protocol* (glob)
537 [255]
532 [255]
538
533
539 $ killdaemons.py hg0.pid
534 $ killdaemons.py hg0.pid
540 $ killdaemons.py hg1.pid
535 $ killdaemons.py hg1.pid
541 $ killdaemons.py hg2.pid
536 $ killdaemons.py hg2.pid
542 #endif
537 #endif
543
538
544 Prepare for connecting through proxy
539 Prepare for connecting through proxy
545
540
546 $ hg serve -R test -p $HGPORT -d --pid-file=hg0.pid --certificate=$PRIV
541 $ hg serve -R test -p $HGPORT -d --pid-file=hg0.pid --certificate=$PRIV
547 $ cat hg0.pid >> $DAEMON_PIDS
542 $ cat hg0.pid >> $DAEMON_PIDS
548 $ hg serve -R test -p $HGPORT2 -d --pid-file=hg2.pid --certificate=server-expired.pem
543 $ hg serve -R test -p $HGPORT2 -d --pid-file=hg2.pid --certificate=server-expired.pem
549 $ cat hg2.pid >> $DAEMON_PIDS
544 $ cat hg2.pid >> $DAEMON_PIDS
550 tinyproxy.py doesn't fully detach, so killing it may result in extra output
545 tinyproxy.py doesn't fully detach, so killing it may result in extra output
551 from the shell. So don't kill it.
546 from the shell. So don't kill it.
552 $ tinyproxy.py $HGPORT1 localhost >proxy.log </dev/null 2>&1 &
547 $ tinyproxy.py $HGPORT1 localhost >proxy.log </dev/null 2>&1 &
553 $ while [ ! -f proxy.pid ]; do sleep 0; done
548 $ while [ ! -f proxy.pid ]; do sleep 0; done
554 $ cat proxy.pid >> $DAEMON_PIDS
549 $ cat proxy.pid >> $DAEMON_PIDS
555
550
556 $ echo "[http_proxy]" >> copy-pull/.hg/hgrc
551 $ echo "[http_proxy]" >> copy-pull/.hg/hgrc
557 $ echo "always=True" >> copy-pull/.hg/hgrc
552 $ echo "always=True" >> copy-pull/.hg/hgrc
558 $ echo "[hostfingerprints]" >> copy-pull/.hg/hgrc
553 $ echo "[hostfingerprints]" >> copy-pull/.hg/hgrc
559 $ echo "localhost =" >> copy-pull/.hg/hgrc
554 $ echo "localhost =" >> copy-pull/.hg/hgrc
560
555
561 Test unvalidated https through proxy
556 Test unvalidated https through proxy
562
557
563 $ http_proxy=http://localhost:$HGPORT1/ hg -R copy-pull pull --insecure
558 $ http_proxy=http://localhost:$HGPORT1/ hg -R copy-pull pull --insecure
564 pulling from https://localhost:$HGPORT/
559 pulling from https://localhost:$HGPORT/
565 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
560 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
566 warning: connection security to localhost is disabled per current settings; communication is susceptible to eavesdropping and tampering
561 warning: connection security to localhost is disabled per current settings; communication is susceptible to eavesdropping and tampering
567 searching for changes
562 searching for changes
568 no changes found
563 no changes found
569
564
570 Test https with cacert and fingerprint through proxy
565 Test https with cacert and fingerprint through proxy
571
566
572 $ http_proxy=http://localhost:$HGPORT1/ hg -R copy-pull pull \
567 $ http_proxy=http://localhost:$HGPORT1/ hg -R copy-pull pull \
573 > --config web.cacerts="$CERTSDIR/pub.pem"
568 > --config web.cacerts="$CERTSDIR/pub.pem"
574 pulling from https://localhost:$HGPORT/
569 pulling from https://localhost:$HGPORT/
575 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
570 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
576 searching for changes
571 searching for changes
577 no changes found
572 no changes found
578 $ http_proxy=http://localhost:$HGPORT1/ hg -R copy-pull pull https://localhost:$HGPORT/ --config hostfingerprints.localhost=ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03 --trace
573 $ http_proxy=http://localhost:$HGPORT1/ hg -R copy-pull pull https://localhost:$HGPORT/ --config hostfingerprints.localhost=ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03 --trace
579 pulling from https://*:$HGPORT/ (glob)
574 pulling from https://*:$HGPORT/ (glob)
580 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
575 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
581 (SHA-1 fingerprint for localhost found in legacy [hostfingerprints] section; if you trust this fingerprint, remove the old SHA-1 fingerprint from [hostfingerprints] and add the following entry to the new [hostsecurity] section: localhost:fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e)
576 (SHA-1 fingerprint for localhost found in legacy [hostfingerprints] section; if you trust this fingerprint, remove the old SHA-1 fingerprint from [hostfingerprints] and add the following entry to the new [hostsecurity] section: localhost:fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e)
582 searching for changes
577 searching for changes
583 no changes found
578 no changes found
584
579
585 Test https with cert problems through proxy
580 Test https with cert problems through proxy
586
581
587 $ http_proxy=http://localhost:$HGPORT1/ hg -R copy-pull pull \
582 $ http_proxy=http://localhost:$HGPORT1/ hg -R copy-pull pull \
588 > --config web.cacerts="$CERTSDIR/pub-other.pem"
583 > --config web.cacerts="$CERTSDIR/pub-other.pem"
589 pulling from https://localhost:$HGPORT/
584 pulling from https://localhost:$HGPORT/
590 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
585 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
591 (the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
586 (the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
592 abort: error: *certificate verify failed* (glob)
587 abort: error: *certificate verify failed* (glob)
593 [255]
588 [255]
594 $ http_proxy=http://localhost:$HGPORT1/ hg -R copy-pull pull \
589 $ http_proxy=http://localhost:$HGPORT1/ hg -R copy-pull pull \
595 > --config web.cacerts="$CERTSDIR/pub-expired.pem" https://localhost:$HGPORT2/
590 > --config web.cacerts="$CERTSDIR/pub-expired.pem" https://localhost:$HGPORT2/
596 pulling from https://localhost:$HGPORT2/
591 pulling from https://localhost:$HGPORT2/
597 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
592 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
598 (the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
593 (the full certificate chain may not be available locally; see "hg help debugssl") (windows !)
599 abort: error: *certificate verify failed* (glob)
594 abort: error: *certificate verify failed* (glob)
600 [255]
595 [255]
601
596
602
597
603 $ killdaemons.py hg0.pid
598 $ killdaemons.py hg0.pid
604
599
605 #if sslcontext
600 #if sslcontext
606
601
607 $ cd test
602 $ cd test
608
603
609 Missing certificate file(s) are detected
604 Missing certificate file(s) are detected
610
605
611 $ hg serve -p $HGPORT --certificate=/missing/certificate \
606 $ hg serve -p $HGPORT --certificate=/missing/certificate \
612 > --config devel.servercafile=$PRIV --config devel.serverrequirecert=true
607 > --config devel.servercafile=$PRIV --config devel.serverrequirecert=true
613 abort: referenced certificate file (*/missing/certificate) does not exist (glob)
608 abort: referenced certificate file (*/missing/certificate) does not exist (glob)
614 [255]
609 [255]
615
610
616 $ hg serve -p $HGPORT --certificate=$PRIV \
611 $ hg serve -p $HGPORT --certificate=$PRIV \
617 > --config devel.servercafile=/missing/cafile --config devel.serverrequirecert=true
612 > --config devel.servercafile=/missing/cafile --config devel.serverrequirecert=true
618 abort: referenced certificate file (*/missing/cafile) does not exist (glob)
613 abort: referenced certificate file (*/missing/cafile) does not exist (glob)
619 [255]
614 [255]
620
615
621 Start hgweb that requires client certificates:
616 Start hgweb that requires client certificates:
622
617
623 $ hg serve -p $HGPORT -d --pid-file=../hg0.pid --certificate=$PRIV \
618 $ hg serve -p $HGPORT -d --pid-file=../hg0.pid --certificate=$PRIV \
624 > --config devel.servercafile=$PRIV --config devel.serverrequirecert=true
619 > --config devel.servercafile=$PRIV --config devel.serverrequirecert=true
625 $ cat ../hg0.pid >> $DAEMON_PIDS
620 $ cat ../hg0.pid >> $DAEMON_PIDS
626 $ cd ..
621 $ cd ..
627
622
628 without client certificate:
623 without client certificate:
629
624
630 $ P="$CERTSDIR" hg id https://localhost:$HGPORT/
625 $ P="$CERTSDIR" hg id https://localhost:$HGPORT/
631 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
626 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
632 abort: error: *handshake failure* (glob)
627 abort: error: *handshake failure* (glob)
633 [255]
628 [255]
634
629
635 with client certificate:
630 with client certificate:
636
631
637 $ cat << EOT >> $HGRCPATH
632 $ cat << EOT >> $HGRCPATH
638 > [auth]
633 > [auth]
639 > l.prefix = localhost
634 > l.prefix = localhost
640 > l.cert = $CERTSDIR/client-cert.pem
635 > l.cert = $CERTSDIR/client-cert.pem
641 > l.key = $CERTSDIR/client-key.pem
636 > l.key = $CERTSDIR/client-key.pem
642 > EOT
637 > EOT
643
638
644 $ P="$CERTSDIR" hg id https://localhost:$HGPORT/ \
639 $ P="$CERTSDIR" hg id https://localhost:$HGPORT/ \
645 > --config auth.l.key="$CERTSDIR/client-key-decrypted.pem"
640 > --config auth.l.key="$CERTSDIR/client-key-decrypted.pem"
646 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
641 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
647 5fed3813f7f5
642 5fed3813f7f5
648
643
649 $ printf '1234\n' | env P="$CERTSDIR" hg id https://localhost:$HGPORT/ \
644 $ printf '1234\n' | env P="$CERTSDIR" hg id https://localhost:$HGPORT/ \
650 > --config ui.interactive=True --config ui.nontty=True
645 > --config ui.interactive=True --config ui.nontty=True
651 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
646 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
652 passphrase for */client-key.pem: 5fed3813f7f5 (glob)
647 passphrase for */client-key.pem: 5fed3813f7f5 (glob)
653
648
654 $ env P="$CERTSDIR" hg id https://localhost:$HGPORT/
649 $ env P="$CERTSDIR" hg id https://localhost:$HGPORT/
655 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
650 warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?)
656 abort: error: * (glob)
651 abort: error: * (glob)
657 [255]
652 [255]
658
653
659 Missing certficate and key files result in error
654 Missing certficate and key files result in error
660
655
661 $ hg id https://localhost:$HGPORT/ --config auth.l.cert=/missing/cert
656 $ hg id https://localhost:$HGPORT/ --config auth.l.cert=/missing/cert
662 abort: certificate file (*/missing/cert) does not exist; cannot connect to localhost (glob)
657 abort: certificate file (*/missing/cert) does not exist; cannot connect to localhost (glob)
663 (restore missing file or fix references in Mercurial config)
658 (restore missing file or fix references in Mercurial config)
664 [255]
659 [255]
665
660
666 $ hg id https://localhost:$HGPORT/ --config auth.l.key=/missing/key
661 $ hg id https://localhost:$HGPORT/ --config auth.l.key=/missing/key
667 abort: certificate file (*/missing/key) does not exist; cannot connect to localhost (glob)
662 abort: certificate file (*/missing/key) does not exist; cannot connect to localhost (glob)
668 (restore missing file or fix references in Mercurial config)
663 (restore missing file or fix references in Mercurial config)
669 [255]
664 [255]
670
665
671 #endif
666 #endif
General Comments 0
You need to be logged in to leave comments. Login now