Show More
@@ -1,347 +1,364 | |||
|
1 | 1 | #require serve |
|
2 | 2 | |
|
3 | 3 | This test is a duplicate of 'test-http.t', feel free to factor out |
|
4 | 4 | parts that are not bundle1/bundle2 specific. |
|
5 | 5 | |
|
6 | 6 | $ cat << EOF >> $HGRCPATH |
|
7 | 7 | > [devel] |
|
8 | 8 | > # This test is dedicated to interaction through old bundle |
|
9 | 9 | > legacy.exchange = bundle1 |
|
10 | 10 | > EOF |
|
11 | 11 | |
|
12 | 12 | $ hg init test |
|
13 | 13 | $ cd test |
|
14 | 14 | $ echo foo>foo |
|
15 | 15 | $ mkdir foo.d foo.d/bAr.hg.d foo.d/baR.d.hg |
|
16 | 16 | $ echo foo>foo.d/foo |
|
17 | 17 | $ echo bar>foo.d/bAr.hg.d/BaR |
|
18 | 18 | $ echo bar>foo.d/baR.d.hg/bAR |
|
19 | 19 | $ hg commit -A -m 1 |
|
20 | 20 | adding foo |
|
21 | 21 | adding foo.d/bAr.hg.d/BaR |
|
22 | 22 | adding foo.d/baR.d.hg/bAR |
|
23 | 23 | adding foo.d/foo |
|
24 | 24 | $ hg serve -p $HGPORT -d --pid-file=../hg1.pid -E ../error.log |
|
25 | 25 | $ hg serve --config server.uncompressed=False -p $HGPORT1 -d --pid-file=../hg2.pid |
|
26 | 26 | |
|
27 | 27 | Test server address cannot be reused |
|
28 | 28 | |
|
29 | 29 | #if windows |
|
30 | 30 | $ hg serve -p $HGPORT1 2>&1 |
|
31 | 31 | abort: cannot start server at 'localhost:$HGPORT1': * (glob) |
|
32 | 32 | [255] |
|
33 | 33 | #else |
|
34 | 34 | $ hg serve -p $HGPORT1 2>&1 |
|
35 | 35 | abort: cannot start server at 'localhost:$HGPORT1': Address already in use |
|
36 | 36 | [255] |
|
37 | 37 | #endif |
|
38 | 38 | $ cd .. |
|
39 | 39 | $ cat hg1.pid hg2.pid >> $DAEMON_PIDS |
|
40 | 40 | |
|
41 | 41 | clone via stream |
|
42 | 42 | |
|
43 | 43 | $ hg clone --uncompressed http://localhost:$HGPORT/ copy 2>&1 |
|
44 | 44 | streaming all changes |
|
45 | 45 | 6 files to transfer, 606 bytes of data |
|
46 | 46 | transferred * bytes in * seconds (*/sec) (glob) |
|
47 | 47 | searching for changes |
|
48 | 48 | no changes found |
|
49 | 49 | updating to branch default |
|
50 | 50 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
51 | 51 | $ hg verify -R copy |
|
52 | 52 | checking changesets |
|
53 | 53 | checking manifests |
|
54 | 54 | crosschecking files in changesets and manifests |
|
55 | 55 | checking files |
|
56 | 56 | 4 files, 1 changesets, 4 total revisions |
|
57 | 57 | |
|
58 | 58 | try to clone via stream, should use pull instead |
|
59 | 59 | |
|
60 | 60 | $ hg clone --uncompressed http://localhost:$HGPORT1/ copy2 |
|
61 | 61 | requesting all changes |
|
62 | 62 | adding changesets |
|
63 | 63 | adding manifests |
|
64 | 64 | adding file changes |
|
65 | 65 | added 1 changesets with 4 changes to 4 files |
|
66 | 66 | updating to branch default |
|
67 | 67 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
68 | 68 | |
|
69 | try to clone via stream but missing requirements, so should use pull instead | |
|
70 | ||
|
71 | $ cat > $TESTTMP/removesupportedformat.py << EOF | |
|
72 | > from mercurial import localrepo | |
|
73 | > def extsetup(ui): | |
|
74 | > localrepo.localrepository.supportedformats.remove('generaldelta') | |
|
75 | > EOF | |
|
76 | ||
|
77 | $ hg clone --config extensions.rsf=$TESTTMP/removesupportedformat.py --uncompressed http://localhost:$HGPORT/ copy3 | |
|
78 | requesting all changes | |
|
79 | adding changesets | |
|
80 | adding manifests | |
|
81 | adding file changes | |
|
82 | added 1 changesets with 4 changes to 4 files | |
|
83 | updating to branch default | |
|
84 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
85 | ||
|
69 | 86 | clone via pull |
|
70 | 87 | |
|
71 | 88 | $ hg clone http://localhost:$HGPORT1/ copy-pull |
|
72 | 89 | requesting all changes |
|
73 | 90 | adding changesets |
|
74 | 91 | adding manifests |
|
75 | 92 | adding file changes |
|
76 | 93 | added 1 changesets with 4 changes to 4 files |
|
77 | 94 | updating to branch default |
|
78 | 95 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
79 | 96 | $ hg verify -R copy-pull |
|
80 | 97 | checking changesets |
|
81 | 98 | checking manifests |
|
82 | 99 | crosschecking files in changesets and manifests |
|
83 | 100 | checking files |
|
84 | 101 | 4 files, 1 changesets, 4 total revisions |
|
85 | 102 | $ cd test |
|
86 | 103 | $ echo bar > bar |
|
87 | 104 | $ hg commit -A -d '1 0' -m 2 |
|
88 | 105 | adding bar |
|
89 | 106 | $ cd .. |
|
90 | 107 | |
|
91 | 108 | clone over http with --update |
|
92 | 109 | |
|
93 | 110 | $ hg clone http://localhost:$HGPORT1/ updated --update 0 |
|
94 | 111 | requesting all changes |
|
95 | 112 | adding changesets |
|
96 | 113 | adding manifests |
|
97 | 114 | adding file changes |
|
98 | 115 | added 2 changesets with 5 changes to 5 files |
|
99 | 116 | updating to branch default |
|
100 | 117 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
101 | 118 | $ hg log -r . -R updated |
|
102 | 119 | changeset: 0:8b6053c928fe |
|
103 | 120 | user: test |
|
104 | 121 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
105 | 122 | summary: 1 |
|
106 | 123 | |
|
107 | 124 | $ rm -rf updated |
|
108 | 125 | |
|
109 | 126 | incoming via HTTP |
|
110 | 127 | |
|
111 | 128 | $ hg clone http://localhost:$HGPORT1/ --rev 0 partial |
|
112 | 129 | adding changesets |
|
113 | 130 | adding manifests |
|
114 | 131 | adding file changes |
|
115 | 132 | added 1 changesets with 4 changes to 4 files |
|
116 | 133 | updating to branch default |
|
117 | 134 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
118 | 135 | $ cd partial |
|
119 | 136 | $ touch LOCAL |
|
120 | 137 | $ hg ci -qAm LOCAL |
|
121 | 138 | $ hg incoming http://localhost:$HGPORT1/ --template '{desc}\n' |
|
122 | 139 | comparing with http://localhost:$HGPORT1/ |
|
123 | 140 | searching for changes |
|
124 | 141 | 2 |
|
125 | 142 | $ cd .. |
|
126 | 143 | |
|
127 | 144 | pull |
|
128 | 145 | |
|
129 | 146 | $ cd copy-pull |
|
130 | 147 | $ cat >> .hg/hgrc <<EOF |
|
131 | 148 | > [hooks] |
|
132 | 149 | > changegroup = sh -c "printenv.py changegroup" |
|
133 | 150 | > EOF |
|
134 | 151 | $ hg pull |
|
135 | 152 | pulling from http://localhost:$HGPORT1/ |
|
136 | 153 | searching for changes |
|
137 | 154 | adding changesets |
|
138 | 155 | adding manifests |
|
139 | 156 | adding file changes |
|
140 | 157 | added 1 changesets with 1 changes to 1 files |
|
141 | 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/ |
|
142 | 159 | (run 'hg update' to get a working copy) |
|
143 | 160 | $ cd .. |
|
144 | 161 | |
|
145 | 162 | clone from invalid URL |
|
146 | 163 | |
|
147 | 164 | $ hg clone http://localhost:$HGPORT/bad |
|
148 | 165 | abort: HTTP Error 404: Not Found |
|
149 | 166 | [255] |
|
150 | 167 | |
|
151 | 168 | test http authentication |
|
152 | 169 | + use the same server to test server side streaming preference |
|
153 | 170 | |
|
154 | 171 | $ cd test |
|
155 | 172 | $ cat << EOT > userpass.py |
|
156 | 173 | > import base64 |
|
157 | 174 | > from mercurial.hgweb import common |
|
158 | 175 | > def perform_authentication(hgweb, req, op): |
|
159 | 176 | > auth = req.env.get('HTTP_AUTHORIZATION') |
|
160 | 177 | > if not auth: |
|
161 | 178 | > raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, 'who', |
|
162 | 179 | > [('WWW-Authenticate', 'Basic Realm="mercurial"')]) |
|
163 | 180 | > if base64.b64decode(auth.split()[1]).split(':', 1) != ['user', 'pass']: |
|
164 | 181 | > raise common.ErrorResponse(common.HTTP_FORBIDDEN, 'no') |
|
165 | 182 | > def extsetup(): |
|
166 | 183 | > common.permhooks.insert(0, perform_authentication) |
|
167 | 184 | > EOT |
|
168 | 185 | $ hg serve --config extensions.x=userpass.py -p $HGPORT2 -d --pid-file=pid \ |
|
169 | 186 | > --config server.preferuncompressed=True \ |
|
170 | 187 | > --config web.push_ssl=False --config web.allow_push=* -A ../access.log |
|
171 | 188 | $ cat pid >> $DAEMON_PIDS |
|
172 | 189 | |
|
173 | 190 | $ cat << EOF > get_pass.py |
|
174 | 191 | > import getpass |
|
175 | 192 | > def newgetpass(arg): |
|
176 | 193 | > return "pass" |
|
177 | 194 | > getpass.getpass = newgetpass |
|
178 | 195 | > EOF |
|
179 | 196 | |
|
180 | 197 | $ hg id http://localhost:$HGPORT2/ |
|
181 | 198 | abort: http authorization required for http://localhost:$HGPORT2/ |
|
182 | 199 | [255] |
|
183 | 200 | $ hg id http://localhost:$HGPORT2/ |
|
184 | 201 | abort: http authorization required for http://localhost:$HGPORT2/ |
|
185 | 202 | [255] |
|
186 | 203 | $ hg id --config ui.interactive=true --config extensions.getpass=get_pass.py http://user@localhost:$HGPORT2/ |
|
187 | 204 | http authorization required for http://localhost:$HGPORT2/ |
|
188 | 205 | realm: mercurial |
|
189 | 206 | user: user |
|
190 | 207 | password: 5fed3813f7f5 |
|
191 | 208 | $ hg id http://user:pass@localhost:$HGPORT2/ |
|
192 | 209 | 5fed3813f7f5 |
|
193 | 210 | $ echo '[auth]' >> .hg/hgrc |
|
194 | 211 | $ echo 'l.schemes=http' >> .hg/hgrc |
|
195 | 212 | $ echo 'l.prefix=lo' >> .hg/hgrc |
|
196 | 213 | $ echo 'l.username=user' >> .hg/hgrc |
|
197 | 214 | $ echo 'l.password=pass' >> .hg/hgrc |
|
198 | 215 | $ hg id http://localhost:$HGPORT2/ |
|
199 | 216 | 5fed3813f7f5 |
|
200 | 217 | $ hg id http://localhost:$HGPORT2/ |
|
201 | 218 | 5fed3813f7f5 |
|
202 | 219 | $ hg id http://user@localhost:$HGPORT2/ |
|
203 | 220 | 5fed3813f7f5 |
|
204 | 221 | $ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1 |
|
205 | 222 | streaming all changes |
|
206 | 223 | 7 files to transfer, 916 bytes of data |
|
207 | 224 | transferred * bytes in * seconds (*/sec) (glob) |
|
208 | 225 | searching for changes |
|
209 | 226 | no changes found |
|
210 | 227 | updating to branch default |
|
211 | 228 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
212 | 229 | --pull should override server's preferuncompressed |
|
213 | 230 | $ hg clone --pull http://user:pass@localhost:$HGPORT2/ dest-pull 2>&1 |
|
214 | 231 | requesting all changes |
|
215 | 232 | adding changesets |
|
216 | 233 | adding manifests |
|
217 | 234 | adding file changes |
|
218 | 235 | added 2 changesets with 5 changes to 5 files |
|
219 | 236 | updating to branch default |
|
220 | 237 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
221 | 238 | |
|
222 | 239 | $ hg id http://user2@localhost:$HGPORT2/ |
|
223 | 240 | abort: http authorization required for http://localhost:$HGPORT2/ |
|
224 | 241 | [255] |
|
225 | 242 | $ hg id http://user:pass2@localhost:$HGPORT2/ |
|
226 | 243 | abort: HTTP Error 403: no |
|
227 | 244 | [255] |
|
228 | 245 | |
|
229 | 246 | $ hg -R dest tag -r tip top |
|
230 | 247 | $ hg -R dest push http://user:pass@localhost:$HGPORT2/ |
|
231 | 248 | pushing to http://user:***@localhost:$HGPORT2/ |
|
232 | 249 | searching for changes |
|
233 | 250 | remote: adding changesets |
|
234 | 251 | remote: adding manifests |
|
235 | 252 | remote: adding file changes |
|
236 | 253 | remote: added 1 changesets with 1 changes to 1 files |
|
237 | 254 | $ hg rollback -q |
|
238 | 255 | |
|
239 | 256 | $ sed 's/.*] "/"/' < ../access.log |
|
240 | 257 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
241 | 258 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
242 | 259 | "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
243 | 260 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
244 | 261 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
245 | 262 | "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
246 | 263 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
247 | 264 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
248 | 265 | "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
249 | 266 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
250 | 267 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
251 | 268 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
252 | 269 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
253 | 270 | "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
254 | 271 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
255 | 272 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
256 | 273 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
257 | 274 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
258 | 275 | "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
259 | 276 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
260 | 277 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
261 | 278 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
262 | 279 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
263 | 280 | "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
264 | 281 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
265 | 282 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
266 | 283 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
267 | 284 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
268 | 285 | "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
269 | 286 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
270 | 287 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
271 | 288 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
272 | 289 | "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
273 | 290 | "GET /?cmd=stream_out HTTP/1.1" 401 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
274 | 291 | "GET /?cmd=stream_out HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
275 | 292 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
276 | 293 | "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D5fed3813f7f5e1824344fdc9cf8f63bb662c292d x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
277 | 294 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
278 | 295 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
279 | 296 | "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
280 | 297 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
281 | 298 | "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
282 | 299 | "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
283 | 300 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
284 | 301 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
285 | 302 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
286 | 303 | "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
287 | 304 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
288 | 305 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
289 | 306 | "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
290 | 307 | "GET /?cmd=listkeys HTTP/1.1" 403 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
291 | 308 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
292 | 309 | "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D7f4e523d01f2cc3765ac8934da3d14db775ff872 x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
293 | 310 | "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
294 | 311 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
295 | 312 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
296 | 313 | "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
297 | 314 | "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
298 | 315 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
299 | 316 | "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=686173686564+5eb5abfefeea63c80dd7553bcc3783f37e0c5524* (glob) |
|
300 | 317 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
301 | 318 | |
|
302 | 319 | $ cd .. |
|
303 | 320 | |
|
304 | 321 | clone of serve with repo in root and unserved subrepo (issue2970) |
|
305 | 322 | |
|
306 | 323 | $ hg --cwd test init sub |
|
307 | 324 | $ echo empty > test/sub/empty |
|
308 | 325 | $ hg --cwd test/sub add empty |
|
309 | 326 | $ hg --cwd test/sub commit -qm 'add empty' |
|
310 | 327 | $ hg --cwd test/sub tag -r 0 something |
|
311 | 328 | $ echo sub = sub > test/.hgsub |
|
312 | 329 | $ hg --cwd test add .hgsub |
|
313 | 330 | $ hg --cwd test commit -qm 'add subrepo' |
|
314 | 331 | $ hg clone http://localhost:$HGPORT noslash-clone |
|
315 | 332 | requesting all changes |
|
316 | 333 | adding changesets |
|
317 | 334 | adding manifests |
|
318 | 335 | adding file changes |
|
319 | 336 | added 3 changesets with 7 changes to 7 files |
|
320 | 337 | updating to branch default |
|
321 | 338 | abort: HTTP Error 404: Not Found |
|
322 | 339 | [255] |
|
323 | 340 | $ hg clone http://localhost:$HGPORT/ slash-clone |
|
324 | 341 | requesting all changes |
|
325 | 342 | adding changesets |
|
326 | 343 | adding manifests |
|
327 | 344 | adding file changes |
|
328 | 345 | added 3 changesets with 7 changes to 7 files |
|
329 | 346 | updating to branch default |
|
330 | 347 | abort: HTTP Error 404: Not Found |
|
331 | 348 | [255] |
|
332 | 349 | |
|
333 | 350 | check error log |
|
334 | 351 | |
|
335 | 352 | $ cat error.log |
|
336 | 353 | |
|
337 | 354 | Check error reporting while pulling/cloning |
|
338 | 355 | |
|
339 | 356 | $ $RUNTESTDIR/killdaemons.py |
|
340 | 357 | $ hg -R test serve -p $HGPORT -d --pid-file=hg3.pid -E error.log --config extensions.crash=${TESTDIR}/crashgetbundler.py |
|
341 | 358 | $ cat hg3.pid >> $DAEMON_PIDS |
|
342 | 359 | $ hg clone http://localhost:$HGPORT/ abort-clone |
|
343 | 360 | requesting all changes |
|
344 | 361 | abort: remote error: |
|
345 | 362 | this is an exercise |
|
346 | 363 | [255] |
|
347 | 364 | $ cat error.log |
@@ -1,396 +1,413 | |||
|
1 | 1 | #require killdaemons serve |
|
2 | 2 | |
|
3 | 3 | $ hg init test |
|
4 | 4 | $ cd test |
|
5 | 5 | $ echo foo>foo |
|
6 | 6 | $ mkdir foo.d foo.d/bAr.hg.d foo.d/baR.d.hg |
|
7 | 7 | $ echo foo>foo.d/foo |
|
8 | 8 | $ echo bar>foo.d/bAr.hg.d/BaR |
|
9 | 9 | $ echo bar>foo.d/baR.d.hg/bAR |
|
10 | 10 | $ hg commit -A -m 1 |
|
11 | 11 | adding foo |
|
12 | 12 | adding foo.d/bAr.hg.d/BaR |
|
13 | 13 | adding foo.d/baR.d.hg/bAR |
|
14 | 14 | adding foo.d/foo |
|
15 | 15 | $ hg serve -p $HGPORT -d --pid-file=../hg1.pid -E ../error.log |
|
16 | 16 | $ hg serve --config server.uncompressed=False -p $HGPORT1 -d --pid-file=../hg2.pid |
|
17 | 17 | |
|
18 | 18 | Test server address cannot be reused |
|
19 | 19 | |
|
20 | 20 | #if windows |
|
21 | 21 | $ hg serve -p $HGPORT1 2>&1 |
|
22 | 22 | abort: cannot start server at 'localhost:$HGPORT1': * (glob) |
|
23 | 23 | [255] |
|
24 | 24 | #else |
|
25 | 25 | $ hg serve -p $HGPORT1 2>&1 |
|
26 | 26 | abort: cannot start server at 'localhost:$HGPORT1': Address already in use |
|
27 | 27 | [255] |
|
28 | 28 | #endif |
|
29 | 29 | $ cd .. |
|
30 | 30 | $ cat hg1.pid hg2.pid >> $DAEMON_PIDS |
|
31 | 31 | |
|
32 | 32 | clone via stream |
|
33 | 33 | |
|
34 | 34 | $ hg clone --uncompressed http://localhost:$HGPORT/ copy 2>&1 |
|
35 | 35 | streaming all changes |
|
36 | 36 | 6 files to transfer, 606 bytes of data |
|
37 | 37 | transferred * bytes in * seconds (*/sec) (glob) |
|
38 | 38 | searching for changes |
|
39 | 39 | no changes found |
|
40 | 40 | updating to branch default |
|
41 | 41 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
42 | 42 | $ hg verify -R copy |
|
43 | 43 | checking changesets |
|
44 | 44 | checking manifests |
|
45 | 45 | crosschecking files in changesets and manifests |
|
46 | 46 | checking files |
|
47 | 47 | 4 files, 1 changesets, 4 total revisions |
|
48 | 48 | |
|
49 | 49 | try to clone via stream, should use pull instead |
|
50 | 50 | |
|
51 | 51 | $ hg clone --uncompressed http://localhost:$HGPORT1/ copy2 |
|
52 | 52 | requesting all changes |
|
53 | 53 | adding changesets |
|
54 | 54 | adding manifests |
|
55 | 55 | adding file changes |
|
56 | 56 | added 1 changesets with 4 changes to 4 files |
|
57 | 57 | updating to branch default |
|
58 | 58 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
59 | 59 | |
|
60 | try to clone via stream but missing requirements, so should use pull instead | |
|
61 | ||
|
62 | $ cat > $TESTTMP/removesupportedformat.py << EOF | |
|
63 | > from mercurial import localrepo | |
|
64 | > def extsetup(ui): | |
|
65 | > localrepo.localrepository.supportedformats.remove('generaldelta') | |
|
66 | > EOF | |
|
67 | ||
|
68 | $ hg clone --config extensions.rsf=$TESTTMP/removesupportedformat.py --uncompressed http://localhost:$HGPORT/ copy3 | |
|
69 | requesting all changes | |
|
70 | adding changesets | |
|
71 | adding manifests | |
|
72 | adding file changes | |
|
73 | added 1 changesets with 4 changes to 4 files | |
|
74 | updating to branch default | |
|
75 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
76 | ||
|
60 | 77 | clone via pull |
|
61 | 78 | |
|
62 | 79 | $ hg clone http://localhost:$HGPORT1/ copy-pull |
|
63 | 80 | requesting all changes |
|
64 | 81 | adding changesets |
|
65 | 82 | adding manifests |
|
66 | 83 | adding file changes |
|
67 | 84 | added 1 changesets with 4 changes to 4 files |
|
68 | 85 | updating to branch default |
|
69 | 86 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
70 | 87 | $ hg verify -R copy-pull |
|
71 | 88 | checking changesets |
|
72 | 89 | checking manifests |
|
73 | 90 | crosschecking files in changesets and manifests |
|
74 | 91 | checking files |
|
75 | 92 | 4 files, 1 changesets, 4 total revisions |
|
76 | 93 | $ cd test |
|
77 | 94 | $ echo bar > bar |
|
78 | 95 | $ hg commit -A -d '1 0' -m 2 |
|
79 | 96 | adding bar |
|
80 | 97 | $ cd .. |
|
81 | 98 | |
|
82 | 99 | clone over http with --update |
|
83 | 100 | |
|
84 | 101 | $ hg clone http://localhost:$HGPORT1/ updated --update 0 |
|
85 | 102 | requesting all changes |
|
86 | 103 | adding changesets |
|
87 | 104 | adding manifests |
|
88 | 105 | adding file changes |
|
89 | 106 | added 2 changesets with 5 changes to 5 files |
|
90 | 107 | updating to branch default |
|
91 | 108 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
92 | 109 | $ hg log -r . -R updated |
|
93 | 110 | changeset: 0:8b6053c928fe |
|
94 | 111 | user: test |
|
95 | 112 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
96 | 113 | summary: 1 |
|
97 | 114 | |
|
98 | 115 | $ rm -rf updated |
|
99 | 116 | |
|
100 | 117 | incoming via HTTP |
|
101 | 118 | |
|
102 | 119 | $ hg clone http://localhost:$HGPORT1/ --rev 0 partial |
|
103 | 120 | adding changesets |
|
104 | 121 | adding manifests |
|
105 | 122 | adding file changes |
|
106 | 123 | added 1 changesets with 4 changes to 4 files |
|
107 | 124 | updating to branch default |
|
108 | 125 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
109 | 126 | $ cd partial |
|
110 | 127 | $ touch LOCAL |
|
111 | 128 | $ hg ci -qAm LOCAL |
|
112 | 129 | $ hg incoming http://localhost:$HGPORT1/ --template '{desc}\n' |
|
113 | 130 | comparing with http://localhost:$HGPORT1/ |
|
114 | 131 | searching for changes |
|
115 | 132 | 2 |
|
116 | 133 | $ cd .. |
|
117 | 134 | |
|
118 | 135 | pull |
|
119 | 136 | |
|
120 | 137 | $ cd copy-pull |
|
121 | 138 | $ cat >> .hg/hgrc <<EOF |
|
122 | 139 | > [hooks] |
|
123 | 140 | > changegroup = sh -c "printenv.py changegroup" |
|
124 | 141 | > EOF |
|
125 | 142 | $ hg pull |
|
126 | 143 | pulling from http://localhost:$HGPORT1/ |
|
127 | 144 | searching for changes |
|
128 | 145 | adding changesets |
|
129 | 146 | adding manifests |
|
130 | 147 | adding file changes |
|
131 | 148 | added 1 changesets with 1 changes to 1 files |
|
132 | 149 | 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/ |
|
133 | 150 | (run 'hg update' to get a working copy) |
|
134 | 151 | $ cd .. |
|
135 | 152 | |
|
136 | 153 | clone from invalid URL |
|
137 | 154 | |
|
138 | 155 | $ hg clone http://localhost:$HGPORT/bad |
|
139 | 156 | abort: HTTP Error 404: Not Found |
|
140 | 157 | [255] |
|
141 | 158 | |
|
142 | 159 | test http authentication |
|
143 | 160 | + use the same server to test server side streaming preference |
|
144 | 161 | |
|
145 | 162 | $ cd test |
|
146 | 163 | $ cat << EOT > userpass.py |
|
147 | 164 | > import base64 |
|
148 | 165 | > from mercurial.hgweb import common |
|
149 | 166 | > def perform_authentication(hgweb, req, op): |
|
150 | 167 | > auth = req.env.get('HTTP_AUTHORIZATION') |
|
151 | 168 | > if not auth: |
|
152 | 169 | > raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, 'who', |
|
153 | 170 | > [('WWW-Authenticate', 'Basic Realm="mercurial"')]) |
|
154 | 171 | > if base64.b64decode(auth.split()[1]).split(':', 1) != ['user', 'pass']: |
|
155 | 172 | > raise common.ErrorResponse(common.HTTP_FORBIDDEN, 'no') |
|
156 | 173 | > def extsetup(): |
|
157 | 174 | > common.permhooks.insert(0, perform_authentication) |
|
158 | 175 | > EOT |
|
159 | 176 | $ hg serve --config extensions.x=userpass.py -p $HGPORT2 -d --pid-file=pid \ |
|
160 | 177 | > --config server.preferuncompressed=True \ |
|
161 | 178 | > --config web.push_ssl=False --config web.allow_push=* -A ../access.log |
|
162 | 179 | $ cat pid >> $DAEMON_PIDS |
|
163 | 180 | |
|
164 | 181 | $ cat << EOF > get_pass.py |
|
165 | 182 | > import getpass |
|
166 | 183 | > def newgetpass(arg): |
|
167 | 184 | > return "pass" |
|
168 | 185 | > getpass.getpass = newgetpass |
|
169 | 186 | > EOF |
|
170 | 187 | |
|
171 | 188 | $ hg id http://localhost:$HGPORT2/ |
|
172 | 189 | abort: http authorization required for http://localhost:$HGPORT2/ |
|
173 | 190 | [255] |
|
174 | 191 | $ hg id http://localhost:$HGPORT2/ |
|
175 | 192 | abort: http authorization required for http://localhost:$HGPORT2/ |
|
176 | 193 | [255] |
|
177 | 194 | $ hg id --config ui.interactive=true --config extensions.getpass=get_pass.py http://user@localhost:$HGPORT2/ |
|
178 | 195 | http authorization required for http://localhost:$HGPORT2/ |
|
179 | 196 | realm: mercurial |
|
180 | 197 | user: user |
|
181 | 198 | password: 5fed3813f7f5 |
|
182 | 199 | $ hg id http://user:pass@localhost:$HGPORT2/ |
|
183 | 200 | 5fed3813f7f5 |
|
184 | 201 | $ echo '[auth]' >> .hg/hgrc |
|
185 | 202 | $ echo 'l.schemes=http' >> .hg/hgrc |
|
186 | 203 | $ echo 'l.prefix=lo' >> .hg/hgrc |
|
187 | 204 | $ echo 'l.username=user' >> .hg/hgrc |
|
188 | 205 | $ echo 'l.password=pass' >> .hg/hgrc |
|
189 | 206 | $ hg id http://localhost:$HGPORT2/ |
|
190 | 207 | 5fed3813f7f5 |
|
191 | 208 | $ hg id http://localhost:$HGPORT2/ |
|
192 | 209 | 5fed3813f7f5 |
|
193 | 210 | $ hg id http://user@localhost:$HGPORT2/ |
|
194 | 211 | 5fed3813f7f5 |
|
195 | 212 | $ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1 |
|
196 | 213 | streaming all changes |
|
197 | 214 | 7 files to transfer, 916 bytes of data |
|
198 | 215 | transferred * bytes in * seconds (*/sec) (glob) |
|
199 | 216 | searching for changes |
|
200 | 217 | no changes found |
|
201 | 218 | updating to branch default |
|
202 | 219 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
203 | 220 | --pull should override server's preferuncompressed |
|
204 | 221 | $ hg clone --pull http://user:pass@localhost:$HGPORT2/ dest-pull 2>&1 |
|
205 | 222 | requesting all changes |
|
206 | 223 | adding changesets |
|
207 | 224 | adding manifests |
|
208 | 225 | adding file changes |
|
209 | 226 | added 2 changesets with 5 changes to 5 files |
|
210 | 227 | updating to branch default |
|
211 | 228 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
212 | 229 | |
|
213 | 230 | $ hg id http://user2@localhost:$HGPORT2/ |
|
214 | 231 | abort: http authorization required for http://localhost:$HGPORT2/ |
|
215 | 232 | [255] |
|
216 | 233 | $ hg id http://user:pass2@localhost:$HGPORT2/ |
|
217 | 234 | abort: HTTP Error 403: no |
|
218 | 235 | [255] |
|
219 | 236 | |
|
220 | 237 | $ hg -R dest tag -r tip top |
|
221 | 238 | $ hg -R dest push http://user:pass@localhost:$HGPORT2/ |
|
222 | 239 | pushing to http://user:***@localhost:$HGPORT2/ |
|
223 | 240 | searching for changes |
|
224 | 241 | remote: adding changesets |
|
225 | 242 | remote: adding manifests |
|
226 | 243 | remote: adding file changes |
|
227 | 244 | remote: added 1 changesets with 1 changes to 1 files |
|
228 | 245 | $ hg rollback -q |
|
229 | 246 | |
|
230 | 247 | $ sed 's/.*] "/"/' < ../access.log |
|
231 | 248 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
232 | 249 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
233 | 250 | "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
234 | 251 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
235 | 252 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
236 | 253 | "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
237 | 254 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
238 | 255 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
239 | 256 | "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
240 | 257 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
241 | 258 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
242 | 259 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
243 | 260 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
244 | 261 | "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
245 | 262 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
246 | 263 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
247 | 264 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
248 | 265 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
249 | 266 | "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
250 | 267 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
251 | 268 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
252 | 269 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
253 | 270 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
254 | 271 | "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
255 | 272 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
256 | 273 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
257 | 274 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
258 | 275 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
259 | 276 | "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
260 | 277 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
261 | 278 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
262 | 279 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
263 | 280 | "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
264 | 281 | "GET /?cmd=stream_out HTTP/1.1" 401 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
265 | 282 | "GET /?cmd=stream_out HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
266 | 283 | "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D5fed3813f7f5e1824344fdc9cf8f63bb662c292d x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
267 | 284 | "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=0&common=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=phases%2Cbookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
268 | 285 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
269 | 286 | "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
270 | 287 | "GET /?cmd=getbundle HTTP/1.1" 401 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=phases%2Cbookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
271 | 288 | "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=phases%2Cbookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
272 | 289 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
273 | 290 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
274 | 291 | "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
275 | 292 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
276 | 293 | "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
277 | 294 | "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
278 | 295 | "GET /?cmd=listkeys HTTP/1.1" 403 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
279 | 296 | "GET /?cmd=capabilities HTTP/1.1" 200 - |
|
280 | 297 | "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D7f4e523d01f2cc3765ac8934da3d14db775ff872 x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
281 | 298 | "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
282 | 299 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
283 | 300 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
284 | 301 | "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
285 | 302 | "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
286 | 303 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
287 | 304 | "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=666f726365* (glob) |
|
288 | 305 | "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob) |
|
289 | 306 | |
|
290 | 307 | $ cd .. |
|
291 | 308 | |
|
292 | 309 | clone of serve with repo in root and unserved subrepo (issue2970) |
|
293 | 310 | |
|
294 | 311 | $ hg --cwd test init sub |
|
295 | 312 | $ echo empty > test/sub/empty |
|
296 | 313 | $ hg --cwd test/sub add empty |
|
297 | 314 | $ hg --cwd test/sub commit -qm 'add empty' |
|
298 | 315 | $ hg --cwd test/sub tag -r 0 something |
|
299 | 316 | $ echo sub = sub > test/.hgsub |
|
300 | 317 | $ hg --cwd test add .hgsub |
|
301 | 318 | $ hg --cwd test commit -qm 'add subrepo' |
|
302 | 319 | $ hg clone http://localhost:$HGPORT noslash-clone |
|
303 | 320 | requesting all changes |
|
304 | 321 | adding changesets |
|
305 | 322 | adding manifests |
|
306 | 323 | adding file changes |
|
307 | 324 | added 3 changesets with 7 changes to 7 files |
|
308 | 325 | updating to branch default |
|
309 | 326 | abort: HTTP Error 404: Not Found |
|
310 | 327 | [255] |
|
311 | 328 | $ hg clone http://localhost:$HGPORT/ slash-clone |
|
312 | 329 | requesting all changes |
|
313 | 330 | adding changesets |
|
314 | 331 | adding manifests |
|
315 | 332 | adding file changes |
|
316 | 333 | added 3 changesets with 7 changes to 7 files |
|
317 | 334 | updating to branch default |
|
318 | 335 | abort: HTTP Error 404: Not Found |
|
319 | 336 | [255] |
|
320 | 337 | |
|
321 | 338 | check error log |
|
322 | 339 | |
|
323 | 340 | $ cat error.log |
|
324 | 341 | |
|
325 | 342 | check abort error reporting while pulling/cloning |
|
326 | 343 | |
|
327 | 344 | $ $RUNTESTDIR/killdaemons.py |
|
328 | 345 | $ hg -R test serve -p $HGPORT -d --pid-file=hg3.pid -E error.log --config extensions.crash=${TESTDIR}/crashgetbundler.py |
|
329 | 346 | $ cat hg3.pid >> $DAEMON_PIDS |
|
330 | 347 | $ hg clone http://localhost:$HGPORT/ abort-clone |
|
331 | 348 | requesting all changes |
|
332 | 349 | remote: abort: this is an exercise |
|
333 | 350 | abort: pull failed on remote |
|
334 | 351 | [255] |
|
335 | 352 | $ cat error.log |
|
336 | 353 | |
|
337 | 354 | corrupt cookies file should yield a warning |
|
338 | 355 | |
|
339 | 356 | $ cat > $TESTTMP/cookies.txt << EOF |
|
340 | 357 | > bad format |
|
341 | 358 | > EOF |
|
342 | 359 | |
|
343 | 360 | $ hg --config auth.cookiefile=$TESTTMP/cookies.txt id http://localhost:$HGPORT/ |
|
344 | 361 | (error loading cookie file $TESTTMP/cookies.txt: '*/cookies.txt' does not look like a Netscape format cookies file; continuing without cookies) (glob) |
|
345 | 362 | 56f9bc90cce6 |
|
346 | 363 | |
|
347 | 364 | $ killdaemons.py |
|
348 | 365 | |
|
349 | 366 | Create dummy authentication handler that looks for cookies. It doesn't do anything |
|
350 | 367 | useful. It just raises an HTTP 500 with details about the Cookie request header. |
|
351 | 368 | We raise HTTP 500 because its message is printed in the abort message. |
|
352 | 369 | |
|
353 | 370 | $ cat > cookieauth.py << EOF |
|
354 | 371 | > from mercurial import util |
|
355 | 372 | > from mercurial.hgweb import common |
|
356 | 373 | > def perform_authentication(hgweb, req, op): |
|
357 | 374 | > cookie = req.env.get('HTTP_COOKIE') |
|
358 | 375 | > if not cookie: |
|
359 | 376 | > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, 'no-cookie') |
|
360 | 377 | > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, 'Cookie: %s' % cookie) |
|
361 | 378 | > def extsetup(): |
|
362 | 379 | > common.permhooks.insert(0, perform_authentication) |
|
363 | 380 | > EOF |
|
364 | 381 | |
|
365 | 382 | $ hg serve --config extensions.cookieauth=cookieauth.py -R test -p $HGPORT -d --pid-file=pid |
|
366 | 383 | $ cat pid > $DAEMON_PIDS |
|
367 | 384 | |
|
368 | 385 | Request without cookie sent should fail due to lack of cookie |
|
369 | 386 | |
|
370 | 387 | $ hg id http://localhost:$HGPORT |
|
371 | 388 | abort: HTTP Error 500: no-cookie |
|
372 | 389 | [255] |
|
373 | 390 | |
|
374 | 391 | Populate a cookies file |
|
375 | 392 | |
|
376 | 393 | $ cat > cookies.txt << EOF |
|
377 | 394 | > # HTTP Cookie File |
|
378 | 395 | > # Expiration is 2030-01-01 at midnight |
|
379 | 396 | > .example.com TRUE / FALSE 1893456000 hgkey examplevalue |
|
380 | 397 | > EOF |
|
381 | 398 | |
|
382 | 399 | Should not send a cookie for another domain |
|
383 | 400 | |
|
384 | 401 | $ hg --config auth.cookiefile=cookies.txt id http://localhost:$HGPORT/ |
|
385 | 402 | abort: HTTP Error 500: no-cookie |
|
386 | 403 | [255] |
|
387 | 404 | |
|
388 | 405 | Add a cookie entry for our test server and verify it is sent |
|
389 | 406 | |
|
390 | 407 | $ cat >> cookies.txt << EOF |
|
391 | 408 | > localhost.local FALSE / FALSE 1893456000 hgkey localhostvalue |
|
392 | 409 | > EOF |
|
393 | 410 | |
|
394 | 411 | $ hg --config auth.cookiefile=cookies.txt id http://localhost:$HGPORT/ |
|
395 | 412 | abort: HTTP Error 500: Cookie: hgkey=localhostvalue |
|
396 | 413 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now