tests/test-http-protocol.t
changeset 48526 04688c51f81f
parent 46877 1a85c5d75d53
child 48651 c3239f2ee61b
equal deleted inserted replaced
48525:d6c53b40b078 48526:04688c51f81f
   250   s>     Content-Length: 30\r\n
   250   s>     Content-Length: 30\r\n
   251   s>     \r\n
   251   s>     \r\n
   252   s>     bookmarks\t\n
   252   s>     bookmarks\t\n
   253   s>     namespaces\t\n
   253   s>     namespaces\t\n
   254   s>     phases\t
   254   s>     phases\t
   255 
       
   256 Client with HTTPv2 enabled advertises that and gets old capabilities response from old server
       
   257 
       
   258   $ hg --config experimental.httppeer.advertise-v2=true --verbose debugwireproto http://$LOCALIP:$HGPORT << EOF
       
   259   > command heads
       
   260   > EOF
       
   261   s> setsockopt(6, 1, 1) -> None (?)
       
   262   s>     GET /?cmd=capabilities HTTP/1.1\r\n
       
   263   s>     Accept-Encoding: identity\r\n
       
   264   s>     vary: X-HgProto-1,X-HgUpgrade-1\r\n
       
   265   s>     x-hgproto-1: cbor\r\n
       
   266   s>     x-hgupgrade-1: exp-http-v2-0003\r\n
       
   267   s>     accept: application/mercurial-0.1\r\n
       
   268   s>     host: $LOCALIP:$HGPORT\r\n (glob)
       
   269   s>     user-agent: Mercurial debugwireproto\r\n
       
   270   s>     \r\n
       
   271   s> makefile('rb', None)
       
   272   s>     HTTP/1.1 200 Script output follows\r\n
       
   273   s>     Server: testing stub value\r\n
       
   274   s>     Date: $HTTP_DATE$\r\n
       
   275   s>     Content-Type: application/mercurial-0.1\r\n
       
   276   s>     Content-Length: *\r\n (glob)
       
   277   s>     \r\n
       
   278   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
       
   279   sending heads command
       
   280   s> setsockopt(6, 1, 1) -> None (?)
       
   281   s>     GET /?cmd=heads HTTP/1.1\r\n
       
   282   s>     Accept-Encoding: identity\r\n
       
   283   s>     vary: X-HgProto-1\r\n
       
   284   s>     x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n
       
   285   s>     accept: application/mercurial-0.1\r\n
       
   286   s>     host: $LOCALIP:$HGPORT\r\n (glob)
       
   287   s>     user-agent: Mercurial debugwireproto\r\n
       
   288   s>     \r\n
       
   289   s> makefile('rb', None)
       
   290   s>     HTTP/1.1 200 Script output follows\r\n
       
   291   s>     Server: testing stub value\r\n
       
   292   s>     Date: $HTTP_DATE$\r\n
       
   293   s>     Content-Type: application/mercurial-0.1\r\n
       
   294   s>     Content-Length: 41\r\n
       
   295   s>     \r\n
       
   296   s>     0000000000000000000000000000000000000000\n
       
   297   response: [
       
   298     b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
       
   299   ]
       
   300   (sent 2 HTTP requests and * bytes; received * bytes in responses) (glob)
       
   301 
       
   302   $ killdaemons.py
       
   303   $ enablehttpv2 empty
       
   304   $ hg --config server.compressionengines=zlib -R empty serve -p $HGPORT -d --pid-file hg.pid
       
   305   $ cat hg.pid > $DAEMON_PIDS
       
   306 
       
   307 Client with HTTPv2 enabled automatically upgrades if the server supports it
       
   308 
       
   309   $ hg --config experimental.httppeer.advertise-v2=true --config experimental.httppeer.v2-encoder-order=identity --verbose debugwireproto http://$LOCALIP:$HGPORT << EOF
       
   310   > command heads
       
   311   > EOF
       
   312   s> setsockopt(6, 1, 1) -> None (?)
       
   313   s>     GET /?cmd=capabilities HTTP/1.1\r\n
       
   314   s>     Accept-Encoding: identity\r\n
       
   315   s>     vary: X-HgProto-1,X-HgUpgrade-1\r\n
       
   316   s>     x-hgproto-1: cbor\r\n
       
   317   s>     x-hgupgrade-1: exp-http-v2-0003\r\n
       
   318   s>     accept: application/mercurial-0.1\r\n
       
   319   s>     host: $LOCALIP:$HGPORT\r\n (glob)
       
   320   s>     user-agent: Mercurial debugwireproto\r\n
       
   321   s>     \r\n
       
   322   s> makefile('rb', None)
       
   323   s>     HTTP/1.1 200 OK\r\n
       
   324   s>     Server: testing stub value\r\n
       
   325   s>     Date: $HTTP_DATE$\r\n
       
   326   s>     Content-Type: application/mercurial-cbor\r\n
       
   327   s>     Content-Length: *\r\n (glob)
       
   328   s>     \r\n
       
   329   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\xe4batch 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
       
   330   sending heads command
       
   331   s> setsockopt(6, 1, 1) -> None (?)
       
   332   s>     POST /api/exp-http-v2-0003/ro/heads HTTP/1.1\r\n
       
   333   s>     Accept-Encoding: identity\r\n
       
   334   s>     accept: application/mercurial-exp-framing-0006\r\n
       
   335   s>     content-type: application/mercurial-exp-framing-0006\r\n
       
   336   s>     content-length: 56\r\n
       
   337   s>     host: $LOCALIP:$HGPORT\r\n (glob)
       
   338   s>     user-agent: Mercurial debugwireproto\r\n
       
   339   s>     \r\n
       
   340   s>     \x1c\x00\x00\x01\x00\x01\x01\x82\xa1Pcontentencodings\x81Hidentity\x0c\x00\x00\x01\x00\x01\x00\x11\xa1DnameEheads
       
   341   s> makefile('rb', None)
       
   342   s>     HTTP/1.1 200 OK\r\n
       
   343   s>     Server: testing stub value\r\n
       
   344   s>     Date: $HTTP_DATE$\r\n
       
   345   s>     Content-Type: application/mercurial-exp-framing-0006\r\n
       
   346   s>     Transfer-Encoding: chunked\r\n
       
   347   s>     \r\n
       
   348   s>     11\r\n
       
   349   s>     \t\x00\x00\x01\x00\x02\x01\x92
       
   350   s>     Hidentity
       
   351   s>     \r\n
       
   352   s>     13\r\n
       
   353   s>     \x0b\x00\x00\x01\x00\x02\x041
       
   354   s>     \xa1FstatusBok
       
   355   s>     \r\n
       
   356   s>     1e\r\n
       
   357   s>     \x16\x00\x00\x01\x00\x02\x041
       
   358   s>     \x81T\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
       
   359   s>     \r\n
       
   360   s>     8\r\n
       
   361   s>     \x00\x00\x00\x01\x00\x02\x002
       
   362   s>     \r\n
       
   363   s>     0\r\n
       
   364   s>     \r\n
       
   365   response: [
       
   366     b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
       
   367   ]
       
   368   (sent 2 HTTP requests and * bytes; received * bytes in responses) (glob)
       
   369 
       
   370   $ killdaemons.py
   255   $ killdaemons.py
   371 
   256 
   372 HTTP client follows HTTP redirect on handshake to new repo
   257 HTTP client follows HTTP redirect on handshake to new repo
   373 
   258 
   374   $ cd $TESTTMP
   259   $ cd $TESTTMP