96 s> Server: testing stub value\r\n |
96 s> Server: testing stub value\r\n |
97 s> Date: $HTTP_DATE$\r\n |
97 s> Date: $HTTP_DATE$\r\n |
98 s> Content-Type: text/plain\r\n |
98 s> Content-Type: text/plain\r\n |
99 s> Content-Length: 85\r\n |
99 s> Content-Length: 85\r\n |
100 s> \r\n |
100 s> \r\n |
101 s> client MUST specify Accept header with value: application/mercurial-exp-framing-0004\n |
101 s> client MUST specify Accept header with value: application/mercurial-exp-framing-0005\n |
102 |
102 |
103 Bad Accept header results in 406 |
103 Bad Accept header results in 406 |
104 |
104 |
105 $ sendhttpraw << EOF |
105 $ sendhttpraw << EOF |
106 > httprequest POST api/$HTTPV2/ro/customreadonly |
106 > httprequest POST api/$HTTPV2/ro/customreadonly |
119 s> Server: testing stub value\r\n |
119 s> Server: testing stub value\r\n |
120 s> Date: $HTTP_DATE$\r\n |
120 s> Date: $HTTP_DATE$\r\n |
121 s> Content-Type: text/plain\r\n |
121 s> Content-Type: text/plain\r\n |
122 s> Content-Length: 85\r\n |
122 s> Content-Length: 85\r\n |
123 s> \r\n |
123 s> \r\n |
124 s> client MUST specify Accept header with value: application/mercurial-exp-framing-0004\n |
124 s> client MUST specify Accept header with value: application/mercurial-exp-framing-0005\n |
125 |
125 |
126 Bad Content-Type header results in 415 |
126 Bad Content-Type header results in 415 |
127 |
127 |
128 $ sendhttpraw << EOF |
128 $ sendhttpraw << EOF |
129 > httprequest POST api/$HTTPV2/ro/customreadonly |
129 > httprequest POST api/$HTTPV2/ro/customreadonly |
132 > content-type: badmedia |
132 > content-type: badmedia |
133 > EOF |
133 > EOF |
134 using raw connection to peer |
134 using raw connection to peer |
135 s> POST /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n |
135 s> POST /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n |
136 s> Accept-Encoding: identity\r\n |
136 s> Accept-Encoding: identity\r\n |
137 s> accept: application/mercurial-exp-framing-0004\r\n |
137 s> accept: application/mercurial-exp-framing-0005\r\n |
138 s> content-type: badmedia\r\n |
138 s> content-type: badmedia\r\n |
139 s> user-agent: test\r\n |
139 s> user-agent: test\r\n |
140 s> host: $LOCALIP:$HGPORT\r\n (glob) |
140 s> host: $LOCALIP:$HGPORT\r\n (glob) |
141 s> \r\n |
141 s> \r\n |
142 s> makefile('rb', None) |
142 s> makefile('rb', None) |
144 s> Server: testing stub value\r\n |
144 s> Server: testing stub value\r\n |
145 s> Date: $HTTP_DATE$\r\n |
145 s> Date: $HTTP_DATE$\r\n |
146 s> Content-Type: text/plain\r\n |
146 s> Content-Type: text/plain\r\n |
147 s> Content-Length: 88\r\n |
147 s> Content-Length: 88\r\n |
148 s> \r\n |
148 s> \r\n |
149 s> client MUST send Content-Type header with value: application/mercurial-exp-framing-0004\n |
149 s> client MUST send Content-Type header with value: application/mercurial-exp-framing-0005\n |
150 |
150 |
151 Request to read-only command works out of the box |
151 Request to read-only command works out of the box |
152 |
152 |
153 $ sendhttpraw << EOF |
153 $ sendhttpraw << EOF |
154 > httprequest POST api/$HTTPV2/ro/customreadonly |
154 > httprequest POST api/$HTTPV2/ro/customreadonly |
159 > EOF |
159 > EOF |
160 using raw connection to peer |
160 using raw connection to peer |
161 s> POST /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n |
161 s> POST /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n |
162 s> Accept-Encoding: identity\r\n |
162 s> Accept-Encoding: identity\r\n |
163 s> *\r\n (glob) |
163 s> *\r\n (glob) |
164 s> content-type: application/mercurial-exp-framing-0004\r\n |
164 s> content-type: application/mercurial-exp-framing-0005\r\n |
165 s> user-agent: test\r\n |
165 s> user-agent: test\r\n |
166 s> content-length: 29\r\n |
166 s> content-length: 29\r\n |
167 s> host: $LOCALIP:$HGPORT\r\n (glob) |
167 s> host: $LOCALIP:$HGPORT\r\n (glob) |
168 s> \r\n |
168 s> \r\n |
169 s> \x15\x00\x00\x01\x00\x01\x01\x11\xa1DnameNcustomreadonly |
169 s> \x15\x00\x00\x01\x00\x01\x01\x11\xa1DnameNcustomreadonly |
170 s> makefile('rb', None) |
170 s> makefile('rb', None) |
171 s> HTTP/1.1 200 OK\r\n |
171 s> HTTP/1.1 200 OK\r\n |
172 s> Server: testing stub value\r\n |
172 s> Server: testing stub value\r\n |
173 s> Date: $HTTP_DATE$\r\n |
173 s> Date: $HTTP_DATE$\r\n |
174 s> Content-Type: application/mercurial-exp-framing-0004\r\n |
174 s> Content-Type: application/mercurial-exp-framing-0005\r\n |
175 s> Transfer-Encoding: chunked\r\n |
175 s> Transfer-Encoding: chunked\r\n |
176 s> \r\n |
176 s> \r\n |
177 s> 27\r\n |
177 s> 32\r\n |
178 s> \x1f\x00\x00\x01\x00\x02\x012X\x1dcustomreadonly bytes response |
178 s> *\x00\x00\x01\x00\x02\x012\xa1FstatusBokX\x1dcustomreadonly bytes response |
179 s> \r\n |
179 s> \r\n |
180 s> 0\r\n |
180 s> 0\r\n |
181 s> \r\n |
181 s> \r\n |
182 |
182 |
183 $ sendhttpv2peer << EOF |
183 $ sendhttpv2peer << EOF |
185 > EOF |
185 > EOF |
186 creating http peer for wire protocol version 2 |
186 creating http peer for wire protocol version 2 |
187 sending customreadonly command |
187 sending customreadonly command |
188 s> POST /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n |
188 s> POST /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n |
189 s> Accept-Encoding: identity\r\n |
189 s> Accept-Encoding: identity\r\n |
190 s> accept: application/mercurial-exp-framing-0004\r\n |
190 s> accept: application/mercurial-exp-framing-0005\r\n |
191 s> content-type: application/mercurial-exp-framing-0004\r\n |
191 s> content-type: application/mercurial-exp-framing-0005\r\n |
192 s> content-length: 29\r\n |
192 s> content-length: 29\r\n |
193 s> host: $LOCALIP:$HGPORT\r\n (glob) |
193 s> host: $LOCALIP:$HGPORT\r\n (glob) |
194 s> user-agent: Mercurial debugwireproto\r\n |
194 s> user-agent: Mercurial debugwireproto\r\n |
195 s> \r\n |
195 s> \r\n |
196 s> \x15\x00\x00\x01\x00\x01\x01\x11\xa1DnameNcustomreadonly |
196 s> \x15\x00\x00\x01\x00\x01\x01\x11\xa1DnameNcustomreadonly |
197 s> makefile('rb', None) |
197 s> makefile('rb', None) |
198 s> HTTP/1.1 200 OK\r\n |
198 s> HTTP/1.1 200 OK\r\n |
199 s> Server: testing stub value\r\n |
199 s> Server: testing stub value\r\n |
200 s> Date: $HTTP_DATE$\r\n |
200 s> Date: $HTTP_DATE$\r\n |
201 s> Content-Type: application/mercurial-exp-framing-0004\r\n |
201 s> Content-Type: application/mercurial-exp-framing-0005\r\n |
202 s> Transfer-Encoding: chunked\r\n |
202 s> Transfer-Encoding: chunked\r\n |
203 s> \r\n |
203 s> \r\n |
204 s> 27\r\n |
204 s> 32\r\n |
205 s> \x1f\x00\x00\x01\x00\x02\x012 |
205 s> *\x00\x00\x01\x00\x02\x012 |
206 s> X\x1dcustomreadonly bytes response |
206 s> \xa1FstatusBokX\x1dcustomreadonly bytes response |
207 s> \r\n |
207 s> \r\n |
208 received frame(size=31; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) |
208 received frame(size=42; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) |
209 s> 0\r\n |
209 s> 0\r\n |
210 s> \r\n |
210 s> \r\n |
211 response: [b'customreadonly bytes response'] |
211 response: [{b'status': b'ok'}, b'customreadonly bytes response'] |
212 |
212 |
213 Request to read-write command fails because server is read-only by default |
213 Request to read-write command fails because server is read-only by default |
214 |
214 |
215 GET to read-write request yields 405 |
215 GET to read-write request yields 405 |
216 |
216 |
299 > frame 1 1 stream-begin command-request new cbor:{b'name': b'customreadonly'} |
299 > frame 1 1 stream-begin command-request new cbor:{b'name': b'customreadonly'} |
300 > EOF |
300 > EOF |
301 using raw connection to peer |
301 using raw connection to peer |
302 s> POST /api/exp-http-v2-0001/rw/customreadonly HTTP/1.1\r\n |
302 s> POST /api/exp-http-v2-0001/rw/customreadonly HTTP/1.1\r\n |
303 s> Accept-Encoding: identity\r\n |
303 s> Accept-Encoding: identity\r\n |
304 s> accept: application/mercurial-exp-framing-0004\r\n |
304 s> accept: application/mercurial-exp-framing-0005\r\n |
305 s> content-type: application/mercurial-exp-framing-0004\r\n |
305 s> content-type: application/mercurial-exp-framing-0005\r\n |
306 s> user-agent: test\r\n |
306 s> user-agent: test\r\n |
307 s> content-length: 29\r\n |
307 s> content-length: 29\r\n |
308 s> host: $LOCALIP:$HGPORT\r\n (glob) |
308 s> host: $LOCALIP:$HGPORT\r\n (glob) |
309 s> \r\n |
309 s> \r\n |
310 s> \x15\x00\x00\x01\x00\x01\x01\x11\xa1DnameNcustomreadonly |
310 s> \x15\x00\x00\x01\x00\x01\x01\x11\xa1DnameNcustomreadonly |
311 s> makefile('rb', None) |
311 s> makefile('rb', None) |
312 s> HTTP/1.1 200 OK\r\n |
312 s> HTTP/1.1 200 OK\r\n |
313 s> Server: testing stub value\r\n |
313 s> Server: testing stub value\r\n |
314 s> Date: $HTTP_DATE$\r\n |
314 s> Date: $HTTP_DATE$\r\n |
315 s> Content-Type: application/mercurial-exp-framing-0004\r\n |
315 s> Content-Type: application/mercurial-exp-framing-0005\r\n |
316 s> Transfer-Encoding: chunked\r\n |
316 s> Transfer-Encoding: chunked\r\n |
317 s> \r\n |
317 s> \r\n |
318 s> 27\r\n |
318 s> 32\r\n |
319 s> \x1f\x00\x00\x01\x00\x02\x012X\x1dcustomreadonly bytes response |
319 s> *\x00\x00\x01\x00\x02\x012\xa1FstatusBokX\x1dcustomreadonly bytes response |
320 s> \r\n |
320 s> \r\n |
321 s> 0\r\n |
321 s> 0\r\n |
322 s> \r\n |
322 s> \r\n |
323 |
323 |
324 Authorized request for unknown command is rejected |
324 Authorized request for unknown command is rejected |
329 > accept: $MEDIATYPE |
329 > accept: $MEDIATYPE |
330 > EOF |
330 > EOF |
331 using raw connection to peer |
331 using raw connection to peer |
332 s> POST /api/exp-http-v2-0001/rw/badcommand HTTP/1.1\r\n |
332 s> POST /api/exp-http-v2-0001/rw/badcommand HTTP/1.1\r\n |
333 s> Accept-Encoding: identity\r\n |
333 s> Accept-Encoding: identity\r\n |
334 s> accept: application/mercurial-exp-framing-0004\r\n |
334 s> accept: application/mercurial-exp-framing-0005\r\n |
335 s> user-agent: test\r\n |
335 s> user-agent: test\r\n |
336 s> host: $LOCALIP:$HGPORT\r\n (glob) |
336 s> host: $LOCALIP:$HGPORT\r\n (glob) |
337 s> \r\n |
337 s> \r\n |
338 s> makefile('rb', None) |
338 s> makefile('rb', None) |
339 s> HTTP/1.1 404 Not Found\r\n |
339 s> HTTP/1.1 404 Not Found\r\n |
391 > frame 1 1 stream-begin command-request new cbor:{b'name': b'command1', b'args': {b'foo': b'val1', b'bar1': b'val'}} |
391 > frame 1 1 stream-begin command-request new cbor:{b'name': b'command1', b'args': {b'foo': b'val1', b'bar1': b'val'}} |
392 > EOF |
392 > EOF |
393 using raw connection to peer |
393 using raw connection to peer |
394 s> POST /api/exp-http-v2-0001/ro/debugreflect HTTP/1.1\r\n |
394 s> POST /api/exp-http-v2-0001/ro/debugreflect HTTP/1.1\r\n |
395 s> Accept-Encoding: identity\r\n |
395 s> Accept-Encoding: identity\r\n |
396 s> accept: application/mercurial-exp-framing-0004\r\n |
396 s> accept: application/mercurial-exp-framing-0005\r\n |
397 s> content-type: application/mercurial-exp-framing-0004\r\n |
397 s> content-type: application/mercurial-exp-framing-0005\r\n |
398 s> user-agent: test\r\n |
398 s> user-agent: test\r\n |
399 s> content-length: 47\r\n |
399 s> content-length: 47\r\n |
400 s> host: $LOCALIP:$HGPORT\r\n (glob) |
400 s> host: $LOCALIP:$HGPORT\r\n (glob) |
401 s> \r\n |
401 s> \r\n |
402 s> \'\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa2CfooDval1Dbar1CvalDnameHcommand1 |
402 s> \'\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa2CfooDval1Dbar1CvalDnameHcommand1 |
422 > frame 1 1 stream-begin command-request new cbor:{b'name': b'customreadonly'} |
422 > frame 1 1 stream-begin command-request new cbor:{b'name': b'customreadonly'} |
423 > EOF |
423 > EOF |
424 using raw connection to peer |
424 using raw connection to peer |
425 s> POST /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n |
425 s> POST /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n |
426 s> Accept-Encoding: identity\r\n |
426 s> Accept-Encoding: identity\r\n |
427 s> accept: application/mercurial-exp-framing-0004\r\n |
427 s> accept: application/mercurial-exp-framing-0005\r\n |
428 s> content-type: application/mercurial-exp-framing-0004\r\n |
428 s> content-type: application/mercurial-exp-framing-0005\r\n |
429 s> user-agent: test\r\n |
429 s> user-agent: test\r\n |
430 s> content-length: 29\r\n |
430 s> content-length: 29\r\n |
431 s> host: $LOCALIP:$HGPORT\r\n (glob) |
431 s> host: $LOCALIP:$HGPORT\r\n (glob) |
432 s> \r\n |
432 s> \r\n |
433 s> \x15\x00\x00\x01\x00\x01\x01\x11\xa1DnameNcustomreadonly |
433 s> \x15\x00\x00\x01\x00\x01\x01\x11\xa1DnameNcustomreadonly |
434 s> makefile('rb', None) |
434 s> makefile('rb', None) |
435 s> HTTP/1.1 200 OK\r\n |
435 s> HTTP/1.1 200 OK\r\n |
436 s> Server: testing stub value\r\n |
436 s> Server: testing stub value\r\n |
437 s> Date: $HTTP_DATE$\r\n |
437 s> Date: $HTTP_DATE$\r\n |
438 s> Content-Type: application/mercurial-exp-framing-0004\r\n |
438 s> Content-Type: application/mercurial-exp-framing-0005\r\n |
439 s> Transfer-Encoding: chunked\r\n |
439 s> Transfer-Encoding: chunked\r\n |
440 s> \r\n |
440 s> \r\n |
441 s> 27\r\n |
441 s> 32\r\n |
442 s> \x1f\x00\x00\x01\x00\x02\x012X\x1dcustomreadonly bytes response |
442 s> *\x00\x00\x01\x00\x02\x012\xa1FstatusBokX\x1dcustomreadonly bytes response |
443 s> \r\n |
443 s> \r\n |
444 s> 0\r\n |
444 s> 0\r\n |
445 s> \r\n |
445 s> \r\n |
446 |
446 |
447 Multiple requests to "multirequest" URL are allowed |
447 Multiple requests to "multirequest" URL are allowed |
466 s> \x15\x00\x00\x01\x00\x01\x01\x11\xa1DnameNcustomreadonly\x15\x00\x00\x03\x00\x01\x00\x11\xa1DnameNcustomreadonly |
466 s> \x15\x00\x00\x01\x00\x01\x01\x11\xa1DnameNcustomreadonly\x15\x00\x00\x03\x00\x01\x00\x11\xa1DnameNcustomreadonly |
467 s> makefile('rb', None) |
467 s> makefile('rb', None) |
468 s> HTTP/1.1 200 OK\r\n |
468 s> HTTP/1.1 200 OK\r\n |
469 s> Server: testing stub value\r\n |
469 s> Server: testing stub value\r\n |
470 s> Date: $HTTP_DATE$\r\n |
470 s> Date: $HTTP_DATE$\r\n |
471 s> Content-Type: application/mercurial-exp-framing-0004\r\n |
471 s> Content-Type: application/mercurial-exp-framing-0005\r\n |
472 s> Transfer-Encoding: chunked\r\n |
472 s> Transfer-Encoding: chunked\r\n |
473 s> \r\n |
473 s> \r\n |
474 s> 27\r\n |
474 s> 32\r\n |
475 s> \x1f\x00\x00\x01\x00\x02\x012X\x1dcustomreadonly bytes response |
475 s> *\x00\x00\x01\x00\x02\x012\xa1FstatusBokX\x1dcustomreadonly bytes response |
476 s> \r\n |
476 s> \r\n |
477 s> 27\r\n |
477 s> 32\r\n |
478 s> \x1f\x00\x00\x03\x00\x02\x002X\x1dcustomreadonly bytes response |
478 s> *\x00\x00\x03\x00\x02\x002\xa1FstatusBokX\x1dcustomreadonly bytes response |
479 s> \r\n |
479 s> \r\n |
480 s> 0\r\n |
480 s> 0\r\n |
481 s> \r\n |
481 s> \r\n |
482 |
482 |
483 Interleaved requests to "multirequest" are processed |
483 Interleaved requests to "multirequest" are processed |
493 > frame 1 1 0 command-request continuation IbookmarksDnameHlistkeys |
493 > frame 1 1 0 command-request continuation IbookmarksDnameHlistkeys |
494 > EOF |
494 > EOF |
495 using raw connection to peer |
495 using raw connection to peer |
496 s> POST /api/exp-http-v2-0001/ro/multirequest HTTP/1.1\r\n |
496 s> POST /api/exp-http-v2-0001/ro/multirequest HTTP/1.1\r\n |
497 s> Accept-Encoding: identity\r\n |
497 s> Accept-Encoding: identity\r\n |
498 s> accept: application/mercurial-exp-framing-0004\r\n |
498 s> accept: application/mercurial-exp-framing-0005\r\n |
499 s> content-type: application/mercurial-exp-framing-0004\r\n |
499 s> content-type: application/mercurial-exp-framing-0005\r\n |
500 s> user-agent: test\r\n |
500 s> user-agent: test\r\n |
501 s> content-length: 115\r\n |
501 s> content-length: 115\r\n |
502 s> host: $LOCALIP:$HGPORT\r\n (glob) |
502 s> host: $LOCALIP:$HGPORT\r\n (glob) |
503 s> \r\n |
503 s> \r\n |
504 s> \x11\x00\x00\x01\x00\x01\x01\x15\xa2Dargs\xa1Inamespace\x11\x00\x00\x03\x00\x01\x00\x15\xa2Dargs\xa1Inamespace\x19\x00\x00\x03\x00\x01\x00\x12JnamespacesDnameHlistkeys\x18\x00\x00\x01\x00\x01\x00\x12IbookmarksDnameHlistkeys |
504 s> \x11\x00\x00\x01\x00\x01\x01\x15\xa2Dargs\xa1Inamespace\x11\x00\x00\x03\x00\x01\x00\x15\xa2Dargs\xa1Inamespace\x19\x00\x00\x03\x00\x01\x00\x12JnamespacesDnameHlistkeys\x18\x00\x00\x01\x00\x01\x00\x12IbookmarksDnameHlistkeys |
505 s> makefile('rb', None) |
505 s> makefile('rb', None) |
506 s> HTTP/1.1 200 OK\r\n |
506 s> HTTP/1.1 200 OK\r\n |
507 s> Server: testing stub value\r\n |
507 s> Server: testing stub value\r\n |
508 s> Date: $HTTP_DATE$\r\n |
508 s> Date: $HTTP_DATE$\r\n |
509 s> Content-Type: application/mercurial-exp-framing-0004\r\n |
509 s> Content-Type: application/mercurial-exp-framing-0005\r\n |
510 s> Transfer-Encoding: chunked\r\n |
510 s> Transfer-Encoding: chunked\r\n |
511 s> \r\n |
511 s> \r\n |
512 s> 28\r\n |
512 s> 33\r\n |
513 s> \x00\x00\x03\x00\x02\x012\xa3Fphases@Ibookmarks@Jnamespaces@ |
513 s> +\x00\x00\x03\x00\x02\x012\xa1FstatusBok\xa3Fphases@Ibookmarks@Jnamespaces@ |
514 s> \r\n |
514 s> \r\n |
515 s> 9\r\n |
515 s> 14\r\n |
516 s> \x01\x00\x00\x01\x00\x02\x002\xa0 |
516 s> \x0c\x00\x00\x01\x00\x02\x002\xa1FstatusBok\xa0 |
517 s> \r\n |
517 s> \r\n |
518 s> 0\r\n |
518 s> 0\r\n |
519 s> \r\n |
519 s> \r\n |
520 |
520 |
521 Restart server to disable read-write access |
521 Restart server to disable read-write access |
543 > frame 1 1 stream-begin command-request new cbor:{b'name': b'pushkey'} |
543 > frame 1 1 stream-begin command-request new cbor:{b'name': b'pushkey'} |
544 > EOF |
544 > EOF |
545 using raw connection to peer |
545 using raw connection to peer |
546 s> POST /api/exp-http-v2-0001/ro/multirequest HTTP/1.1\r\n |
546 s> POST /api/exp-http-v2-0001/ro/multirequest HTTP/1.1\r\n |
547 s> Accept-Encoding: identity\r\n |
547 s> Accept-Encoding: identity\r\n |
548 s> accept: application/mercurial-exp-framing-0004\r\n |
548 s> accept: application/mercurial-exp-framing-0005\r\n |
549 s> content-type: application/mercurial-exp-framing-0004\r\n |
549 s> content-type: application/mercurial-exp-framing-0005\r\n |
550 s> user-agent: test\r\n |
550 s> user-agent: test\r\n |
551 s> content-length: 22\r\n |
551 s> content-length: 22\r\n |
552 s> host: $LOCALIP:$HGPORT\r\n (glob) |
552 s> host: $LOCALIP:$HGPORT\r\n (glob) |
553 s> \r\n |
553 s> \r\n |
554 s> \x0e\x00\x00\x01\x00\x01\x01\x11\xa1DnameGpushkey |
554 s> \x0e\x00\x00\x01\x00\x01\x01\x11\xa1DnameGpushkey |