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