Debian Codegraph @

tests/test-http-proxy.t

raw
1 #require serve
2
3 $ hg init a
4 $ cd a
5 $ echo a > a
6 $ hg ci -Ama -d '1123456789 0'
7 adding a
8 $ hg serve --config server.uncompressed=True -p $HGPORT -d --pid-file=hg.pid
9 $ cat hg.pid >> $DAEMON_PIDS
10 $ cd ..
11 $ tinyproxy.py $HGPORT1 localhost 2>proxy.log >/dev/null </dev/null &
12 $ while [ ! -f proxy.pid ]; do sleep 0; done
13 $ cat proxy.pid >> $DAEMON_PIDS
14
15 url for proxy, stream
16
17 $ http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone --stream http://localhost:$HGPORT/ b
18 streaming all changes
19 * files to transfer, * bytes of data (glob)
20 stream-cloned * files / * bytes in * seconds (*/sec) (glob)
21 updating to branch default
22 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
23 $ cd b
24 $ hg verify -q
25 $ cd ..
26
27 url for proxy, pull
28
29 $ http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone http://localhost:$HGPORT/ b-pull
30 requesting all changes
31 adding changesets
32 adding manifests
33 adding file changes
34 added 1 changesets with 1 changes to 1 files
35 new changesets 83180e7845de
36 updating to branch default
37 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
38 $ cd b-pull
39 $ hg verify -q
40 $ cd ..
41
42 host:port for proxy
43
44 $ http_proxy=localhost:$HGPORT1 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ c
45 requesting all changes
46 adding changesets
47 adding manifests
48 adding file changes
49 added 1 changesets with 1 changes to 1 files
50 new changesets 83180e7845de
51 updating to branch default
52 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
53
54 proxy url with user name and password
55
56 $ http_proxy=http://user:passwd@localhost:$HGPORT1 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ d
57 requesting all changes
58 adding changesets
59 adding manifests
60 adding file changes
61 added 1 changesets with 1 changes to 1 files
62 new changesets 83180e7845de
63 updating to branch default
64 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
65
66 url with user name and password
67
68 $ http_proxy=http://user:passwd@localhost:$HGPORT1 hg clone --config http_proxy.always=True http://user:passwd@localhost:$HGPORT/ e
69 requesting all changes
70 adding changesets
71 adding manifests
72 adding file changes
73 added 1 changesets with 1 changes to 1 files
74 new changesets 83180e7845de
75 updating to branch default
76 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
77
78 bad host:port for proxy ("Protocol not supported" can happen on
79 misconfigured hosts)
80
81 $ http_proxy=localhost:$HGPORT2 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ f
82 abort: error: (\$ECONNREFUSED\$|Protocol not supported|.* actively refused it|\$EADDRNOTAVAIL\$|No route to host) (re)
83 [100]
84
85 do not use the proxy if it is in the no list
86
87 $ http_proxy=localhost:$HGPORT1 hg clone --config http_proxy.no=localhost http://localhost:$HGPORT/ g
88 requesting all changes
89 adding changesets
90 adding manifests
91 adding file changes
92 added 1 changesets with 1 changes to 1 files
93 new changesets 83180e7845de
94 updating to branch default
95 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
96
97 proxy can't connect to server
98
99 $ http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone http://localhost:$HGPORT2/ h
100 abort: HTTP Error 404: $ECONNREFUSED$
101 [100]
102
103 $ cat proxy.log
104 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
105 $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
106 $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=0&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&stream=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
107 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
108 $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
109 $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
110 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
111 $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
112 $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
113 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
114 $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
115 $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
116 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
117 $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
118 $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
119 * - - [*] code 404, message $ECONNREFUSED$ (glob)
120 $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT2/?cmd=capabilities HTTP/1.1" 404 - (glob)