##// END OF EJS Templates
tests: add b'' prefixes to ui.configbool() call...
Gregory Szorc -
r41428:0cfbe78f default
parent child Browse files
Show More
@@ -1,773 +1,773 b''
1 #require no-chg
1 #require no-chg
2
2
3 $ . $TESTDIR/wireprotohelpers.sh
3 $ . $TESTDIR/wireprotohelpers.sh
4
4
5 $ cat >> $HGRCPATH << EOF
5 $ cat >> $HGRCPATH << EOF
6 > [web]
6 > [web]
7 > push_ssl = false
7 > push_ssl = false
8 > allow_push = *
8 > allow_push = *
9 > EOF
9 > EOF
10
10
11 $ hg init server
11 $ hg init server
12 $ cd server
12 $ cd server
13 $ touch a
13 $ touch a
14 $ hg -q commit -A -m initial
14 $ hg -q commit -A -m initial
15 $ cd ..
15 $ cd ..
16
16
17 $ hg serve -R server -p $HGPORT -d --pid-file hg.pid
17 $ hg serve -R server -p $HGPORT -d --pid-file hg.pid
18 $ cat hg.pid >> $DAEMON_PIDS
18 $ cat hg.pid >> $DAEMON_PIDS
19
19
20 compression formats are advertised in compression capability
20 compression formats are advertised in compression capability
21
21
22 #if zstd
22 #if zstd
23 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=capabilities' | tr ' ' '\n' | grep '^compression=zstd,zlib$' > /dev/null
23 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=capabilities' | tr ' ' '\n' | grep '^compression=zstd,zlib$' > /dev/null
24 #else
24 #else
25 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=capabilities' | tr ' ' '\n' | grep '^compression=zlib$' > /dev/null
25 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=capabilities' | tr ' ' '\n' | grep '^compression=zlib$' > /dev/null
26 #endif
26 #endif
27
27
28 $ killdaemons.py
28 $ killdaemons.py
29
29
30 server.compressionengines can replace engines list wholesale
30 server.compressionengines can replace engines list wholesale
31
31
32 $ hg serve --config server.compressionengines=none -R server -p $HGPORT -d --pid-file hg.pid
32 $ hg serve --config server.compressionengines=none -R server -p $HGPORT -d --pid-file hg.pid
33 $ cat hg.pid > $DAEMON_PIDS
33 $ cat hg.pid > $DAEMON_PIDS
34 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=capabilities' | tr ' ' '\n' | grep '^compression=none$' > /dev/null
34 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=capabilities' | tr ' ' '\n' | grep '^compression=none$' > /dev/null
35
35
36 $ killdaemons.py
36 $ killdaemons.py
37
37
38 Order of engines can also change
38 Order of engines can also change
39
39
40 $ hg serve --config server.compressionengines=none,zlib -R server -p $HGPORT -d --pid-file hg.pid
40 $ hg serve --config server.compressionengines=none,zlib -R server -p $HGPORT -d --pid-file hg.pid
41 $ cat hg.pid > $DAEMON_PIDS
41 $ cat hg.pid > $DAEMON_PIDS
42 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=capabilities' | tr ' ' '\n' | grep '^compression=none,zlib$' > /dev/null
42 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=capabilities' | tr ' ' '\n' | grep '^compression=none,zlib$' > /dev/null
43
43
44 $ killdaemons.py
44 $ killdaemons.py
45
45
46 Start a default server again
46 Start a default server again
47
47
48 $ hg serve -R server -p $HGPORT -d --pid-file hg.pid
48 $ hg serve -R server -p $HGPORT -d --pid-file hg.pid
49 $ cat hg.pid > $DAEMON_PIDS
49 $ cat hg.pid > $DAEMON_PIDS
50
50
51 Server should send application/mercurial-0.1 to clients if no Accept is used
51 Server should send application/mercurial-0.1 to clients if no Accept is used
52
52
53 $ get-with-headers.py --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' -
53 $ get-with-headers.py --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' -
54 200 Script output follows
54 200 Script output follows
55 content-type: application/mercurial-0.1
55 content-type: application/mercurial-0.1
56 date: $HTTP_DATE$
56 date: $HTTP_DATE$
57 server: testing stub value
57 server: testing stub value
58 transfer-encoding: chunked
58 transfer-encoding: chunked
59
59
60 Server should send application/mercurial-0.1 when client says it wants it
60 Server should send application/mercurial-0.1 when client says it wants it
61
61
62 $ get-with-headers.py --hgproto '0.1' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' -
62 $ get-with-headers.py --hgproto '0.1' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' -
63 200 Script output follows
63 200 Script output follows
64 content-type: application/mercurial-0.1
64 content-type: application/mercurial-0.1
65 date: $HTTP_DATE$
65 date: $HTTP_DATE$
66 server: testing stub value
66 server: testing stub value
67 transfer-encoding: chunked
67 transfer-encoding: chunked
68
68
69 Server should send application/mercurial-0.2 when client says it wants it
69 Server should send application/mercurial-0.2 when client says it wants it
70
70
71 $ get-with-headers.py --hgproto '0.2' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' -
71 $ get-with-headers.py --hgproto '0.2' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' -
72 200 Script output follows
72 200 Script output follows
73 content-type: application/mercurial-0.2
73 content-type: application/mercurial-0.2
74 date: $HTTP_DATE$
74 date: $HTTP_DATE$
75 server: testing stub value
75 server: testing stub value
76 transfer-encoding: chunked
76 transfer-encoding: chunked
77
77
78 $ get-with-headers.py --hgproto '0.1 0.2' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' -
78 $ get-with-headers.py --hgproto '0.1 0.2' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' -
79 200 Script output follows
79 200 Script output follows
80 content-type: application/mercurial-0.2
80 content-type: application/mercurial-0.2
81 date: $HTTP_DATE$
81 date: $HTTP_DATE$
82 server: testing stub value
82 server: testing stub value
83 transfer-encoding: chunked
83 transfer-encoding: chunked
84
84
85 Requesting a compression format that server doesn't support results will fall back to 0.1
85 Requesting a compression format that server doesn't support results will fall back to 0.1
86
86
87 $ get-with-headers.py --hgproto '0.2 comp=aa' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' -
87 $ get-with-headers.py --hgproto '0.2 comp=aa' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' -
88 200 Script output follows
88 200 Script output follows
89 content-type: application/mercurial-0.1
89 content-type: application/mercurial-0.1
90 date: $HTTP_DATE$
90 date: $HTTP_DATE$
91 server: testing stub value
91 server: testing stub value
92 transfer-encoding: chunked
92 transfer-encoding: chunked
93
93
94 #if zstd
94 #if zstd
95 zstd is used if available
95 zstd is used if available
96
96
97 $ get-with-headers.py --hgproto '0.2 comp=zstd' $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp
97 $ get-with-headers.py --hgproto '0.2 comp=zstd' $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp
98 $ f --size --hexdump --bytes 36 --sha1 resp
98 $ f --size --hexdump --bytes 36 --sha1 resp
99 resp: size=248, sha1=4d8d8f87fb82bd542ce52881fdc94f850748
99 resp: size=248, sha1=4d8d8f87fb82bd542ce52881fdc94f850748
100 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu|
100 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu|
101 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 04 7a 73 74 64 |t follows...zstd|
101 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 04 7a 73 74 64 |t follows...zstd|
102 0020: 28 b5 2f fd |(./.|
102 0020: 28 b5 2f fd |(./.|
103
103
104 #endif
104 #endif
105
105
106 application/mercurial-0.2 is not yet used on non-streaming responses
106 application/mercurial-0.2 is not yet used on non-streaming responses
107
107
108 $ get-with-headers.py --hgproto '0.2' $LOCALIP:$HGPORT '?cmd=heads' -
108 $ get-with-headers.py --hgproto '0.2' $LOCALIP:$HGPORT '?cmd=heads' -
109 200 Script output follows
109 200 Script output follows
110 content-length: 41
110 content-length: 41
111 content-type: application/mercurial-0.1
111 content-type: application/mercurial-0.1
112 date: $HTTP_DATE$
112 date: $HTTP_DATE$
113 server: testing stub value
113 server: testing stub value
114
114
115 e93700bd72895c5addab234c56d4024b487a362f
115 e93700bd72895c5addab234c56d4024b487a362f
116
116
117 Now test protocol preference usage
117 Now test protocol preference usage
118
118
119 $ killdaemons.py
119 $ killdaemons.py
120 $ hg serve --config server.compressionengines=none,zlib -R server -p $HGPORT -d --pid-file hg.pid
120 $ hg serve --config server.compressionengines=none,zlib -R server -p $HGPORT -d --pid-file hg.pid
121 $ cat hg.pid > $DAEMON_PIDS
121 $ cat hg.pid > $DAEMON_PIDS
122
122
123 No Accept will send 0.1+zlib, even though "none" is preferred b/c "none" isn't supported on 0.1
123 No Accept will send 0.1+zlib, even though "none" is preferred b/c "none" isn't supported on 0.1
124
124
125 $ get-with-headers.py --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' Content-Type
125 $ get-with-headers.py --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' Content-Type
126 200 Script output follows
126 200 Script output follows
127 content-type: application/mercurial-0.1
127 content-type: application/mercurial-0.1
128
128
129 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp
129 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp
130 $ f --size --hexdump --bytes 28 --sha1 resp
130 $ f --size --hexdump --bytes 28 --sha1 resp
131 resp: size=227, sha1=35a4c074da74f32f5440da3cbf04
131 resp: size=227, sha1=35a4c074da74f32f5440da3cbf04
132 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu|
132 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu|
133 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 78 |t follows..x|
133 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 78 |t follows..x|
134
134
135 Explicit 0.1 will send zlib because "none" isn't supported on 0.1
135 Explicit 0.1 will send zlib because "none" isn't supported on 0.1
136
136
137 $ get-with-headers.py --hgproto '0.1' $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp
137 $ get-with-headers.py --hgproto '0.1' $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp
138 $ f --size --hexdump --bytes 28 --sha1 resp
138 $ f --size --hexdump --bytes 28 --sha1 resp
139 resp: size=227, sha1=35a4c074da74f32f5440da3cbf04
139 resp: size=227, sha1=35a4c074da74f32f5440da3cbf04
140 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu|
140 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu|
141 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 78 |t follows..x|
141 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 78 |t follows..x|
142
142
143 0.2 with no compression will get "none" because that is server's preference
143 0.2 with no compression will get "none" because that is server's preference
144 (spec says ZL and UN are implicitly supported)
144 (spec says ZL and UN are implicitly supported)
145
145
146 $ get-with-headers.py --hgproto '0.2' $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp
146 $ get-with-headers.py --hgproto '0.2' $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp
147 $ f --size --hexdump --bytes 32 --sha1 resp
147 $ f --size --hexdump --bytes 32 --sha1 resp
148 resp: size=432, sha1=ac931b412ec185a02e0e5bcff98dac83
148 resp: size=432, sha1=ac931b412ec185a02e0e5bcff98dac83
149 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu|
149 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu|
150 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 04 6e 6f 6e 65 |t follows...none|
150 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 04 6e 6f 6e 65 |t follows...none|
151
151
152 Client receives server preference even if local order doesn't match
152 Client receives server preference even if local order doesn't match
153
153
154 $ get-with-headers.py --hgproto '0.2 comp=zlib,none' $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp
154 $ get-with-headers.py --hgproto '0.2 comp=zlib,none' $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp
155 $ f --size --hexdump --bytes 32 --sha1 resp
155 $ f --size --hexdump --bytes 32 --sha1 resp
156 resp: size=432, sha1=ac931b412ec185a02e0e5bcff98dac83
156 resp: size=432, sha1=ac931b412ec185a02e0e5bcff98dac83
157 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu|
157 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu|
158 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 04 6e 6f 6e 65 |t follows...none|
158 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 04 6e 6f 6e 65 |t follows...none|
159
159
160 Client receives only supported format even if not server preferred format
160 Client receives only supported format even if not server preferred format
161
161
162 $ get-with-headers.py --hgproto '0.2 comp=zlib' $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp
162 $ get-with-headers.py --hgproto '0.2 comp=zlib' $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' > resp
163 $ f --size --hexdump --bytes 33 --sha1 resp
163 $ f --size --hexdump --bytes 33 --sha1 resp
164 resp: size=232, sha1=a1c727f0c9693ca15742a75c30419bc36
164 resp: size=232, sha1=a1c727f0c9693ca15742a75c30419bc36
165 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu|
165 0000: 32 30 30 20 53 63 72 69 70 74 20 6f 75 74 70 75 |200 Script outpu|
166 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 04 7a 6c 69 62 |t follows...zlib|
166 0010: 74 20 66 6f 6c 6c 6f 77 73 0a 0a 04 7a 6c 69 62 |t follows...zlib|
167 0020: 78 |x|
167 0020: 78 |x|
168
168
169 $ killdaemons.py
169 $ killdaemons.py
170 $ cd ..
170 $ cd ..
171
171
172 Test listkeys for listing namespaces
172 Test listkeys for listing namespaces
173
173
174 $ hg init empty
174 $ hg init empty
175 $ hg -R empty serve -p $HGPORT -d --pid-file hg.pid
175 $ hg -R empty serve -p $HGPORT -d --pid-file hg.pid
176 $ cat hg.pid > $DAEMON_PIDS
176 $ cat hg.pid > $DAEMON_PIDS
177
177
178 $ hg --verbose debugwireproto http://$LOCALIP:$HGPORT << EOF
178 $ hg --verbose debugwireproto http://$LOCALIP:$HGPORT << EOF
179 > command listkeys
179 > command listkeys
180 > namespace namespaces
180 > namespace namespaces
181 > EOF
181 > EOF
182 s> setsockopt(6, 1, 1) -> None (py3 !)
182 s> setsockopt(6, 1, 1) -> None (py3 !)
183 s> GET /?cmd=capabilities HTTP/1.1\r\n
183 s> GET /?cmd=capabilities HTTP/1.1\r\n
184 s> Accept-Encoding: identity\r\n
184 s> Accept-Encoding: identity\r\n
185 s> accept: application/mercurial-0.1\r\n
185 s> accept: application/mercurial-0.1\r\n
186 s> host: $LOCALIP:$HGPORT\r\n (glob)
186 s> host: $LOCALIP:$HGPORT\r\n (glob)
187 s> user-agent: Mercurial debugwireproto\r\n
187 s> user-agent: Mercurial debugwireproto\r\n
188 s> \r\n
188 s> \r\n
189 s> makefile('rb', None)
189 s> makefile('rb', None)
190 s> HTTP/1.1 200 Script output follows\r\n
190 s> HTTP/1.1 200 Script output follows\r\n
191 s> Server: testing stub value\r\n
191 s> Server: testing stub value\r\n
192 s> Date: $HTTP_DATE$\r\n
192 s> Date: $HTTP_DATE$\r\n
193 s> Content-Type: application/mercurial-0.1\r\n
193 s> Content-Type: application/mercurial-0.1\r\n
194 s> Content-Length: *\r\n (glob)
194 s> Content-Length: *\r\n (glob)
195 s> \r\n
195 s> \r\n
196 s> batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
196 s> batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
197 sending listkeys command
197 sending listkeys command
198 s> setsockopt(6, 1, 1) -> None (py3 !)
198 s> setsockopt(6, 1, 1) -> None (py3 !)
199 s> GET /?cmd=listkeys HTTP/1.1\r\n
199 s> GET /?cmd=listkeys HTTP/1.1\r\n
200 s> Accept-Encoding: identity\r\n
200 s> Accept-Encoding: identity\r\n
201 s> vary: X-HgArg-1,X-HgProto-1\r\n
201 s> vary: X-HgArg-1,X-HgProto-1\r\n
202 s> x-hgarg-1: namespace=namespaces\r\n
202 s> x-hgarg-1: namespace=namespaces\r\n
203 s> x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n
203 s> x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n
204 s> accept: application/mercurial-0.1\r\n
204 s> accept: application/mercurial-0.1\r\n
205 s> host: $LOCALIP:$HGPORT\r\n (glob)
205 s> host: $LOCALIP:$HGPORT\r\n (glob)
206 s> user-agent: Mercurial debugwireproto\r\n
206 s> user-agent: Mercurial debugwireproto\r\n
207 s> \r\n
207 s> \r\n
208 s> makefile('rb', None)
208 s> makefile('rb', None)
209 s> HTTP/1.1 200 Script output follows\r\n
209 s> HTTP/1.1 200 Script output follows\r\n
210 s> Server: testing stub value\r\n
210 s> Server: testing stub value\r\n
211 s> Date: $HTTP_DATE$\r\n
211 s> Date: $HTTP_DATE$\r\n
212 s> Content-Type: application/mercurial-0.1\r\n
212 s> Content-Type: application/mercurial-0.1\r\n
213 s> Content-Length: 30\r\n
213 s> Content-Length: 30\r\n
214 s> \r\n
214 s> \r\n
215 s> bookmarks\t\n
215 s> bookmarks\t\n
216 s> namespaces\t\n
216 s> namespaces\t\n
217 s> phases\t
217 s> phases\t
218 response: {
218 response: {
219 b'bookmarks': b'',
219 b'bookmarks': b'',
220 b'namespaces': b'',
220 b'namespaces': b'',
221 b'phases': b''
221 b'phases': b''
222 }
222 }
223 (sent 2 HTTP requests and * bytes; received * bytes in responses) (glob)
223 (sent 2 HTTP requests and * bytes; received * bytes in responses) (glob)
224
224
225 Same thing, but with "httprequest" command
225 Same thing, but with "httprequest" command
226
226
227 $ hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT << EOF
227 $ hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT << EOF
228 > httprequest GET ?cmd=listkeys
228 > httprequest GET ?cmd=listkeys
229 > user-agent: test
229 > user-agent: test
230 > x-hgarg-1: namespace=namespaces
230 > x-hgarg-1: namespace=namespaces
231 > EOF
231 > EOF
232 using raw connection to peer
232 using raw connection to peer
233 s> setsockopt(6, 1, 1) -> None (py3 !)
233 s> setsockopt(6, 1, 1) -> None (py3 !)
234 s> GET /?cmd=listkeys HTTP/1.1\r\n
234 s> GET /?cmd=listkeys HTTP/1.1\r\n
235 s> Accept-Encoding: identity\r\n
235 s> Accept-Encoding: identity\r\n
236 s> user-agent: test\r\n
236 s> user-agent: test\r\n
237 s> x-hgarg-1: namespace=namespaces\r\n
237 s> x-hgarg-1: namespace=namespaces\r\n
238 s> host: $LOCALIP:$HGPORT\r\n (glob)
238 s> host: $LOCALIP:$HGPORT\r\n (glob)
239 s> \r\n
239 s> \r\n
240 s> makefile('rb', None)
240 s> makefile('rb', None)
241 s> HTTP/1.1 200 Script output follows\r\n
241 s> HTTP/1.1 200 Script output follows\r\n
242 s> Server: testing stub value\r\n
242 s> Server: testing stub value\r\n
243 s> Date: $HTTP_DATE$\r\n
243 s> Date: $HTTP_DATE$\r\n
244 s> Content-Type: application/mercurial-0.1\r\n
244 s> Content-Type: application/mercurial-0.1\r\n
245 s> Content-Length: 30\r\n
245 s> Content-Length: 30\r\n
246 s> \r\n
246 s> \r\n
247 s> bookmarks\t\n
247 s> bookmarks\t\n
248 s> namespaces\t\n
248 s> namespaces\t\n
249 s> phases\t
249 s> phases\t
250
250
251 Client with HTTPv2 enabled advertises that and gets old capabilities response from old server
251 Client with HTTPv2 enabled advertises that and gets old capabilities response from old server
252
252
253 $ hg --config experimental.httppeer.advertise-v2=true --verbose debugwireproto http://$LOCALIP:$HGPORT << EOF
253 $ hg --config experimental.httppeer.advertise-v2=true --verbose debugwireproto http://$LOCALIP:$HGPORT << EOF
254 > command heads
254 > command heads
255 > EOF
255 > EOF
256 s> setsockopt(6, 1, 1) -> None (py3 !)
256 s> setsockopt(6, 1, 1) -> None (py3 !)
257 s> GET /?cmd=capabilities HTTP/1.1\r\n
257 s> GET /?cmd=capabilities HTTP/1.1\r\n
258 s> Accept-Encoding: identity\r\n
258 s> Accept-Encoding: identity\r\n
259 s> vary: X-HgProto-1,X-HgUpgrade-1\r\n
259 s> vary: X-HgProto-1,X-HgUpgrade-1\r\n
260 s> x-hgproto-1: cbor\r\n
260 s> x-hgproto-1: cbor\r\n
261 s> x-hgupgrade-1: exp-http-v2-0003\r\n
261 s> x-hgupgrade-1: exp-http-v2-0003\r\n
262 s> accept: application/mercurial-0.1\r\n
262 s> accept: application/mercurial-0.1\r\n
263 s> host: $LOCALIP:$HGPORT\r\n (glob)
263 s> host: $LOCALIP:$HGPORT\r\n (glob)
264 s> user-agent: Mercurial debugwireproto\r\n
264 s> user-agent: Mercurial debugwireproto\r\n
265 s> \r\n
265 s> \r\n
266 s> makefile('rb', None)
266 s> makefile('rb', None)
267 s> HTTP/1.1 200 Script output follows\r\n
267 s> HTTP/1.1 200 Script output follows\r\n
268 s> Server: testing stub value\r\n
268 s> Server: testing stub value\r\n
269 s> Date: $HTTP_DATE$\r\n
269 s> Date: $HTTP_DATE$\r\n
270 s> Content-Type: application/mercurial-0.1\r\n
270 s> Content-Type: application/mercurial-0.1\r\n
271 s> Content-Length: *\r\n (glob)
271 s> Content-Length: *\r\n (glob)
272 s> \r\n
272 s> \r\n
273 s> batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
273 s> batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
274 sending heads command
274 sending heads command
275 s> setsockopt(6, 1, 1) -> None (py3 !)
275 s> setsockopt(6, 1, 1) -> None (py3 !)
276 s> GET /?cmd=heads HTTP/1.1\r\n
276 s> GET /?cmd=heads HTTP/1.1\r\n
277 s> Accept-Encoding: identity\r\n
277 s> Accept-Encoding: identity\r\n
278 s> vary: X-HgProto-1\r\n
278 s> vary: X-HgProto-1\r\n
279 s> x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n
279 s> x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n
280 s> accept: application/mercurial-0.1\r\n
280 s> accept: application/mercurial-0.1\r\n
281 s> host: $LOCALIP:$HGPORT\r\n (glob)
281 s> host: $LOCALIP:$HGPORT\r\n (glob)
282 s> user-agent: Mercurial debugwireproto\r\n
282 s> user-agent: Mercurial debugwireproto\r\n
283 s> \r\n
283 s> \r\n
284 s> makefile('rb', None)
284 s> makefile('rb', None)
285 s> HTTP/1.1 200 Script output follows\r\n
285 s> HTTP/1.1 200 Script output follows\r\n
286 s> Server: testing stub value\r\n
286 s> Server: testing stub value\r\n
287 s> Date: $HTTP_DATE$\r\n
287 s> Date: $HTTP_DATE$\r\n
288 s> Content-Type: application/mercurial-0.1\r\n
288 s> Content-Type: application/mercurial-0.1\r\n
289 s> Content-Length: 41\r\n
289 s> Content-Length: 41\r\n
290 s> \r\n
290 s> \r\n
291 s> 0000000000000000000000000000000000000000\n
291 s> 0000000000000000000000000000000000000000\n
292 response: [
292 response: [
293 b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
293 b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
294 ]
294 ]
295 (sent 2 HTTP requests and * bytes; received * bytes in responses) (glob)
295 (sent 2 HTTP requests and * bytes; received * bytes in responses) (glob)
296
296
297 $ killdaemons.py
297 $ killdaemons.py
298 $ enablehttpv2 empty
298 $ enablehttpv2 empty
299 $ hg --config server.compressionengines=zlib -R empty serve -p $HGPORT -d --pid-file hg.pid
299 $ hg --config server.compressionengines=zlib -R empty serve -p $HGPORT -d --pid-file hg.pid
300 $ cat hg.pid > $DAEMON_PIDS
300 $ cat hg.pid > $DAEMON_PIDS
301
301
302 Client with HTTPv2 enabled automatically upgrades if the server supports it
302 Client with HTTPv2 enabled automatically upgrades if the server supports it
303
303
304 $ hg --config experimental.httppeer.advertise-v2=true --config experimental.httppeer.v2-encoder-order=identity --verbose debugwireproto http://$LOCALIP:$HGPORT << EOF
304 $ hg --config experimental.httppeer.advertise-v2=true --config experimental.httppeer.v2-encoder-order=identity --verbose debugwireproto http://$LOCALIP:$HGPORT << EOF
305 > command heads
305 > command heads
306 > EOF
306 > EOF
307 s> setsockopt(6, 1, 1) -> None (py3 !)
307 s> setsockopt(6, 1, 1) -> None (py3 !)
308 s> GET /?cmd=capabilities HTTP/1.1\r\n
308 s> GET /?cmd=capabilities HTTP/1.1\r\n
309 s> Accept-Encoding: identity\r\n
309 s> Accept-Encoding: identity\r\n
310 s> vary: X-HgProto-1,X-HgUpgrade-1\r\n
310 s> vary: X-HgProto-1,X-HgUpgrade-1\r\n
311 s> x-hgproto-1: cbor\r\n
311 s> x-hgproto-1: cbor\r\n
312 s> x-hgupgrade-1: exp-http-v2-0003\r\n
312 s> x-hgupgrade-1: exp-http-v2-0003\r\n
313 s> accept: application/mercurial-0.1\r\n
313 s> accept: application/mercurial-0.1\r\n
314 s> host: $LOCALIP:$HGPORT\r\n (glob)
314 s> host: $LOCALIP:$HGPORT\r\n (glob)
315 s> user-agent: Mercurial debugwireproto\r\n
315 s> user-agent: Mercurial debugwireproto\r\n
316 s> \r\n
316 s> \r\n
317 s> makefile('rb', None)
317 s> makefile('rb', None)
318 s> HTTP/1.1 200 OK\r\n
318 s> HTTP/1.1 200 OK\r\n
319 s> Server: testing stub value\r\n
319 s> Server: testing stub value\r\n
320 s> Date: $HTTP_DATE$\r\n
320 s> Date: $HTTP_DATE$\r\n
321 s> Content-Type: application/mercurial-cbor\r\n
321 s> Content-Type: application/mercurial-cbor\r\n
322 s> Content-Length: *\r\n (glob)
322 s> Content-Length: *\r\n (glob)
323 s> \r\n
323 s> \r\n
324 s> \xa3GapibaseDapi/Dapis\xa1Pexp-http-v2-0003\xa4Hcommands\xacIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullMchangesetdata\xa2Dargs\xa2Ffields\xa4Gdefault\xd9\x01\x02\x80Hrequired\xf4DtypeCsetKvalidvalues\xd9\x01\x02\x84IbookmarksGparentsEphaseHrevisionIrevisions\xa2Hrequired\xf5DtypeDlistKpermissions\x81DpullHfiledata\xa2Dargs\xa4Ffields\xa4Gdefault\xd9\x01\x02\x80Hrequired\xf4DtypeCsetKvalidvalues\xd9\x01\x02\x83HlinknodeGparentsHrevisionKhaveparents\xa3Gdefault\xf4Hrequired\xf4DtypeDboolEnodes\xa2Hrequired\xf5DtypeDlistDpath\xa2Hrequired\xf5DtypeEbytesKpermissions\x81DpullIfilesdata\xa3Dargs\xa4Ffields\xa4Gdefault\xd9\x01\x02\x80Hrequired\xf4DtypeCsetKvalidvalues\xd9\x01\x02\x84NfirstchangesetHlinknodeGparentsHrevisionKhaveparents\xa3Gdefault\xf4Hrequired\xf4DtypeDboolJpathfilter\xa3Gdefault\xf6Hrequired\xf4DtypeDdictIrevisions\xa2Hrequired\xf5DtypeDlistKpermissions\x81DpullTrecommendedbatchsize\x19\xc3PEheads\xa2Dargs\xa1Jpubliconly\xa3Gdefault\xf4Hrequired\xf4DtypeDboolKpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\xa3Gdefault\x80Hrequired\xf4DtypeDlistKpermissions\x81DpullHlistkeys\xa2Dargs\xa1Inamespace\xa2Hrequired\xf5DtypeEbytesKpermissions\x81DpullFlookup\xa2Dargs\xa1Ckey\xa2Hrequired\xf5DtypeEbytesKpermissions\x81DpullLmanifestdata\xa3Dargs\xa4Ffields\xa4Gdefault\xd9\x01\x02\x80Hrequired\xf4DtypeCsetKvalidvalues\xd9\x01\x02\x82GparentsHrevisionKhaveparents\xa3Gdefault\xf4Hrequired\xf4DtypeDboolEnodes\xa2Hrequired\xf5DtypeDlistDtree\xa2Hrequired\xf5DtypeEbytesKpermissions\x81DpullTrecommendedbatchsize\x1a\x00\x01\x86\xa0Gpushkey\xa2Dargs\xa4Ckey\xa2Hrequired\xf5DtypeEbytesInamespace\xa2Hrequired\xf5DtypeEbytesCnew\xa2Hrequired\xf5DtypeEbytesCold\xa2Hrequired\xf5DtypeEbytesKpermissions\x81DpushPrawstorefiledata\xa2Dargs\xa2Efiles\xa2Hrequired\xf5DtypeDlistJpathfilter\xa3Gdefault\xf6Hrequired\xf4DtypeDlistKpermissions\x81DpullQframingmediatypes\x81X&application/mercurial-exp-framing-0006Rpathfilterprefixes\xd9\x01\x02\x82Epath:Lrootfilesin:Nrawrepoformats\x83LgeneraldeltaHrevlogv1LsparserevlogNv1capabilitiesY\x01\xe0batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
324 s> \xa3GapibaseDapi/Dapis\xa1Pexp-http-v2-0003\xa4Hcommands\xacIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullMchangesetdata\xa2Dargs\xa2Ffields\xa4Gdefault\xd9\x01\x02\x80Hrequired\xf4DtypeCsetKvalidvalues\xd9\x01\x02\x84IbookmarksGparentsEphaseHrevisionIrevisions\xa2Hrequired\xf5DtypeDlistKpermissions\x81DpullHfiledata\xa2Dargs\xa4Ffields\xa4Gdefault\xd9\x01\x02\x80Hrequired\xf4DtypeCsetKvalidvalues\xd9\x01\x02\x83HlinknodeGparentsHrevisionKhaveparents\xa3Gdefault\xf4Hrequired\xf4DtypeDboolEnodes\xa2Hrequired\xf5DtypeDlistDpath\xa2Hrequired\xf5DtypeEbytesKpermissions\x81DpullIfilesdata\xa3Dargs\xa4Ffields\xa4Gdefault\xd9\x01\x02\x80Hrequired\xf4DtypeCsetKvalidvalues\xd9\x01\x02\x84NfirstchangesetHlinknodeGparentsHrevisionKhaveparents\xa3Gdefault\xf4Hrequired\xf4DtypeDboolJpathfilter\xa3Gdefault\xf6Hrequired\xf4DtypeDdictIrevisions\xa2Hrequired\xf5DtypeDlistKpermissions\x81DpullTrecommendedbatchsize\x19\xc3PEheads\xa2Dargs\xa1Jpubliconly\xa3Gdefault\xf4Hrequired\xf4DtypeDboolKpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\xa3Gdefault\x80Hrequired\xf4DtypeDlistKpermissions\x81DpullHlistkeys\xa2Dargs\xa1Inamespace\xa2Hrequired\xf5DtypeEbytesKpermissions\x81DpullFlookup\xa2Dargs\xa1Ckey\xa2Hrequired\xf5DtypeEbytesKpermissions\x81DpullLmanifestdata\xa3Dargs\xa4Ffields\xa4Gdefault\xd9\x01\x02\x80Hrequired\xf4DtypeCsetKvalidvalues\xd9\x01\x02\x82GparentsHrevisionKhaveparents\xa3Gdefault\xf4Hrequired\xf4DtypeDboolEnodes\xa2Hrequired\xf5DtypeDlistDtree\xa2Hrequired\xf5DtypeEbytesKpermissions\x81DpullTrecommendedbatchsize\x1a\x00\x01\x86\xa0Gpushkey\xa2Dargs\xa4Ckey\xa2Hrequired\xf5DtypeEbytesInamespace\xa2Hrequired\xf5DtypeEbytesCnew\xa2Hrequired\xf5DtypeEbytesCold\xa2Hrequired\xf5DtypeEbytesKpermissions\x81DpushPrawstorefiledata\xa2Dargs\xa2Efiles\xa2Hrequired\xf5DtypeDlistJpathfilter\xa3Gdefault\xf6Hrequired\xf4DtypeDlistKpermissions\x81DpullQframingmediatypes\x81X&application/mercurial-exp-framing-0006Rpathfilterprefixes\xd9\x01\x02\x82Epath:Lrootfilesin:Nrawrepoformats\x83LgeneraldeltaHrevlogv1LsparserevlogNv1capabilitiesY\x01\xe0batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
325 sending heads command
325 sending heads command
326 s> setsockopt(6, 1, 1) -> None (py3 !)
326 s> setsockopt(6, 1, 1) -> None (py3 !)
327 s> POST /api/exp-http-v2-0003/ro/heads HTTP/1.1\r\n
327 s> POST /api/exp-http-v2-0003/ro/heads HTTP/1.1\r\n
328 s> Accept-Encoding: identity\r\n
328 s> Accept-Encoding: identity\r\n
329 s> accept: application/mercurial-exp-framing-0006\r\n
329 s> accept: application/mercurial-exp-framing-0006\r\n
330 s> content-type: application/mercurial-exp-framing-0006\r\n
330 s> content-type: application/mercurial-exp-framing-0006\r\n
331 s> content-length: 56\r\n
331 s> content-length: 56\r\n
332 s> host: $LOCALIP:$HGPORT\r\n (glob)
332 s> host: $LOCALIP:$HGPORT\r\n (glob)
333 s> user-agent: Mercurial debugwireproto\r\n
333 s> user-agent: Mercurial debugwireproto\r\n
334 s> \r\n
334 s> \r\n
335 s> \x1c\x00\x00\x01\x00\x01\x01\x82\xa1Pcontentencodings\x81Hidentity\x0c\x00\x00\x01\x00\x01\x00\x11\xa1DnameEheads
335 s> \x1c\x00\x00\x01\x00\x01\x01\x82\xa1Pcontentencodings\x81Hidentity\x0c\x00\x00\x01\x00\x01\x00\x11\xa1DnameEheads
336 s> makefile('rb', None)
336 s> makefile('rb', None)
337 s> HTTP/1.1 200 OK\r\n
337 s> HTTP/1.1 200 OK\r\n
338 s> Server: testing stub value\r\n
338 s> Server: testing stub value\r\n
339 s> Date: $HTTP_DATE$\r\n
339 s> Date: $HTTP_DATE$\r\n
340 s> Content-Type: application/mercurial-exp-framing-0006\r\n
340 s> Content-Type: application/mercurial-exp-framing-0006\r\n
341 s> Transfer-Encoding: chunked\r\n
341 s> Transfer-Encoding: chunked\r\n
342 s> \r\n
342 s> \r\n
343 s> 11\r\n
343 s> 11\r\n
344 s> \t\x00\x00\x01\x00\x02\x01\x92
344 s> \t\x00\x00\x01\x00\x02\x01\x92
345 s> Hidentity
345 s> Hidentity
346 s> \r\n
346 s> \r\n
347 s> 13\r\n
347 s> 13\r\n
348 s> \x0b\x00\x00\x01\x00\x02\x041
348 s> \x0b\x00\x00\x01\x00\x02\x041
349 s> \xa1FstatusBok
349 s> \xa1FstatusBok
350 s> \r\n
350 s> \r\n
351 s> 1e\r\n
351 s> 1e\r\n
352 s> \x16\x00\x00\x01\x00\x02\x041
352 s> \x16\x00\x00\x01\x00\x02\x041
353 s> \x81T\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
353 s> \x81T\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
354 s> \r\n
354 s> \r\n
355 s> 8\r\n
355 s> 8\r\n
356 s> \x00\x00\x00\x01\x00\x02\x002
356 s> \x00\x00\x00\x01\x00\x02\x002
357 s> \r\n
357 s> \r\n
358 s> 0\r\n
358 s> 0\r\n
359 s> \r\n
359 s> \r\n
360 response: [
360 response: [
361 b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
361 b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
362 ]
362 ]
363 (sent 2 HTTP requests and * bytes; received * bytes in responses) (glob)
363 (sent 2 HTTP requests and * bytes; received * bytes in responses) (glob)
364
364
365 $ killdaemons.py
365 $ killdaemons.py
366
366
367 HTTP client follows HTTP redirect on handshake to new repo
367 HTTP client follows HTTP redirect on handshake to new repo
368
368
369 $ cd $TESTTMP
369 $ cd $TESTTMP
370
370
371 $ hg init redirector
371 $ hg init redirector
372 $ hg init redirected
372 $ hg init redirected
373 $ cd redirected
373 $ cd redirected
374 $ touch foo
374 $ touch foo
375 $ hg -q commit -A -m initial
375 $ hg -q commit -A -m initial
376 $ cd ..
376 $ cd ..
377
377
378 $ cat > paths.conf << EOF
378 $ cat > paths.conf << EOF
379 > [paths]
379 > [paths]
380 > / = $TESTTMP/*
380 > / = $TESTTMP/*
381 > EOF
381 > EOF
382
382
383 $ cat > redirectext.py << EOF
383 $ cat > redirectext.py << EOF
384 > from mercurial import extensions, wireprotoserver
384 > from mercurial import extensions, wireprotoserver
385 > def wrappedcallhttp(orig, repo, req, res, proto, cmd):
385 > def wrappedcallhttp(orig, repo, req, res, proto, cmd):
386 > path = req.advertisedurl[len(req.advertisedbaseurl):]
386 > path = req.advertisedurl[len(req.advertisedbaseurl):]
387 > if not path.startswith(b'/redirector'):
387 > if not path.startswith(b'/redirector'):
388 > return orig(repo, req, res, proto, cmd)
388 > return orig(repo, req, res, proto, cmd)
389 > relpath = path[len(b'/redirector'):]
389 > relpath = path[len(b'/redirector'):]
390 > res.status = b'301 Redirect'
390 > res.status = b'301 Redirect'
391 > newurl = b'%s/redirected%s' % (req.baseurl, relpath)
391 > newurl = b'%s/redirected%s' % (req.baseurl, relpath)
392 > if not repo.ui.configbool('testing', 'redirectqs', True) and b'?' in newurl:
392 > if not repo.ui.configbool(b'testing', b'redirectqs', True) and b'?' in newurl:
393 > newurl = newurl[0:newurl.index(b'?')]
393 > newurl = newurl[0:newurl.index(b'?')]
394 > res.headers[b'Location'] = newurl
394 > res.headers[b'Location'] = newurl
395 > res.headers[b'Content-Type'] = b'text/plain'
395 > res.headers[b'Content-Type'] = b'text/plain'
396 > res.setbodybytes(b'redirected')
396 > res.setbodybytes(b'redirected')
397 > return True
397 > return True
398 >
398 >
399 > extensions.wrapfunction(wireprotoserver, '_callhttp', wrappedcallhttp)
399 > extensions.wrapfunction(wireprotoserver, '_callhttp', wrappedcallhttp)
400 > EOF
400 > EOF
401
401
402 $ hg --config extensions.redirect=$TESTTMP/redirectext.py \
402 $ hg --config extensions.redirect=$TESTTMP/redirectext.py \
403 > --config server.compressionengines=zlib \
403 > --config server.compressionengines=zlib \
404 > serve --web-conf paths.conf --pid-file hg.pid -p $HGPORT -d
404 > serve --web-conf paths.conf --pid-file hg.pid -p $HGPORT -d
405 $ cat hg.pid > $DAEMON_PIDS
405 $ cat hg.pid > $DAEMON_PIDS
406
406
407 Verify our HTTP 301 is served properly
407 Verify our HTTP 301 is served properly
408
408
409 $ hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT << EOF
409 $ hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT << EOF
410 > httprequest GET /redirector?cmd=capabilities
410 > httprequest GET /redirector?cmd=capabilities
411 > user-agent: test
411 > user-agent: test
412 > EOF
412 > EOF
413 using raw connection to peer
413 using raw connection to peer
414 s> setsockopt(6, 1, 1) -> None (py3 !)
414 s> setsockopt(6, 1, 1) -> None (py3 !)
415 s> GET /redirector?cmd=capabilities HTTP/1.1\r\n
415 s> GET /redirector?cmd=capabilities HTTP/1.1\r\n
416 s> Accept-Encoding: identity\r\n
416 s> Accept-Encoding: identity\r\n
417 s> user-agent: test\r\n
417 s> user-agent: test\r\n
418 s> host: $LOCALIP:$HGPORT\r\n (glob)
418 s> host: $LOCALIP:$HGPORT\r\n (glob)
419 s> \r\n
419 s> \r\n
420 s> makefile('rb', None)
420 s> makefile('rb', None)
421 s> HTTP/1.1 301 Redirect\r\n
421 s> HTTP/1.1 301 Redirect\r\n
422 s> Server: testing stub value\r\n
422 s> Server: testing stub value\r\n
423 s> Date: $HTTP_DATE$\r\n
423 s> Date: $HTTP_DATE$\r\n
424 s> Location: http://$LOCALIP:$HGPORT/redirected?cmd=capabilities\r\n (glob)
424 s> Location: http://$LOCALIP:$HGPORT/redirected?cmd=capabilities\r\n (glob)
425 s> Content-Type: text/plain\r\n
425 s> Content-Type: text/plain\r\n
426 s> Content-Length: 10\r\n
426 s> Content-Length: 10\r\n
427 s> \r\n
427 s> \r\n
428 s> redirected
428 s> redirected
429 s> setsockopt(6, 1, 1) -> None (py3 !)
429 s> setsockopt(6, 1, 1) -> None (py3 !)
430 s> GET /redirected?cmd=capabilities HTTP/1.1\r\n
430 s> GET /redirected?cmd=capabilities HTTP/1.1\r\n
431 s> Accept-Encoding: identity\r\n
431 s> Accept-Encoding: identity\r\n
432 s> user-agent: test\r\n
432 s> user-agent: test\r\n
433 s> host: $LOCALIP:$HGPORT\r\n (glob)
433 s> host: $LOCALIP:$HGPORT\r\n (glob)
434 s> \r\n
434 s> \r\n
435 s> makefile('rb', None)
435 s> makefile('rb', None)
436 s> HTTP/1.1 200 Script output follows\r\n
436 s> HTTP/1.1 200 Script output follows\r\n
437 s> Server: testing stub value\r\n
437 s> Server: testing stub value\r\n
438 s> Date: $HTTP_DATE$\r\n
438 s> Date: $HTTP_DATE$\r\n
439 s> Content-Type: application/mercurial-0.1\r\n
439 s> Content-Type: application/mercurial-0.1\r\n
440 s> Content-Length: 480\r\n
440 s> Content-Length: 480\r\n
441 s> \r\n
441 s> \r\n
442 s> batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
442 s> batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
443
443
444 Test with the HTTP peer
444 Test with the HTTP peer
445
445
446 $ hg --verbose debugwireproto http://$LOCALIP:$HGPORT/redirector << EOF
446 $ hg --verbose debugwireproto http://$LOCALIP:$HGPORT/redirector << EOF
447 > command heads
447 > command heads
448 > EOF
448 > EOF
449 s> setsockopt(6, 1, 1) -> None (py3 !)
449 s> setsockopt(6, 1, 1) -> None (py3 !)
450 s> GET /redirector?cmd=capabilities HTTP/1.1\r\n
450 s> GET /redirector?cmd=capabilities HTTP/1.1\r\n
451 s> Accept-Encoding: identity\r\n
451 s> Accept-Encoding: identity\r\n
452 s> accept: application/mercurial-0.1\r\n
452 s> accept: application/mercurial-0.1\r\n
453 s> host: $LOCALIP:$HGPORT\r\n (glob)
453 s> host: $LOCALIP:$HGPORT\r\n (glob)
454 s> user-agent: Mercurial debugwireproto\r\n
454 s> user-agent: Mercurial debugwireproto\r\n
455 s> \r\n
455 s> \r\n
456 s> makefile('rb', None)
456 s> makefile('rb', None)
457 s> HTTP/1.1 301 Redirect\r\n
457 s> HTTP/1.1 301 Redirect\r\n
458 s> Server: testing stub value\r\n
458 s> Server: testing stub value\r\n
459 s> Date: $HTTP_DATE$\r\n
459 s> Date: $HTTP_DATE$\r\n
460 s> Location: http://$LOCALIP:$HGPORT/redirected?cmd=capabilities\r\n (glob)
460 s> Location: http://$LOCALIP:$HGPORT/redirected?cmd=capabilities\r\n (glob)
461 s> Content-Type: text/plain\r\n
461 s> Content-Type: text/plain\r\n
462 s> Content-Length: 10\r\n
462 s> Content-Length: 10\r\n
463 s> \r\n
463 s> \r\n
464 s> redirected
464 s> redirected
465 s> setsockopt(6, 1, 1) -> None (py3 !)
465 s> setsockopt(6, 1, 1) -> None (py3 !)
466 s> GET /redirected?cmd=capabilities HTTP/1.1\r\n
466 s> GET /redirected?cmd=capabilities HTTP/1.1\r\n
467 s> Accept-Encoding: identity\r\n
467 s> Accept-Encoding: identity\r\n
468 s> accept: application/mercurial-0.1\r\n
468 s> accept: application/mercurial-0.1\r\n
469 s> host: $LOCALIP:$HGPORT\r\n (glob)
469 s> host: $LOCALIP:$HGPORT\r\n (glob)
470 s> user-agent: Mercurial debugwireproto\r\n
470 s> user-agent: Mercurial debugwireproto\r\n
471 s> \r\n
471 s> \r\n
472 s> makefile('rb', None)
472 s> makefile('rb', None)
473 s> HTTP/1.1 200 Script output follows\r\n
473 s> HTTP/1.1 200 Script output follows\r\n
474 s> Server: testing stub value\r\n
474 s> Server: testing stub value\r\n
475 s> Date: $HTTP_DATE$\r\n
475 s> Date: $HTTP_DATE$\r\n
476 s> Content-Type: application/mercurial-0.1\r\n
476 s> Content-Type: application/mercurial-0.1\r\n
477 s> Content-Length: 480\r\n
477 s> Content-Length: 480\r\n
478 s> \r\n
478 s> \r\n
479 real URL is http://$LOCALIP:$HGPORT/redirected (glob)
479 real URL is http://$LOCALIP:$HGPORT/redirected (glob)
480 s> batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
480 s> batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
481 sending heads command
481 sending heads command
482 s> setsockopt(6, 1, 1) -> None (py3 !)
482 s> setsockopt(6, 1, 1) -> None (py3 !)
483 s> GET /redirected?cmd=heads HTTP/1.1\r\n
483 s> GET /redirected?cmd=heads HTTP/1.1\r\n
484 s> Accept-Encoding: identity\r\n
484 s> Accept-Encoding: identity\r\n
485 s> vary: X-HgProto-1\r\n
485 s> vary: X-HgProto-1\r\n
486 s> x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n
486 s> x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n
487 s> accept: application/mercurial-0.1\r\n
487 s> accept: application/mercurial-0.1\r\n
488 s> host: $LOCALIP:$HGPORT\r\n (glob)
488 s> host: $LOCALIP:$HGPORT\r\n (glob)
489 s> user-agent: Mercurial debugwireproto\r\n
489 s> user-agent: Mercurial debugwireproto\r\n
490 s> \r\n
490 s> \r\n
491 s> makefile('rb', None)
491 s> makefile('rb', None)
492 s> HTTP/1.1 200 Script output follows\r\n
492 s> HTTP/1.1 200 Script output follows\r\n
493 s> Server: testing stub value\r\n
493 s> Server: testing stub value\r\n
494 s> Date: $HTTP_DATE$\r\n
494 s> Date: $HTTP_DATE$\r\n
495 s> Content-Type: application/mercurial-0.1\r\n
495 s> Content-Type: application/mercurial-0.1\r\n
496 s> Content-Length: 41\r\n
496 s> Content-Length: 41\r\n
497 s> \r\n
497 s> \r\n
498 s> 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n
498 s> 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n
499 response: [
499 response: [
500 b'\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL'
500 b'\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL'
501 ]
501 ]
502 (sent 3 HTTP requests and * bytes; received * bytes in responses) (glob)
502 (sent 3 HTTP requests and * bytes; received * bytes in responses) (glob)
503
503
504 $ killdaemons.py
504 $ killdaemons.py
505
505
506 Now test a variation where we strip the query string from the redirect URL.
506 Now test a variation where we strip the query string from the redirect URL.
507 (SCM Manager apparently did this and clients would recover from it)
507 (SCM Manager apparently did this and clients would recover from it)
508
508
509 $ hg --config extensions.redirect=$TESTTMP/redirectext.py \
509 $ hg --config extensions.redirect=$TESTTMP/redirectext.py \
510 > --config server.compressionengines=zlib \
510 > --config server.compressionengines=zlib \
511 > --config testing.redirectqs=false \
511 > --config testing.redirectqs=false \
512 > serve --web-conf paths.conf --pid-file hg.pid -p $HGPORT -d
512 > serve --web-conf paths.conf --pid-file hg.pid -p $HGPORT -d
513 $ cat hg.pid > $DAEMON_PIDS
513 $ cat hg.pid > $DAEMON_PIDS
514
514
515 $ hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT << EOF
515 $ hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT << EOF
516 > httprequest GET /redirector?cmd=capabilities
516 > httprequest GET /redirector?cmd=capabilities
517 > user-agent: test
517 > user-agent: test
518 > EOF
518 > EOF
519 using raw connection to peer
519 using raw connection to peer
520 s> setsockopt(6, 1, 1) -> None (py3 !)
520 s> setsockopt(6, 1, 1) -> None (py3 !)
521 s> GET /redirector?cmd=capabilities HTTP/1.1\r\n
521 s> GET /redirector?cmd=capabilities HTTP/1.1\r\n
522 s> Accept-Encoding: identity\r\n
522 s> Accept-Encoding: identity\r\n
523 s> user-agent: test\r\n
523 s> user-agent: test\r\n
524 s> host: $LOCALIP:$HGPORT\r\n (glob)
524 s> host: $LOCALIP:$HGPORT\r\n (glob)
525 s> \r\n
525 s> \r\n
526 s> makefile('rb', None)
526 s> makefile('rb', None)
527 s> HTTP/1.1 301 Redirect\r\n
527 s> HTTP/1.1 301 Redirect\r\n
528 s> Server: testing stub value\r\n
528 s> Server: testing stub value\r\n
529 s> Date: $HTTP_DATE$\r\n
529 s> Date: $HTTP_DATE$\r\n
530 s> Location: http://$LOCALIP:$HGPORT/redirected\r\n (glob)
530 s> Location: http://$LOCALIP:$HGPORT/redirected\r\n (glob)
531 s> Content-Type: text/plain\r\n
531 s> Content-Type: text/plain\r\n
532 s> Content-Length: 10\r\n
532 s> Content-Length: 10\r\n
533 s> \r\n
533 s> \r\n
534 s> redirected
534 s> redirected
535 s> setsockopt(6, 1, 1) -> None (py3 !)
535 s> setsockopt(6, 1, 1) -> None (py3 !)
536 s> GET /redirected HTTP/1.1\r\n
536 s> GET /redirected HTTP/1.1\r\n
537 s> Accept-Encoding: identity\r\n
537 s> Accept-Encoding: identity\r\n
538 s> user-agent: test\r\n
538 s> user-agent: test\r\n
539 s> host: $LOCALIP:$HGPORT\r\n (glob)
539 s> host: $LOCALIP:$HGPORT\r\n (glob)
540 s> \r\n
540 s> \r\n
541 s> makefile('rb', None)
541 s> makefile('rb', None)
542 s> HTTP/1.1 200 Script output follows\r\n
542 s> HTTP/1.1 200 Script output follows\r\n
543 s> Server: testing stub value\r\n
543 s> Server: testing stub value\r\n
544 s> Date: $HTTP_DATE$\r\n
544 s> Date: $HTTP_DATE$\r\n
545 s> ETag: W/"*"\r\n (glob)
545 s> ETag: W/"*"\r\n (glob)
546 s> Content-Type: text/html; charset=ascii\r\n
546 s> Content-Type: text/html; charset=ascii\r\n
547 s> Transfer-Encoding: chunked\r\n
547 s> Transfer-Encoding: chunked\r\n
548 s> \r\n
548 s> \r\n
549 s> 414\r\n
549 s> 414\r\n
550 s> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n
550 s> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n
551 s> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">\n
551 s> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">\n
552 s> <head>\n
552 s> <head>\n
553 s> <link rel="icon" href="/redirected/static/hgicon.png" type="image/png" />\n
553 s> <link rel="icon" href="/redirected/static/hgicon.png" type="image/png" />\n
554 s> <meta name="robots" content="index, nofollow" />\n
554 s> <meta name="robots" content="index, nofollow" />\n
555 s> <link rel="stylesheet" href="/redirected/static/style-paper.css" type="text/css" />\n
555 s> <link rel="stylesheet" href="/redirected/static/style-paper.css" type="text/css" />\n
556 s> <script type="text/javascript" src="/redirected/static/mercurial.js"></script>\n
556 s> <script type="text/javascript" src="/redirected/static/mercurial.js"></script>\n
557 s> \n
557 s> \n
558 s> <title>redirected: log</title>\n
558 s> <title>redirected: log</title>\n
559 s> <link rel="alternate" type="application/atom+xml"\n
559 s> <link rel="alternate" type="application/atom+xml"\n
560 s> href="/redirected/atom-log" title="Atom feed for redirected" />\n
560 s> href="/redirected/atom-log" title="Atom feed for redirected" />\n
561 s> <link rel="alternate" type="application/rss+xml"\n
561 s> <link rel="alternate" type="application/rss+xml"\n
562 s> href="/redirected/rss-log" title="RSS feed for redirected" />\n
562 s> href="/redirected/rss-log" title="RSS feed for redirected" />\n
563 s> </head>\n
563 s> </head>\n
564 s> <body>\n
564 s> <body>\n
565 s> \n
565 s> \n
566 s> <div class="container">\n
566 s> <div class="container">\n
567 s> <div class="menu">\n
567 s> <div class="menu">\n
568 s> <div class="logo">\n
568 s> <div class="logo">\n
569 s> <a href="https://mercurial-scm.org/">\n
569 s> <a href="https://mercurial-scm.org/">\n
570 s> <img src="/redirected/static/hglogo.png" alt="mercurial" /></a>\n
570 s> <img src="/redirected/static/hglogo.png" alt="mercurial" /></a>\n
571 s> </div>\n
571 s> </div>\n
572 s> <ul>\n
572 s> <ul>\n
573 s> <li class="active">log</li>\n
573 s> <li class="active">log</li>\n
574 s> <li><a href="/redirected/graph/tip">graph</a></li>\n
574 s> <li><a href="/redirected/graph/tip">graph</a></li>\n
575 s> <li><a href="/redirected/tags">tags</a></li>\n
575 s> <li><a href="/redirected/tags">tags</a></li>\n
576 s> <li><a href="
576 s> <li><a href="
577 s> \r\n
577 s> \r\n
578 s> 810\r\n
578 s> 810\r\n
579 s> /redirected/bookmarks">bookmarks</a></li>\n
579 s> /redirected/bookmarks">bookmarks</a></li>\n
580 s> <li><a href="/redirected/branches">branches</a></li>\n
580 s> <li><a href="/redirected/branches">branches</a></li>\n
581 s> </ul>\n
581 s> </ul>\n
582 s> <ul>\n
582 s> <ul>\n
583 s> <li><a href="/redirected/rev/tip">changeset</a></li>\n
583 s> <li><a href="/redirected/rev/tip">changeset</a></li>\n
584 s> <li><a href="/redirected/file/tip">browse</a></li>\n
584 s> <li><a href="/redirected/file/tip">browse</a></li>\n
585 s> </ul>\n
585 s> </ul>\n
586 s> <ul>\n
586 s> <ul>\n
587 s> \n
587 s> \n
588 s> </ul>\n
588 s> </ul>\n
589 s> <ul>\n
589 s> <ul>\n
590 s> <li><a href="/redirected/help">help</a></li>\n
590 s> <li><a href="/redirected/help">help</a></li>\n
591 s> </ul>\n
591 s> </ul>\n
592 s> <div class="atom-logo">\n
592 s> <div class="atom-logo">\n
593 s> <a href="/redirected/atom-log" title="subscribe to atom feed">\n
593 s> <a href="/redirected/atom-log" title="subscribe to atom feed">\n
594 s> <img class="atom-logo" src="/redirected/static/feed-icon-14x14.png" alt="atom feed" />\n
594 s> <img class="atom-logo" src="/redirected/static/feed-icon-14x14.png" alt="atom feed" />\n
595 s> </a>\n
595 s> </a>\n
596 s> </div>\n
596 s> </div>\n
597 s> </div>\n
597 s> </div>\n
598 s> \n
598 s> \n
599 s> <div class="main">\n
599 s> <div class="main">\n
600 s> <h2 class="breadcrumb"><a href="/">Mercurial</a> &gt; <a href="/redirected">redirected</a> </h2>\n
600 s> <h2 class="breadcrumb"><a href="/">Mercurial</a> &gt; <a href="/redirected">redirected</a> </h2>\n
601 s> <h3>log</h3>\n
601 s> <h3>log</h3>\n
602 s> \n
602 s> \n
603 s> \n
603 s> \n
604 s> <form class="search" action="/redirected/log">\n
604 s> <form class="search" action="/redirected/log">\n
605 s> \n
605 s> \n
606 s> <p><input name="rev" id="search1" type="text" size="30" value="" /></p>\n
606 s> <p><input name="rev" id="search1" type="text" size="30" value="" /></p>\n
607 s> <div id="hint">Find changesets by keywords (author, files, the commit message), revision\n
607 s> <div id="hint">Find changesets by keywords (author, files, the commit message), revision\n
608 s> number or hash, or <a href="/redirected/help/revsets">revset expression</a>.</div>\n
608 s> number or hash, or <a href="/redirected/help/revsets">revset expression</a>.</div>\n
609 s> </form>\n
609 s> </form>\n
610 s> \n
610 s> \n
611 s> <div class="navigate">\n
611 s> <div class="navigate">\n
612 s> <a href="/redirected/shortlog/tip?revcount=30">less</a>\n
612 s> <a href="/redirected/shortlog/tip?revcount=30">less</a>\n
613 s> <a href="/redirected/shortlog/tip?revcount=120">more</a>\n
613 s> <a href="/redirected/shortlog/tip?revcount=120">more</a>\n
614 s> | rev 0: <a href="/redirected/shortlog/96ee1d7354c4">(0)</a> <a href="/redirected/shortlog/tip">tip</a> \n
614 s> | rev 0: <a href="/redirected/shortlog/96ee1d7354c4">(0)</a> <a href="/redirected/shortlog/tip">tip</a> \n
615 s> </div>\n
615 s> </div>\n
616 s> \n
616 s> \n
617 s> <table class="bigtable">\n
617 s> <table class="bigtable">\n
618 s> <thead>\n
618 s> <thead>\n
619 s> <tr>\n
619 s> <tr>\n
620 s> <th class="age">age</th>\n
620 s> <th class="age">age</th>\n
621 s> <th class="author">author</th>\n
621 s> <th class="author">author</th>\n
622 s> <th class="description">description</th>\n
622 s> <th class="description">description</th>\n
623 s> </tr>\n
623 s> </tr>\n
624 s> </thead>\n
624 s> </thead>\n
625 s> <tbody class="stripes2">\n
625 s> <tbody class="stripes2">\n
626 s> <tr>\n
626 s> <tr>\n
627 s> <td class="age">Thu, 01 Jan 1970 00:00:00 +0000</td>\n
627 s> <td class="age">Thu, 01 Jan 1970 00:00:00 +0000</td>\n
628 s> <td class="author">test</td>\n
628 s> <td class="author">test</td>\n
629 s> <td class="description">\n
629 s> <td class="description">\n
630 s> <a href="/redirected/rev/96ee1d7354c4">initial</a>\n
630 s> <a href="/redirected/rev/96ee1d7354c4">initial</a>\n
631 s> <span class="phase">draft</span> <span class="branchhead">default</span> <span class="tag">tip</span> \n
631 s> <span class="phase">draft</span> <span class="branchhead">default</span> <span class="tag">tip</span> \n
632 s> </td>\n
632 s> </td>\n
633 s> </tr>\n
633 s> </tr>\n
634 s> \n
634 s> \n
635 s> </tbody>\n
635 s> </tbody>\n
636 s> </table>\n
636 s> </table>\n
637 s> \n
637 s> \n
638 s> <div class="navigate">\n
638 s> <div class="navigate">\n
639 s> <a href="/redirected/shortlog/tip?revcount=30">less</a>\n
639 s> <a href="/redirected/shortlog/tip?revcount=30">less</a>\n
640 s> <a href="/redirected/shortlog/tip?revcount=120">more</a>\n
640 s> <a href="/redirected/shortlog/tip?revcount=120">more</a>\n
641 s> | rev 0: <a href="/redirected/shortlog/96ee1d7354c4">(0)</a> <a href="/redirected/shortlog/tip">tip</a> \n
641 s> | rev 0: <a href="/redirected/shortlog/96ee1d7354c4">(0)</a> <a href="/redirected/shortlog/tip">tip</a> \n
642 s> </div>\n
642 s> </div>\n
643 s> \n
643 s> \n
644 s> <script type="text/javascript">\n
644 s> <script type="text/javascript">\n
645 s> ajaxScrollInit(\n
645 s> ajaxScrollInit(\n
646 s> \'/redirected/shortlog/%next%\',\n
646 s> \'/redirected/shortlog/%next%\',\n
647 s> \'\', <!-- NEXTHASH\n
647 s> \'\', <!-- NEXTHASH\n
648 s> function (htmlText) {
648 s> function (htmlText) {
649 s> \r\n
649 s> \r\n
650 s> 14a\r\n
650 s> 14a\r\n
651 s> \n
651 s> \n
652 s> var m = htmlText.match(/\'(\\w+)\', <!-- NEXTHASH/);\n
652 s> var m = htmlText.match(/\'(\\w+)\', <!-- NEXTHASH/);\n
653 s> return m ? m[1] : null;\n
653 s> return m ? m[1] : null;\n
654 s> },\n
654 s> },\n
655 s> \'.bigtable > tbody\',\n
655 s> \'.bigtable > tbody\',\n
656 s> \'<tr class="%class%">\\\n
656 s> \'<tr class="%class%">\\\n
657 s> <td colspan="3" style="text-align: center;">%text%</td>\\\n
657 s> <td colspan="3" style="text-align: center;">%text%</td>\\\n
658 s> </tr>\'\n
658 s> </tr>\'\n
659 s> );\n
659 s> );\n
660 s> </script>\n
660 s> </script>\n
661 s> \n
661 s> \n
662 s> </div>\n
662 s> </div>\n
663 s> </div>\n
663 s> </div>\n
664 s> \n
664 s> \n
665 s> \n
665 s> \n
666 s> \n
666 s> \n
667 s> </body>\n
667 s> </body>\n
668 s> </html>\n
668 s> </html>\n
669 s> \n
669 s> \n
670 s> \r\n
670 s> \r\n
671 s> 0\r\n
671 s> 0\r\n
672 s> \r\n
672 s> \r\n
673
673
674 $ hg --verbose debugwireproto http://$LOCALIP:$HGPORT/redirector << EOF
674 $ hg --verbose debugwireproto http://$LOCALIP:$HGPORT/redirector << EOF
675 > command heads
675 > command heads
676 > EOF
676 > EOF
677 s> setsockopt(6, 1, 1) -> None (py3 !)
677 s> setsockopt(6, 1, 1) -> None (py3 !)
678 s> GET /redirector?cmd=capabilities HTTP/1.1\r\n
678 s> GET /redirector?cmd=capabilities HTTP/1.1\r\n
679 s> Accept-Encoding: identity\r\n
679 s> Accept-Encoding: identity\r\n
680 s> accept: application/mercurial-0.1\r\n
680 s> accept: application/mercurial-0.1\r\n
681 s> host: $LOCALIP:$HGPORT\r\n (glob)
681 s> host: $LOCALIP:$HGPORT\r\n (glob)
682 s> user-agent: Mercurial debugwireproto\r\n
682 s> user-agent: Mercurial debugwireproto\r\n
683 s> \r\n
683 s> \r\n
684 s> makefile('rb', None)
684 s> makefile('rb', None)
685 s> HTTP/1.1 301 Redirect\r\n
685 s> HTTP/1.1 301 Redirect\r\n
686 s> Server: testing stub value\r\n
686 s> Server: testing stub value\r\n
687 s> Date: $HTTP_DATE$\r\n
687 s> Date: $HTTP_DATE$\r\n
688 s> Location: http://$LOCALIP:$HGPORT/redirected\r\n (glob)
688 s> Location: http://$LOCALIP:$HGPORT/redirected\r\n (glob)
689 s> Content-Type: text/plain\r\n
689 s> Content-Type: text/plain\r\n
690 s> Content-Length: 10\r\n
690 s> Content-Length: 10\r\n
691 s> \r\n
691 s> \r\n
692 s> redirected
692 s> redirected
693 s> setsockopt(6, 1, 1) -> None (py3 !)
693 s> setsockopt(6, 1, 1) -> None (py3 !)
694 s> GET /redirected HTTP/1.1\r\n
694 s> GET /redirected HTTP/1.1\r\n
695 s> Accept-Encoding: identity\r\n
695 s> Accept-Encoding: identity\r\n
696 s> accept: application/mercurial-0.1\r\n
696 s> accept: application/mercurial-0.1\r\n
697 s> host: $LOCALIP:$HGPORT\r\n (glob)
697 s> host: $LOCALIP:$HGPORT\r\n (glob)
698 s> user-agent: Mercurial debugwireproto\r\n
698 s> user-agent: Mercurial debugwireproto\r\n
699 s> \r\n
699 s> \r\n
700 s> makefile('rb', None)
700 s> makefile('rb', None)
701 s> HTTP/1.1 200 Script output follows\r\n
701 s> HTTP/1.1 200 Script output follows\r\n
702 s> Server: testing stub value\r\n
702 s> Server: testing stub value\r\n
703 s> Date: $HTTP_DATE$\r\n
703 s> Date: $HTTP_DATE$\r\n
704 s> ETag: W/"*"\r\n (glob)
704 s> ETag: W/"*"\r\n (glob)
705 s> Content-Type: text/html; charset=ascii\r\n
705 s> Content-Type: text/html; charset=ascii\r\n
706 s> Transfer-Encoding: chunked\r\n
706 s> Transfer-Encoding: chunked\r\n
707 s> \r\n
707 s> \r\n
708 real URL is http://$LOCALIP:$HGPORT/redirected (glob)
708 real URL is http://$LOCALIP:$HGPORT/redirected (glob)
709 s> 414\r\n
709 s> 414\r\n
710 s> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n
710 s> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n
711 s> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">\n
711 s> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">\n
712 s> <head>\n
712 s> <head>\n
713 s> <link rel="icon" href="/redirected/static/hgicon.png" type="image/png" />\n
713 s> <link rel="icon" href="/redirected/static/hgicon.png" type="image/png" />\n
714 s> <meta name="robots" content="index, nofollow" />\n
714 s> <meta name="robots" content="index, nofollow" />\n
715 s> <link rel="stylesheet" href="/redirected/static/style-paper.css" type="text/css" />\n
715 s> <link rel="stylesheet" href="/redirected/static/style-paper.css" type="text/css" />\n
716 s> <script type="text/javascript" src="/redirected/static/mercurial.js"></script>\n
716 s> <script type="text/javascript" src="/redirected/static/mercurial.js"></script>\n
717 s> \n
717 s> \n
718 s> <title>redirected: log</title>\n
718 s> <title>redirected: log</title>\n
719 s> <link rel="alternate" type="application/atom+xml"\n
719 s> <link rel="alternate" type="application/atom+xml"\n
720 s> href="/redirected/atom-log" title="Atom feed for redirected" />\n
720 s> href="/redirected/atom-log" title="Atom feed for redirected" />\n
721 s> <link rel="alternate" type="application/rss+xml"\n
721 s> <link rel="alternate" type="application/rss+xml"\n
722 s> href="/redirected/rss-log" title="RSS feed for redirected" />\n
722 s> href="/redirected/rss-log" title="RSS feed for redirected" />\n
723 s> </head>\n
723 s> </head>\n
724 s> <body>\n
724 s> <body>\n
725 s> \n
725 s> \n
726 s> <div class="container">\n
726 s> <div class="container">\n
727 s> <div class="menu">\n
727 s> <div class="menu">\n
728 s> <div class="logo">\n
728 s> <div class="logo">\n
729 s> <a href="https://mercurial-scm.org/">\n
729 s> <a href="https://mercurial-scm.org/">\n
730 s> <img src="/redirected/static/hglogo.png" alt="mercurial" /></a>\n
730 s> <img src="/redirected/static/hglogo.png" alt="mercurial" /></a>\n
731 s> </div>\n
731 s> </div>\n
732 s> <ul>\n
732 s> <ul>\n
733 s> <li class="active">log</li>\n
733 s> <li class="active">log</li>\n
734 s> <li><a href="/redirected/graph/tip">graph</a></li>\n
734 s> <li><a href="/redirected/graph/tip">graph</a></li>\n
735 s> <li><a href="/redirected/tags">tags</a
735 s> <li><a href="/redirected/tags">tags</a
736 s> setsockopt(6, 1, 1) -> None (py3 !)
736 s> setsockopt(6, 1, 1) -> None (py3 !)
737 s> GET /redirected?cmd=capabilities HTTP/1.1\r\n
737 s> GET /redirected?cmd=capabilities HTTP/1.1\r\n
738 s> Accept-Encoding: identity\r\n
738 s> Accept-Encoding: identity\r\n
739 s> accept: application/mercurial-0.1\r\n
739 s> accept: application/mercurial-0.1\r\n
740 s> host: $LOCALIP:$HGPORT\r\n (glob)
740 s> host: $LOCALIP:$HGPORT\r\n (glob)
741 s> user-agent: Mercurial debugwireproto\r\n
741 s> user-agent: Mercurial debugwireproto\r\n
742 s> \r\n
742 s> \r\n
743 s> makefile('rb', None)
743 s> makefile('rb', None)
744 s> HTTP/1.1 200 Script output follows\r\n
744 s> HTTP/1.1 200 Script output follows\r\n
745 s> Server: testing stub value\r\n
745 s> Server: testing stub value\r\n
746 s> Date: $HTTP_DATE$\r\n
746 s> Date: $HTTP_DATE$\r\n
747 s> Content-Type: application/mercurial-0.1\r\n
747 s> Content-Type: application/mercurial-0.1\r\n
748 s> Content-Length: 480\r\n
748 s> Content-Length: 480\r\n
749 s> \r\n
749 s> \r\n
750 real URL is http://$LOCALIP:$HGPORT/redirected (glob)
750 real URL is http://$LOCALIP:$HGPORT/redirected (glob)
751 s> batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
751 s> batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
752 sending heads command
752 sending heads command
753 s> setsockopt(6, 1, 1) -> None (py3 !)
753 s> setsockopt(6, 1, 1) -> None (py3 !)
754 s> GET /redirected?cmd=heads HTTP/1.1\r\n
754 s> GET /redirected?cmd=heads HTTP/1.1\r\n
755 s> Accept-Encoding: identity\r\n
755 s> Accept-Encoding: identity\r\n
756 s> vary: X-HgProto-1\r\n
756 s> vary: X-HgProto-1\r\n
757 s> x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n
757 s> x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n
758 s> accept: application/mercurial-0.1\r\n
758 s> accept: application/mercurial-0.1\r\n
759 s> host: $LOCALIP:$HGPORT\r\n (glob)
759 s> host: $LOCALIP:$HGPORT\r\n (glob)
760 s> user-agent: Mercurial debugwireproto\r\n
760 s> user-agent: Mercurial debugwireproto\r\n
761 s> \r\n
761 s> \r\n
762 s> makefile('rb', None)
762 s> makefile('rb', None)
763 s> HTTP/1.1 200 Script output follows\r\n
763 s> HTTP/1.1 200 Script output follows\r\n
764 s> Server: testing stub value\r\n
764 s> Server: testing stub value\r\n
765 s> Date: $HTTP_DATE$\r\n
765 s> Date: $HTTP_DATE$\r\n
766 s> Content-Type: application/mercurial-0.1\r\n
766 s> Content-Type: application/mercurial-0.1\r\n
767 s> Content-Length: 41\r\n
767 s> Content-Length: 41\r\n
768 s> \r\n
768 s> \r\n
769 s> 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n
769 s> 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n
770 response: [
770 response: [
771 b'\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL'
771 b'\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL'
772 ]
772 ]
773 (sent 4 HTTP requests and * bytes; received * bytes in responses) (glob)
773 (sent 4 HTTP requests and * bytes; received * bytes in responses) (glob)
General Comments 0
You need to be logged in to leave comments. Login now