Debian Codegraph @

tests/test-http-permissions.t

raw
1 $ cat > fakeremoteuser.py << EOF
2 > import os
3 > from mercurial.hgweb import hgweb_mod
4 > from mercurial import wireprotov1server
5 > class testenvhgweb(hgweb_mod.hgweb):
6 > def __call__(self, env, respond):
7 > # Allow REMOTE_USER to define authenticated user.
8 > if r'REMOTE_USER' in os.environ:
9 > env[r'REMOTE_USER'] = os.environ[r'REMOTE_USER']
10 > # Allow REQUEST_METHOD to override HTTP method
11 > if r'REQUEST_METHOD' in os.environ:
12 > env[r'REQUEST_METHOD'] = os.environ[r'REQUEST_METHOD']
13 > return super(testenvhgweb, self).__call__(env, respond)
14 > hgweb_mod.hgweb = testenvhgweb
15 >
16 > @wireprotov1server.wireprotocommand(b'customreadnoperm')
17 > def customread(repo, proto):
18 > return b'read-only command no defined permissions\n'
19 > @wireprotov1server.wireprotocommand(b'customwritenoperm')
20 > def customwritenoperm(repo, proto):
21 > return b'write command no defined permissions\n'
22 > @wireprotov1server.wireprotocommand(b'customreadwithperm', permission=b'pull')
23 > def customreadwithperm(repo, proto):
24 > return b'read-only command w/ defined permissions\n'
25 > @wireprotov1server.wireprotocommand(b'customwritewithperm', permission=b'push')
26 > def customwritewithperm(repo, proto):
27 > return b'write command w/ defined permissions\n'
28 > EOF
29
30 $ cat >> $HGRCPATH << EOF
31 > [extensions]
32 > fakeremoteuser = $TESTTMP/fakeremoteuser.py
33 > strip =
34 > EOF
35
36 $ hg init test
37 $ cd test
38 $ echo a > a
39 $ hg ci -Ama
40 adding a
41 $ cd ..
42 $ hg clone test test2
43 updating to branch default
44 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
45 $ cd test2
46 $ echo a >> a
47 $ hg ci -mb
48 $ hg book bm -r 0
49 $ cd ../test
50
51 web.deny_read=* prevents access to wire protocol for all users
52
53 $ cat > .hg/hgrc <<EOF
54 > [web]
55 > deny_read = *
56 > EOF
57
58 $ hg serve -p $HGPORT -d --pid-file hg.pid
59 $ cat hg.pid > $DAEMON_PIDS
60
61 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=capabilities'
62 401 read not authorized
63
64 0
65 read not authorized
66 [1]
67
68 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=stream_out'
69 401 read not authorized
70
71 0
72 read not authorized
73 [1]
74
75 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=listkeys' --requestheader 'x-hgarg-1=namespace=phases'
76 401 read not authorized
77
78 0
79 read not authorized
80 [1]
81
82 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=batch' --requestheader 'x-hgarg-1=cmds=listkeys+namespace%3Dphases'
83 401 read not authorized
84
85 0
86 read not authorized
87 [1]
88
89 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadnoperm'
90 401 read not authorized
91
92 0
93 read not authorized
94 [1]
95
96 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadwithperm'
97 401 read not authorized
98
99 0
100 read not authorized
101 [1]
102
103 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
104 401 read not authorized
105
106 0
107 read not authorized
108 [1]
109
110 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
111 401 read not authorized
112
113 0
114 read not authorized
115 [1]
116
117 $ hg --cwd ../test2 pull http://localhost:$HGPORT/
118 pulling from http://localhost:$HGPORT/
119 abort: authorization failed
120 [255]
121
122 $ killdaemons.py
123
124 web.deny_read=* with REMOTE_USER set still locks out clients
125
126 $ REMOTE_USER=authed_user hg serve -p $HGPORT -d --pid-file hg.pid
127 $ cat hg.pid > $DAEMON_PIDS
128
129 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=capabilities'
130 401 read not authorized
131
132 0
133 read not authorized
134 [1]
135
136 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=stream_out'
137 401 read not authorized
138
139 0
140 read not authorized
141 [1]
142
143 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=batch' --requestheader 'x-hgarg-1=cmds=listkeys+namespace%3Dphases'
144 401 read not authorized
145
146 0
147 read not authorized
148 [1]
149
150 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadnoperm'
151 401 read not authorized
152
153 0
154 read not authorized
155 [1]
156
157 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadwithperm'
158 401 read not authorized
159
160 0
161 read not authorized
162 [1]
163
164 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
165 401 read not authorized
166
167 0
168 read not authorized
169 [1]
170
171 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
172 401 read not authorized
173
174 0
175 read not authorized
176 [1]
177
178 $ hg --cwd ../test2 pull http://localhost:$HGPORT/
179 pulling from http://localhost:$HGPORT/
180 abort: authorization failed
181 [255]
182
183 $ killdaemons.py
184
185 web.deny_read=<user> denies access to unauthenticated user
186
187 $ cat > .hg/hgrc <<EOF
188 > [web]
189 > deny_read = baduser1,baduser2
190 > EOF
191
192 $ hg serve -p $HGPORT -d --pid-file hg.pid
193 $ cat hg.pid > $DAEMON_PIDS
194
195 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=listkeys' --requestheader 'x-hgarg-1=namespace=phases'
196 401 read not authorized
197
198 0
199 read not authorized
200 [1]
201
202 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=batch' --requestheader 'x-hgarg-1=cmds=listkeys+namespace%3Dphases'
203 401 read not authorized
204
205 0
206 read not authorized
207 [1]
208
209 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadnoperm'
210 401 read not authorized
211
212 0
213 read not authorized
214 [1]
215
216 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadwithperm'
217 401 read not authorized
218
219 0
220 read not authorized
221 [1]
222
223 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
224 401 read not authorized
225
226 0
227 read not authorized
228 [1]
229
230 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
231 401 read not authorized
232
233 0
234 read not authorized
235 [1]
236
237 $ hg --cwd ../test2 pull http://localhost:$HGPORT/
238 pulling from http://localhost:$HGPORT/
239 abort: authorization failed
240 [255]
241
242 $ killdaemons.py
243
244 web.deny_read=<user> denies access to users in deny list
245
246 $ REMOTE_USER=baduser2 hg serve -p $HGPORT -d --pid-file hg.pid
247 $ cat hg.pid > $DAEMON_PIDS
248
249 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=listkeys' --requestheader 'x-hgarg-1=namespace=phases'
250 401 read not authorized
251
252 0
253 read not authorized
254 [1]
255
256 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=batch' --requestheader 'x-hgarg-1=cmds=listkeys+namespace%3Dphases'
257 401 read not authorized
258
259 0
260 read not authorized
261 [1]
262
263 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadnoperm'
264 401 read not authorized
265
266 0
267 read not authorized
268 [1]
269
270 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadwithperm'
271 401 read not authorized
272
273 0
274 read not authorized
275 [1]
276
277 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
278 401 read not authorized
279
280 0
281 read not authorized
282 [1]
283
284 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
285 401 read not authorized
286
287 0
288 read not authorized
289 [1]
290
291 $ hg --cwd ../test2 pull http://localhost:$HGPORT/
292 pulling from http://localhost:$HGPORT/
293 abort: authorization failed
294 [255]
295
296 $ killdaemons.py
297
298 web.deny_read=<user> allows access to authenticated users not in list
299
300 $ REMOTE_USER=gooduser hg serve -p $HGPORT -d --pid-file hg.pid
301 $ cat hg.pid > $DAEMON_PIDS
302
303 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=listkeys' --requestheader 'x-hgarg-1=namespace=phases'
304 200 Script output follows
305
306 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 1
307 publishing True (no-eol)
308
309 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=batch' --requestheader 'x-hgarg-1=cmds=listkeys+namespace%3Dphases'
310 200 Script output follows
311
312 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 1
313 publishing True (no-eol)
314
315 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadnoperm'
316 405 push requires POST request
317
318 0
319 push requires POST request
320 [1]
321
322 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadwithperm'
323 200 Script output follows
324
325 read-only command w/ defined permissions
326
327 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
328 405 push requires POST request
329
330 0
331 push requires POST request
332 [1]
333
334 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
335 405 push requires POST request
336
337 0
338 push requires POST request
339 [1]
340
341 $ hg --cwd ../test2 pull http://localhost:$HGPORT/
342 pulling from http://localhost:$HGPORT/
343 searching for changes
344 no changes found
345
346 $ killdaemons.py
347
348 web.allow_read=* allows reads for unauthenticated users
349
350 $ cat > .hg/hgrc <<EOF
351 > [web]
352 > allow_read = *
353 > EOF
354
355 $ hg serve -p $HGPORT -d --pid-file hg.pid
356 $ cat hg.pid > $DAEMON_PIDS
357
358 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=listkeys' --requestheader 'x-hgarg-1=namespace=phases'
359 200 Script output follows
360
361 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 1
362 publishing True (no-eol)
363
364 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=batch' --requestheader 'x-hgarg-1=cmds=listkeys+namespace%3Dphases'
365 200 Script output follows
366
367 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 1
368 publishing True (no-eol)
369
370 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadnoperm'
371 405 push requires POST request
372
373 0
374 push requires POST request
375 [1]
376
377 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadwithperm'
378 200 Script output follows
379
380 read-only command w/ defined permissions
381
382 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
383 405 push requires POST request
384
385 0
386 push requires POST request
387 [1]
388
389 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
390 405 push requires POST request
391
392 0
393 push requires POST request
394 [1]
395
396 $ hg --cwd ../test2 pull http://localhost:$HGPORT/
397 pulling from http://localhost:$HGPORT/
398 searching for changes
399 no changes found
400
401 $ killdaemons.py
402
403 web.allow_read=* allows read for authenticated user
404
405 $ REMOTE_USER=authed_user hg serve -p $HGPORT -d --pid-file hg.pid
406 $ cat hg.pid > $DAEMON_PIDS
407
408 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=listkeys' --requestheader 'x-hgarg-1=namespace=phases'
409 200 Script output follows
410
411 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 1
412 publishing True (no-eol)
413
414 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=batch' --requestheader 'x-hgarg-1=cmds=listkeys+namespace%3Dphases'
415 200 Script output follows
416
417 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 1
418 publishing True (no-eol)
419
420 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadnoperm'
421 405 push requires POST request
422
423 0
424 push requires POST request
425 [1]
426
427 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadwithperm'
428 200 Script output follows
429
430 read-only command w/ defined permissions
431
432 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
433 405 push requires POST request
434
435 0
436 push requires POST request
437 [1]
438
439 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
440 405 push requires POST request
441
442 0
443 push requires POST request
444 [1]
445
446 $ hg --cwd ../test2 pull http://localhost:$HGPORT/
447 pulling from http://localhost:$HGPORT/
448 searching for changes
449 no changes found
450
451 $ killdaemons.py
452
453 web.allow_read=<user> does not allow unauthenticated users to read
454
455 $ cat > .hg/hgrc <<EOF
456 > [web]
457 > allow_read = gooduser
458 > EOF
459
460 $ hg serve -p $HGPORT -d --pid-file hg.pid
461 $ cat hg.pid > $DAEMON_PIDS
462
463 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=listkeys' --requestheader 'x-hgarg-1=namespace=phases'
464 401 read not authorized
465
466 0
467 read not authorized
468 [1]
469
470 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=batch' --requestheader 'x-hgarg-1=cmds=listkeys+namespace%3Dphases'
471 401 read not authorized
472
473 0
474 read not authorized
475 [1]
476
477 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadnoperm'
478 401 read not authorized
479
480 0
481 read not authorized
482 [1]
483
484 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadwithperm'
485 401 read not authorized
486
487 0
488 read not authorized
489 [1]
490
491 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
492 401 read not authorized
493
494 0
495 read not authorized
496 [1]
497
498 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
499 401 read not authorized
500
501 0
502 read not authorized
503 [1]
504
505 $ hg --cwd ../test2 pull http://localhost:$HGPORT/
506 pulling from http://localhost:$HGPORT/
507 abort: authorization failed
508 [255]
509
510 $ killdaemons.py
511
512 web.allow_read=<user> does not allow user not in list to read
513
514 $ REMOTE_USER=baduser hg serve -p $HGPORT -d --pid-file hg.pid
515 $ cat hg.pid > $DAEMON_PIDS
516
517 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=listkeys' --requestheader 'x-hgarg-1=namespace=phases'
518 401 read not authorized
519
520 0
521 read not authorized
522 [1]
523
524 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=batch' --requestheader 'x-hgarg-1=cmds=listkeys+namespace%3Dphases'
525 401 read not authorized
526
527 0
528 read not authorized
529 [1]
530
531 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadnoperm'
532 401 read not authorized
533
534 0
535 read not authorized
536 [1]
537
538 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadwithperm'
539 401 read not authorized
540
541 0
542 read not authorized
543 [1]
544
545 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
546 401 read not authorized
547
548 0
549 read not authorized
550 [1]
551
552 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
553 401 read not authorized
554
555 0
556 read not authorized
557 [1]
558
559 $ hg --cwd ../test2 pull http://localhost:$HGPORT/
560 pulling from http://localhost:$HGPORT/
561 abort: authorization failed
562 [255]
563
564 $ killdaemons.py
565
566 web.allow_read=<user> allows read from user in list
567
568 $ REMOTE_USER=gooduser hg serve -p $HGPORT -d --pid-file hg.pid
569 $ cat hg.pid > $DAEMON_PIDS
570
571 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=listkeys' --requestheader 'x-hgarg-1=namespace=phases'
572 200 Script output follows
573
574 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 1
575 publishing True (no-eol)
576
577 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=batch' --requestheader 'x-hgarg-1=cmds=listkeys+namespace%3Dphases'
578 200 Script output follows
579
580 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 1
581 publishing True (no-eol)
582
583 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadnoperm'
584 405 push requires POST request
585
586 0
587 push requires POST request
588 [1]
589
590 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadwithperm'
591 200 Script output follows
592
593 read-only command w/ defined permissions
594
595 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
596 405 push requires POST request
597
598 0
599 push requires POST request
600 [1]
601
602 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
603 405 push requires POST request
604
605 0
606 push requires POST request
607 [1]
608
609 $ hg --cwd ../test2 pull http://localhost:$HGPORT/
610 pulling from http://localhost:$HGPORT/
611 searching for changes
612 no changes found
613
614 $ killdaemons.py
615
616 web.deny_read takes precedence over web.allow_read
617
618 $ cat > .hg/hgrc <<EOF
619 > [web]
620 > allow_read = baduser
621 > deny_read = baduser
622 > EOF
623
624 $ REMOTE_USER=baduser hg serve -p $HGPORT -d --pid-file hg.pid
625 $ cat hg.pid > $DAEMON_PIDS
626
627 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=listkeys' --requestheader 'x-hgarg-1=namespace=phases'
628 401 read not authorized
629
630 0
631 read not authorized
632 [1]
633
634 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=batch' --requestheader 'x-hgarg-1=cmds=listkeys+namespace%3Dphases'
635 401 read not authorized
636
637 0
638 read not authorized
639 [1]
640
641 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadnoperm'
642 401 read not authorized
643
644 0
645 read not authorized
646 [1]
647
648 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadwithperm'
649 401 read not authorized
650
651 0
652 read not authorized
653 [1]
654
655 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
656 401 read not authorized
657
658 0
659 read not authorized
660 [1]
661
662 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
663 401 read not authorized
664
665 0
666 read not authorized
667 [1]
668
669 $ hg --cwd ../test2 pull http://localhost:$HGPORT/
670 pulling from http://localhost:$HGPORT/
671 abort: authorization failed
672 [255]
673
674 $ killdaemons.py
675
676 web.allow-pull=false denies read access to repo
677
678 $ cat > .hg/hgrc <<EOF
679 > [web]
680 > allow-pull = false
681 > EOF
682
683 $ hg serve -p $HGPORT -d --pid-file hg.pid
684 $ cat hg.pid > $DAEMON_PIDS
685
686 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=capabilities'
687 401 pull not authorized
688
689 0
690 pull not authorized
691 [1]
692
693 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=listkeys' --requestheader 'x-hgarg-1=namespace=phases'
694 401 pull not authorized
695
696 0
697 pull not authorized
698 [1]
699
700 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=batch' --requestheader 'x-hgarg-1=cmds=listkeys+namespace%3Dphases'
701 401 pull not authorized
702
703 0
704 pull not authorized
705 [1]
706
707 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadnoperm'
708 405 push requires POST request
709
710 0
711 push requires POST request
712 [1]
713
714 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadwithperm'
715 401 pull not authorized
716
717 0
718 pull not authorized
719 [1]
720
721 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
722 405 push requires POST request
723
724 0
725 push requires POST request
726 [1]
727
728 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
729 405 push requires POST request
730
731 0
732 push requires POST request
733 [1]
734
735 $ hg --cwd ../test2 pull http://localhost:$HGPORT/
736 pulling from http://localhost:$HGPORT/
737 abort: authorization failed
738 [255]
739
740 $ killdaemons.py
741
742 Attempting a write command with HTTP GET fails
743
744 $ cat > .hg/hgrc <<EOF
745 > EOF
746
747 $ REQUEST_METHOD=GET hg serve -p $HGPORT -d --pid-file hg.pid
748 $ cat hg.pid > $DAEMON_PIDS
749
750 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=pushkey' --requestheader 'x-hgarg-1=namespace=bookmarks&key=bm&old=&new=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
751 405 push requires POST request
752
753 0
754 push requires POST request
755 [1]
756
757 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=batch' --requestheader 'x-hgarg-1=cmds=pushkey+namespace%3Dbookmarks%2Ckey%3Dbm%2Cold%3D%2Cnew%3Dcb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
758 405 push requires POST request
759
760 0
761 push requires POST request
762 [1]
763
764 $ hg bookmarks
765 no bookmarks set
766 $ hg bookmark -d bm
767 abort: bookmark 'bm' does not exist
768 [10]
769
770 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
771 405 push requires POST request
772
773 0
774 push requires POST request
775 [1]
776
777 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
778 405 push requires POST request
779
780 0
781 push requires POST request
782 [1]
783
784 $ killdaemons.py
785
786 Attempting a write command with an unknown HTTP verb fails
787
788 $ REQUEST_METHOD=someverb hg serve -p $HGPORT -d --pid-file hg.pid
789 $ cat hg.pid > $DAEMON_PIDS
790
791 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=pushkey' --requestheader 'x-hgarg-1=namespace=bookmarks&key=bm&old=&new=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
792 405 push requires POST request
793
794 0
795 push requires POST request
796 [1]
797
798 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=batch' --requestheader 'x-hgarg-1=cmds=pushkey+namespace%3Dbookmarks%2Ckey%3Dbm%2Cold%3D%2Cnew%3Dcb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
799 405 push requires POST request
800
801 0
802 push requires POST request
803 [1]
804
805 $ hg bookmarks
806 no bookmarks set
807 $ hg bookmark -d bm
808 abort: bookmark 'bm' does not exist
809 [10]
810
811 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
812 405 push requires POST request
813
814 0
815 push requires POST request
816 [1]
817
818 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
819 405 push requires POST request
820
821 0
822 push requires POST request
823 [1]
824
825 $ killdaemons.py
826
827 Pushing on a plaintext channel is disabled by default
828
829 $ cat > .hg/hgrc <<EOF
830 > EOF
831
832 $ REQUEST_METHOD=POST hg serve -p $HGPORT -d --pid-file hg.pid
833 $ cat hg.pid > $DAEMON_PIDS
834
835 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=pushkey' --requestheader 'x-hgarg-1=namespace=bookmarks&key=bm&old=&new=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
836 403 ssl required
837
838 0
839 ssl required
840 [1]
841
842 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=batch' --requestheader 'x-hgarg-1=cmds=pushkey+namespace%3Dbookmarks%2Ckey%3Dbm%2Cold%3D%2Cnew%3Dcb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
843 403 ssl required
844
845 0
846 ssl required
847 [1]
848
849 $ hg bookmarks
850 no bookmarks set
851
852 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
853 403 ssl required
854
855 0
856 ssl required
857 [1]
858
859 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
860 403 ssl required
861
862 0
863 ssl required
864 [1]
865
866 Reset server to remove REQUEST_METHOD hack to test hg client
867
868 $ killdaemons.py
869 $ hg serve -p $HGPORT -d --pid-file hg.pid
870 $ cat hg.pid > $DAEMON_PIDS
871
872 $ hg --cwd ../test2 push -B bm http://localhost:$HGPORT/
873 pushing to http://localhost:$HGPORT/
874 searching for changes
875 no changes found
876 abort: HTTP Error 403: ssl required
877 [100]
878
879 $ hg --cwd ../test2 push http://localhost:$HGPORT/
880 pushing to http://localhost:$HGPORT/
881 searching for changes
882 abort: HTTP Error 403: ssl required
883 [100]
884
885 $ killdaemons.py
886
887 web.deny_push=* denies pushing to unauthenticated users
888
889 $ cat > .hg/hgrc <<EOF
890 > [web]
891 > push_ssl = false
892 > deny_push = *
893 > EOF
894
895 $ REQUEST_METHOD=POST hg serve -p $HGPORT -d --pid-file hg.pid
896 $ cat hg.pid > $DAEMON_PIDS
897
898 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=pushkey' --requestheader 'x-hgarg-1=namespace=bookmarks&key=bm&old=&new=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
899 401 push not authorized
900
901 0
902 push not authorized
903 [1]
904
905 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=batch' --requestheader 'x-hgarg-1=cmds=pushkey+namespace%3Dbookmarks%2Ckey%3Dbm%2Cold%3D%2Cnew%3Dcb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
906 401 push not authorized
907
908 0
909 push not authorized
910 [1]
911
912 $ hg bookmarks
913 no bookmarks set
914
915 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
916 401 push not authorized
917
918 0
919 push not authorized
920 [1]
921
922 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
923 401 push not authorized
924
925 0
926 push not authorized
927 [1]
928
929 Reset server to remove REQUEST_METHOD hack to test hg client
930
931 $ killdaemons.py
932 $ hg serve -p $HGPORT -d --pid-file hg.pid
933 $ cat hg.pid > $DAEMON_PIDS
934
935 $ hg --cwd ../test2 push -B bm http://localhost:$HGPORT/
936 pushing to http://localhost:$HGPORT/
937 searching for changes
938 no changes found
939 abort: authorization failed
940 [255]
941
942 $ hg --cwd ../test2 push http://localhost:$HGPORT/
943 pushing to http://localhost:$HGPORT/
944 searching for changes
945 abort: authorization failed
946 [255]
947
948 $ killdaemons.py
949
950 web.deny_push=* denies pushing to authenticated users
951
952 $ REMOTE_USER=someuser REQUEST_METHOD=POST hg serve -p $HGPORT -d --pid-file hg.pid
953 $ cat hg.pid > $DAEMON_PIDS
954
955 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=pushkey' --requestheader 'x-hgarg-1=namespace=bookmarks&key=bm&old=&new=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
956 401 push not authorized
957
958 0
959 push not authorized
960 [1]
961
962 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=batch' --requestheader 'x-hgarg-1=cmds=pushkey+namespace%3Dbookmarks%2Ckey%3Dbm%2Cold%3D%2Cnew%3Dcb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
963 401 push not authorized
964
965 0
966 push not authorized
967 [1]
968
969 $ hg bookmarks
970 no bookmarks set
971
972 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
973 401 push not authorized
974
975 0
976 push not authorized
977 [1]
978
979 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
980 401 push not authorized
981
982 0
983 push not authorized
984 [1]
985
986 Reset server to remove REQUEST_METHOD hack to test hg client
987
988 $ killdaemons.py
989 $ REMOTE_USER=someuser hg serve -p $HGPORT -d --pid-file hg.pid
990 $ cat hg.pid > $DAEMON_PIDS
991
992 $ hg --cwd ../test2 push -B bm http://localhost:$HGPORT/
993 pushing to http://localhost:$HGPORT/
994 searching for changes
995 no changes found
996 abort: authorization failed
997 [255]
998
999 $ hg --cwd ../test2 push http://localhost:$HGPORT/
1000 pushing to http://localhost:$HGPORT/
1001 searching for changes
1002 abort: authorization failed
1003 [255]
1004
1005 $ killdaemons.py
1006
1007 web.deny_push=<user> denies pushing to user in list
1008
1009 $ cat > .hg/hgrc <<EOF
1010 > [web]
1011 > push_ssl = false
1012 > deny_push = baduser
1013 > EOF
1014
1015 $ REMOTE_USER=baduser REQUEST_METHOD=POST hg serve -p $HGPORT -d --pid-file hg.pid
1016 $ cat hg.pid > $DAEMON_PIDS
1017
1018 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=pushkey' --requestheader 'x-hgarg-1=namespace=bookmarks&key=bm&old=&new=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
1019 401 push not authorized
1020
1021 0
1022 push not authorized
1023 [1]
1024
1025 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=batch' --requestheader 'x-hgarg-1=cmds=pushkey+namespace%3Dbookmarks%2Ckey%3Dbm%2Cold%3D%2Cnew%3Dcb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
1026 401 push not authorized
1027
1028 0
1029 push not authorized
1030 [1]
1031
1032 $ hg bookmarks
1033 no bookmarks set
1034
1035 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
1036 401 push not authorized
1037
1038 0
1039 push not authorized
1040 [1]
1041
1042 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
1043 401 push not authorized
1044
1045 0
1046 push not authorized
1047 [1]
1048
1049 Reset server to remove REQUEST_METHOD hack to test hg client
1050
1051 $ killdaemons.py
1052 $ REMOTE_USER=baduser hg serve -p $HGPORT -d --pid-file hg.pid
1053 $ cat hg.pid > $DAEMON_PIDS
1054
1055 $ hg --cwd ../test2 push -B bm http://localhost:$HGPORT/
1056 pushing to http://localhost:$HGPORT/
1057 searching for changes
1058 no changes found
1059 abort: authorization failed
1060 [255]
1061
1062 $ hg --cwd ../test2 push http://localhost:$HGPORT/
1063 pushing to http://localhost:$HGPORT/
1064 searching for changes
1065 abort: authorization failed
1066 [255]
1067
1068 $ killdaemons.py
1069
1070 web.deny_push=<user> denies pushing to user not in list because allow-push isn't set
1071
1072 $ REMOTE_USER=gooduser REQUEST_METHOD=POST hg serve -p $HGPORT -d --pid-file hg.pid
1073 $ cat hg.pid > $DAEMON_PIDS
1074
1075 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=pushkey' --requestheader 'x-hgarg-1=namespace=bookmarks&key=bm&old=&new=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
1076 401 push not authorized
1077
1078 0
1079 push not authorized
1080 [1]
1081
1082 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=batch' --requestheader 'x-hgarg-1=cmds=pushkey+namespace%3Dbookmarks%2Ckey%3Dbm%2Cold%3D%2Cnew%3Dcb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
1083 401 push not authorized
1084
1085 0
1086 push not authorized
1087 [1]
1088
1089 $ hg bookmarks
1090 no bookmarks set
1091
1092 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
1093 401 push not authorized
1094
1095 0
1096 push not authorized
1097 [1]
1098
1099 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
1100 401 push not authorized
1101
1102 0
1103 push not authorized
1104 [1]
1105
1106 Reset server to remove REQUEST_METHOD hack to test hg client
1107
1108 $ killdaemons.py
1109 $ REMOTE_USER=gooduser hg serve -p $HGPORT -d --pid-file hg.pid
1110 $ cat hg.pid > $DAEMON_PIDS
1111
1112 $ hg --cwd ../test2 push -B bm http://localhost:$HGPORT/
1113 pushing to http://localhost:$HGPORT/
1114 searching for changes
1115 no changes found
1116 abort: authorization failed
1117 [255]
1118
1119 $ hg --cwd ../test2 push http://localhost:$HGPORT/
1120 pushing to http://localhost:$HGPORT/
1121 searching for changes
1122 abort: authorization failed
1123 [255]
1124
1125 $ killdaemons.py
1126
1127 web.allow-push=* allows pushes from unauthenticated users
1128
1129 $ cat > .hg/hgrc <<EOF
1130 > [web]
1131 > push_ssl = false
1132 > allow-push = *
1133 > EOF
1134
1135 $ REQUEST_METHOD=POST hg serve -p $HGPORT -d --pid-file hg.pid
1136 $ cat hg.pid > $DAEMON_PIDS
1137
1138 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=pushkey' --requestheader 'x-hgarg-1=namespace=bookmarks&key=bm&old=&new=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
1139 200 Script output follows
1140
1141 1
1142
1143 $ hg bookmarks
1144 bm 0:cb9a9f314b8b
1145 $ hg book -d bm
1146
1147 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
1148 200 Script output follows
1149
1150 write command no defined permissions
1151
1152 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
1153 200 Script output follows
1154
1155 write command w/ defined permissions
1156
1157 Reset server to remove REQUEST_METHOD hack to test hg client
1158
1159 $ killdaemons.py
1160 $ hg serve -p $HGPORT -d --pid-file hg.pid
1161 $ cat hg.pid > $DAEMON_PIDS
1162
1163 $ hg --cwd ../test2 push -B bm http://localhost:$HGPORT/
1164 pushing to http://localhost:$HGPORT/
1165 searching for changes
1166 no changes found
1167 exporting bookmark bm
1168 [1]
1169
1170 $ hg book -d bm
1171
1172 $ hg --cwd ../test2 push http://localhost:$HGPORT/
1173 pushing to http://localhost:$HGPORT/
1174 searching for changes
1175 remote: adding changesets
1176 remote: adding manifests
1177 remote: adding file changes
1178 remote: added 1 changesets with 1 changes to 1 files
1179
1180 $ hg strip -r 1:
1181 saved backup bundle to $TESTTMP/test/.hg/strip-backup/ba677d0156c1-eea704d7-backup.hg
1182
1183 $ killdaemons.py
1184
1185 web.allow-push=* allows pushes from authenticated users
1186
1187 $ REMOTE_USER=someuser REQUEST_METHOD=POST hg serve -p $HGPORT -d --pid-file hg.pid
1188 $ cat hg.pid > $DAEMON_PIDS
1189
1190 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=pushkey' --requestheader 'x-hgarg-1=namespace=bookmarks&key=bm&old=&new=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
1191 200 Script output follows
1192
1193 1
1194
1195 $ hg bookmarks
1196 bm 0:cb9a9f314b8b
1197 $ hg book -d bm
1198
1199 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
1200 200 Script output follows
1201
1202 write command no defined permissions
1203
1204 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
1205 200 Script output follows
1206
1207 write command w/ defined permissions
1208
1209 Reset server to remove REQUEST_METHOD hack to test hg client
1210
1211 $ killdaemons.py
1212 $ REMOTE_USER=someuser hg serve -p $HGPORT -d --pid-file hg.pid
1213 $ cat hg.pid > $DAEMON_PIDS
1214
1215 $ hg --cwd ../test2 push -B bm http://localhost:$HGPORT/
1216 pushing to http://localhost:$HGPORT/
1217 searching for changes
1218 no changes found
1219 exporting bookmark bm
1220 [1]
1221
1222 $ hg book -d bm
1223
1224 $ hg --cwd ../test2 push http://localhost:$HGPORT/
1225 pushing to http://localhost:$HGPORT/
1226 searching for changes
1227 remote: adding changesets
1228 remote: adding manifests
1229 remote: adding file changes
1230 remote: added 1 changesets with 1 changes to 1 files
1231
1232 $ hg strip -r 1:
1233 saved backup bundle to $TESTTMP/test/.hg/strip-backup/ba677d0156c1-eea704d7-backup.hg
1234
1235 $ killdaemons.py
1236
1237 web.allow-push=<user> denies push to user not in list
1238
1239 $ cat > .hg/hgrc <<EOF
1240 > [web]
1241 > push_ssl = false
1242 > allow-push = gooduser
1243 > EOF
1244
1245 $ REMOTE_USER=baduser REQUEST_METHOD=POST hg serve -p $HGPORT -d --pid-file hg.pid
1246 $ cat hg.pid > $DAEMON_PIDS
1247
1248 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=pushkey' --requestheader 'x-hgarg-1=namespace=bookmarks&key=bm&old=&new=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
1249 401 push not authorized
1250
1251 0
1252 push not authorized
1253 [1]
1254
1255 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=batch' --requestheader 'x-hgarg-1=cmds=pushkey+namespace%3Dbookmarks%2Ckey%3Dbm%2Cold%3D%2Cnew%3Dcb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
1256 401 push not authorized
1257
1258 0
1259 push not authorized
1260 [1]
1261
1262 $ hg bookmarks
1263 no bookmarks set
1264
1265 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
1266 401 push not authorized
1267
1268 0
1269 push not authorized
1270 [1]
1271
1272 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
1273 401 push not authorized
1274
1275 0
1276 push not authorized
1277 [1]
1278
1279 Reset server to remove REQUEST_METHOD hack to test hg client
1280
1281 $ killdaemons.py
1282 $ REMOTE_USER=baduser hg serve -p $HGPORT -d --pid-file hg.pid
1283 $ cat hg.pid > $DAEMON_PIDS
1284
1285 $ hg --cwd ../test2 push -B bm http://localhost:$HGPORT/
1286 pushing to http://localhost:$HGPORT/
1287 searching for changes
1288 no changes found
1289 abort: authorization failed
1290 [255]
1291
1292 $ hg --cwd ../test2 push http://localhost:$HGPORT/
1293 pushing to http://localhost:$HGPORT/
1294 searching for changes
1295 abort: authorization failed
1296 [255]
1297
1298 $ killdaemons.py
1299
1300 web.allow-push=<user> allows push from user in list
1301
1302 $ REMOTE_USER=gooduser REQUEST_METHOD=POST hg serve -p $HGPORT -d --pid-file hg.pid
1303 $ cat hg.pid > $DAEMON_PIDS
1304
1305 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=pushkey' --requestheader 'x-hgarg-1=namespace=bookmarks&key=bm&old=&new=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
1306 200 Script output follows
1307
1308 1
1309
1310 $ hg bookmarks
1311 bm 0:cb9a9f314b8b
1312 $ hg book -d bm
1313
1314 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=batch' --requestheader 'x-hgarg-1=cmds=pushkey+namespace%3Dbookmarks%2Ckey%3Dbm%2Cold%3D%2Cnew%3Dcb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
1315 200 Script output follows
1316
1317 1
1318
1319 $ hg bookmarks
1320 bm 0:cb9a9f314b8b
1321 $ hg book -d bm
1322
1323 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
1324 200 Script output follows
1325
1326 write command no defined permissions
1327
1328 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
1329 200 Script output follows
1330
1331 write command w/ defined permissions
1332
1333 Reset server to remove REQUEST_METHOD hack to test hg client
1334
1335 $ killdaemons.py
1336 $ REMOTE_USER=gooduser hg serve -p $HGPORT -d --pid-file hg.pid
1337 $ cat hg.pid > $DAEMON_PIDS
1338
1339 $ hg --cwd ../test2 push -B bm http://localhost:$HGPORT/
1340 pushing to http://localhost:$HGPORT/
1341 searching for changes
1342 no changes found
1343 exporting bookmark bm
1344 [1]
1345
1346 $ hg book -d bm
1347
1348 $ hg --cwd ../test2 push http://localhost:$HGPORT/
1349 pushing to http://localhost:$HGPORT/
1350 searching for changes
1351 remote: adding changesets
1352 remote: adding manifests
1353 remote: adding file changes
1354 remote: added 1 changesets with 1 changes to 1 files
1355
1356 $ hg strip -r 1:
1357 saved backup bundle to $TESTTMP/test/.hg/strip-backup/ba677d0156c1-eea704d7-backup.hg
1358
1359 $ killdaemons.py
1360
1361 web.deny_push takes precedence over web.allow_push
1362
1363 $ cat > .hg/hgrc <<EOF
1364 > [web]
1365 > push_ssl = false
1366 > allow-push = someuser
1367 > deny_push = someuser
1368 > EOF
1369
1370 $ REMOTE_USER=someuser REQUEST_METHOD=POST hg serve -p $HGPORT -d --pid-file hg.pid
1371 $ cat hg.pid > $DAEMON_PIDS
1372
1373 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=pushkey' --requestheader 'x-hgarg-1=namespace=bookmarks&key=bm&old=&new=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
1374 401 push not authorized
1375
1376 0
1377 push not authorized
1378 [1]
1379
1380 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=batch' --requestheader 'x-hgarg-1=cmds=pushkey+namespace%3Dbookmarks%2Ckey%3Dbm%2Cold%3D%2Cnew%3Dcb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
1381 401 push not authorized
1382
1383 0
1384 push not authorized
1385 [1]
1386
1387 $ hg bookmarks
1388 no bookmarks set
1389
1390 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
1391 401 push not authorized
1392
1393 0
1394 push not authorized
1395 [1]
1396
1397 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
1398 401 push not authorized
1399
1400 0
1401 push not authorized
1402 [1]
1403
1404 Reset server to remove REQUEST_METHOD hack to test hg client
1405
1406 $ killdaemons.py
1407 $ REMOTE_USER=someuser hg serve -p $HGPORT -d --pid-file hg.pid
1408 $ cat hg.pid > $DAEMON_PIDS
1409
1410 $ hg --cwd ../test2 push -B bm http://localhost:$HGPORT/
1411 pushing to http://localhost:$HGPORT/
1412 searching for changes
1413 no changes found
1414 abort: authorization failed
1415 [255]
1416
1417 $ hg --cwd ../test2 push http://localhost:$HGPORT/
1418 pushing to http://localhost:$HGPORT/
1419 searching for changes
1420 abort: authorization failed
1421 [255]
1422
1423 $ killdaemons.py
1424
1425 web.allow-push has no effect if web.deny_read is set
1426
1427 $ cat > .hg/hgrc <<EOF
1428 > [web]
1429 > push_ssl = false
1430 > allow-push = *
1431 > deny_read = *
1432 > EOF
1433
1434 $ REQUEST_METHOD=POST REMOTE_USER=someuser hg serve -p $HGPORT -d --pid-file hg.pid
1435 $ cat hg.pid > $DAEMON_PIDS
1436
1437 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=pushkey' --requestheader 'x-hgarg-1=namespace=bookmarks&key=bm&old=&new=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
1438 401 read not authorized
1439
1440 0
1441 read not authorized
1442 [1]
1443
1444 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=batch' --requestheader 'x-hgarg-1=cmds=pushkey+namespace%3Dbookmarks%2Ckey%3Dbm%2Cold%3D%2Cnew%3Dcb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b'
1445 401 read not authorized
1446
1447 0
1448 read not authorized
1449 [1]
1450
1451 $ hg bookmarks
1452 no bookmarks set
1453
1454 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadnoperm'
1455 401 read not authorized
1456
1457 0
1458 read not authorized
1459 [1]
1460
1461 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customreadwithperm'
1462 401 read not authorized
1463
1464 0
1465 read not authorized
1466 [1]
1467
1468 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
1469 401 read not authorized
1470
1471 0
1472 read not authorized
1473 [1]
1474
1475 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritewithperm'
1476 401 read not authorized
1477
1478 0
1479 read not authorized
1480 [1]
1481
1482 Reset server to remove REQUEST_METHOD hack to test hg client
1483
1484 $ killdaemons.py
1485 $ REMOTE_USER=someuser hg serve -p $HGPORT -d --pid-file hg.pid
1486 $ cat hg.pid > $DAEMON_PIDS
1487
1488 $ hg --cwd ../test2 push -B bm http://localhost:$HGPORT/
1489 pushing to http://localhost:$HGPORT/
1490 abort: authorization failed
1491 [255]
1492
1493 $ hg --cwd ../test2 push http://localhost:$HGPORT/
1494 pushing to http://localhost:$HGPORT/
1495 abort: authorization failed
1496 [255]
1497
1498 $ killdaemons.py