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