tests/test-http-protocol.t
branchstable
changeset 48796 c00d3ce4e94b
parent 48651 c3239f2ee61b
equal deleted inserted replaced
48776:b84ff512b645 48796:c00d3ce4e94b
   196   s>     Server: testing stub value\r\n
   196   s>     Server: testing stub value\r\n
   197   s>     Date: $HTTP_DATE$\r\n
   197   s>     Date: $HTTP_DATE$\r\n
   198   s>     Content-Type: application/mercurial-0.1\r\n
   198   s>     Content-Type: application/mercurial-0.1\r\n
   199   s>     Content-Length: *\r\n (glob)
   199   s>     Content-Length: *\r\n (glob)
   200   s>     \r\n
   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=generaldelta,revlogv1,sparserevlog 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=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (re)
   202   sending listkeys command
   202   sending listkeys command
   203   s> setsockopt(6, 1, 1) -> None (?)
   203   s> setsockopt(6, 1, 1) -> None (?)
   204   s>     GET /?cmd=listkeys HTTP/1.1\r\n
   204   s>     GET /?cmd=listkeys HTTP/1.1\r\n
   205   s>     Accept-Encoding: identity\r\n
   205   s>     Accept-Encoding: identity\r\n
   206   s>     vary: X-HgArg-1,X-HgProto-1\r\n
   206   s>     vary: X-HgArg-1,X-HgProto-1\r\n
   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
   440   s> makefile('rb', None)
   325   s> makefile('rb', None)
   441   s>     HTTP/1.1 200 Script output follows\r\n
   326   s>     HTTP/1.1 200 Script output follows\r\n
   442   s>     Server: testing stub value\r\n
   327   s>     Server: testing stub value\r\n
   443   s>     Date: $HTTP_DATE$\r\n
   328   s>     Date: $HTTP_DATE$\r\n
   444   s>     Content-Type: application/mercurial-0.1\r\n
   329   s>     Content-Type: application/mercurial-0.1\r\n
   445   s>     Content-Length: 484\r\n
   330   s>     Content-Length: \d+\\r\\n (re)
   446   s>     \r\n
   331   s>     \r\n
   447   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
   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)
   448 
   333 
   449 Test with the HTTP peer
   334 Test with the HTTP peer
   450 
   335 
   451   $ hg --verbose debugwireproto http://$LOCALIP:$HGPORT/redirector << EOF
   336   $ hg --verbose debugwireproto http://$LOCALIP:$HGPORT/redirector << EOF
   452   > command heads
   337   > command heads
   477   s> makefile('rb', None)
   362   s> makefile('rb', None)
   478   s>     HTTP/1.1 200 Script output follows\r\n
   363   s>     HTTP/1.1 200 Script output follows\r\n
   479   s>     Server: testing stub value\r\n
   364   s>     Server: testing stub value\r\n
   480   s>     Date: $HTTP_DATE$\r\n
   365   s>     Date: $HTTP_DATE$\r\n
   481   s>     Content-Type: application/mercurial-0.1\r\n
   366   s>     Content-Type: application/mercurial-0.1\r\n
   482   s>     Content-Length: 484\r\n
   367   s>     Content-Length: \d+\\r\\n (re)
   483   s>     \r\n
   368   s>     \r\n
   484   real URL is http://$LOCALIP:$HGPORT/redirected (glob)
   369   real URL is http://$LOCALIP:$HGPORT/redirected (glob)
   485   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
   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)
   486   sending heads command
   371   sending heads command
   487   s> setsockopt(6, 1, 1) -> None (?)
   372   s> setsockopt(6, 1, 1) -> None (?)
   488   s>     GET /redirected?cmd=heads HTTP/1.1\r\n
   373   s>     GET /redirected?cmd=heads HTTP/1.1\r\n
   489   s>     Accept-Encoding: identity\r\n
   374   s>     Accept-Encoding: identity\r\n
   490   s>     vary: X-HgProto-1\r\n
   375   s>     vary: X-HgProto-1\r\n
   748   s> makefile('rb', None)
   633   s> makefile('rb', None)
   749   s>     HTTP/1.1 200 Script output follows\r\n
   634   s>     HTTP/1.1 200 Script output follows\r\n
   750   s>     Server: testing stub value\r\n
   635   s>     Server: testing stub value\r\n
   751   s>     Date: $HTTP_DATE$\r\n
   636   s>     Date: $HTTP_DATE$\r\n
   752   s>     Content-Type: application/mercurial-0.1\r\n
   637   s>     Content-Type: application/mercurial-0.1\r\n
   753   s>     Content-Length: 484\r\n
   638   s>     Content-Length: \d+\\r\\n (re)
   754   s>     \r\n
   639   s>     \r\n
   755   real URL is http://$LOCALIP:$HGPORT/redirected (glob)
   640   real URL is http://$LOCALIP:$HGPORT/redirected (glob)
   756   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
   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)
   757   sending heads command
   642   sending heads command
   758   s> setsockopt(6, 1, 1) -> None (?)
   643   s> setsockopt(6, 1, 1) -> None (?)
   759   s>     GET /redirected?cmd=heads HTTP/1.1\r\n
   644   s>     GET /redirected?cmd=heads HTTP/1.1\r\n
   760   s>     Accept-Encoding: identity\r\n
   645   s>     Accept-Encoding: identity\r\n
   761   s>     vary: X-HgProto-1\r\n
   646   s>     vary: X-HgProto-1\r\n