tests/test-http-api-httpv2.t
changeset 39814 d059cb669632
parent 39561 d06834e0f48e
child 40025 b099e6032f38
equal deleted inserted replaced
39813:c30faea8d02d 39814:d059cb669632
    16   $ sendhttpraw << EOF
    16   $ sendhttpraw << EOF
    17   > httprequest GET api/$HTTPV2
    17   > httprequest GET api/$HTTPV2
    18   >     user-agent: test
    18   >     user-agent: test
    19   > EOF
    19   > EOF
    20   using raw connection to peer
    20   using raw connection to peer
    21   s>     GET /api/exp-http-v2-0001 HTTP/1.1\r\n
    21   s>     GET /api/exp-http-v2-0002 HTTP/1.1\r\n
    22   s>     Accept-Encoding: identity\r\n
    22   s>     Accept-Encoding: identity\r\n
    23   s>     user-agent: test\r\n
    23   s>     user-agent: test\r\n
    24   s>     host: $LOCALIP:$HGPORT\r\n (glob)
    24   s>     host: $LOCALIP:$HGPORT\r\n (glob)
    25   s>     \r\n
    25   s>     \r\n
    26   s> makefile('rb', None)
    26   s> makefile('rb', None)
    28   s>     Server: testing stub value\r\n
    28   s>     Server: testing stub value\r\n
    29   s>     Date: $HTTP_DATE$\r\n
    29   s>     Date: $HTTP_DATE$\r\n
    30   s>     Content-Type: text/plain\r\n
    30   s>     Content-Type: text/plain\r\n
    31   s>     Content-Length: 33\r\n
    31   s>     Content-Length: 33\r\n
    32   s>     \r\n
    32   s>     \r\n
    33   s>     API exp-http-v2-0001 not enabled\n
    33   s>     API exp-http-v2-0002 not enabled\n
    34 
    34 
    35 Restart server with support for HTTP v2 API
    35 Restart server with support for HTTP v2 API
    36 
    36 
    37   $ killdaemons.py
    37   $ killdaemons.py
    38   $ enablehttpv2 server
    38   $ enablehttpv2 server
    44   $ sendhttpraw << EOF
    44   $ sendhttpraw << EOF
    45   > httprequest POST api/$HTTPV2/ro/badcommand
    45   > httprequest POST api/$HTTPV2/ro/badcommand
    46   >     user-agent: test
    46   >     user-agent: test
    47   > EOF
    47   > EOF
    48   using raw connection to peer
    48   using raw connection to peer
    49   s>     POST /api/exp-http-v2-0001/ro/badcommand HTTP/1.1\r\n
    49   s>     POST /api/exp-http-v2-0002/ro/badcommand HTTP/1.1\r\n
    50   s>     Accept-Encoding: identity\r\n
    50   s>     Accept-Encoding: identity\r\n
    51   s>     user-agent: test\r\n
    51   s>     user-agent: test\r\n
    52   s>     host: $LOCALIP:$HGPORT\r\n (glob)
    52   s>     host: $LOCALIP:$HGPORT\r\n (glob)
    53   s>     \r\n
    53   s>     \r\n
    54   s> makefile('rb', None)
    54   s> makefile('rb', None)
    65   $ sendhttpraw << EOF
    65   $ sendhttpraw << EOF
    66   > httprequest GET api/$HTTPV2/ro/customreadonly
    66   > httprequest GET api/$HTTPV2/ro/customreadonly
    67   >     user-agent: test
    67   >     user-agent: test
    68   > EOF
    68   > EOF
    69   using raw connection to peer
    69   using raw connection to peer
    70   s>     GET /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n
    70   s>     GET /api/exp-http-v2-0002/ro/customreadonly HTTP/1.1\r\n
    71   s>     Accept-Encoding: identity\r\n
    71   s>     Accept-Encoding: identity\r\n
    72   s>     user-agent: test\r\n
    72   s>     user-agent: test\r\n
    73   s>     host: $LOCALIP:$HGPORT\r\n (glob)
    73   s>     host: $LOCALIP:$HGPORT\r\n (glob)
    74   s>     \r\n
    74   s>     \r\n
    75   s> makefile('rb', None)
    75   s> makefile('rb', None)
    86   $ sendhttpraw << EOF
    86   $ sendhttpraw << EOF
    87   > httprequest POST api/$HTTPV2/ro/customreadonly
    87   > httprequest POST api/$HTTPV2/ro/customreadonly
    88   >     user-agent: test
    88   >     user-agent: test
    89   > EOF
    89   > EOF
    90   using raw connection to peer
    90   using raw connection to peer
    91   s>     POST /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n
    91   s>     POST /api/exp-http-v2-0002/ro/customreadonly HTTP/1.1\r\n
    92   s>     Accept-Encoding: identity\r\n
    92   s>     Accept-Encoding: identity\r\n
    93   s>     user-agent: test\r\n
    93   s>     user-agent: test\r\n
    94   s>     host: $LOCALIP:$HGPORT\r\n (glob)
    94   s>     host: $LOCALIP:$HGPORT\r\n (glob)
    95   s>     \r\n
    95   s>     \r\n
    96   s> makefile('rb', None)
    96   s> makefile('rb', None)
   108   > httprequest POST api/$HTTPV2/ro/customreadonly
   108   > httprequest POST api/$HTTPV2/ro/customreadonly
   109   >     accept: invalid
   109   >     accept: invalid
   110   >     user-agent: test
   110   >     user-agent: test
   111   > EOF
   111   > EOF
   112   using raw connection to peer
   112   using raw connection to peer
   113   s>     POST /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n
   113   s>     POST /api/exp-http-v2-0002/ro/customreadonly HTTP/1.1\r\n
   114   s>     Accept-Encoding: identity\r\n
   114   s>     Accept-Encoding: identity\r\n
   115   s>     accept: invalid\r\n
   115   s>     accept: invalid\r\n
   116   s>     user-agent: test\r\n
   116   s>     user-agent: test\r\n
   117   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   117   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   118   s>     \r\n
   118   s>     \r\n
   132   >     accept: $MEDIATYPE
   132   >     accept: $MEDIATYPE
   133   >     user-agent: test
   133   >     user-agent: test
   134   >     content-type: badmedia
   134   >     content-type: badmedia
   135   > EOF
   135   > EOF
   136   using raw connection to peer
   136   using raw connection to peer
   137   s>     POST /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n
   137   s>     POST /api/exp-http-v2-0002/ro/customreadonly HTTP/1.1\r\n
   138   s>     Accept-Encoding: identity\r\n
   138   s>     Accept-Encoding: identity\r\n
   139   s>     accept: application/mercurial-exp-framing-0005\r\n
   139   s>     accept: application/mercurial-exp-framing-0005\r\n
   140   s>     content-type: badmedia\r\n
   140   s>     content-type: badmedia\r\n
   141   s>     user-agent: test\r\n
   141   s>     user-agent: test\r\n
   142   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   142   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   158   >     content-type: $MEDIATYPE
   158   >     content-type: $MEDIATYPE
   159   >     user-agent: test
   159   >     user-agent: test
   160   >     frame 1 1 stream-begin command-request new cbor:{b'name': b'customreadonly'}
   160   >     frame 1 1 stream-begin command-request new cbor:{b'name': b'customreadonly'}
   161   > EOF
   161   > EOF
   162   using raw connection to peer
   162   using raw connection to peer
   163   s>     POST /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n
   163   s>     POST /api/exp-http-v2-0002/ro/customreadonly HTTP/1.1\r\n
   164   s>     Accept-Encoding: identity\r\n
   164   s>     Accept-Encoding: identity\r\n
   165   s>     *\r\n (glob)
   165   s>     *\r\n (glob)
   166   s>     content-type: application/mercurial-exp-framing-0005\r\n
   166   s>     content-type: application/mercurial-exp-framing-0005\r\n
   167   s>     user-agent: test\r\n
   167   s>     user-agent: test\r\n
   168   s>     content-length: 29\r\n
   168   s>     content-length: 29\r\n
   191   $ sendhttpv2peer << EOF
   191   $ sendhttpv2peer << EOF
   192   > command customreadonly
   192   > command customreadonly
   193   > EOF
   193   > EOF
   194   creating http peer for wire protocol version 2
   194   creating http peer for wire protocol version 2
   195   sending customreadonly command
   195   sending customreadonly command
   196   s>     POST /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n
   196   s>     POST /api/exp-http-v2-0002/ro/customreadonly HTTP/1.1\r\n
   197   s>     Accept-Encoding: identity\r\n
   197   s>     Accept-Encoding: identity\r\n
   198   s>     accept: application/mercurial-exp-framing-0005\r\n
   198   s>     accept: application/mercurial-exp-framing-0005\r\n
   199   s>     content-type: application/mercurial-exp-framing-0005\r\n
   199   s>     content-type: application/mercurial-exp-framing-0005\r\n
   200   s>     content-length: 29\r\n
   200   s>     content-length: 29\r\n
   201   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   201   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   236   $ sendhttpraw << EOF
   236   $ sendhttpraw << EOF
   237   > httprequest GET api/$HTTPV2/rw/customreadonly
   237   > httprequest GET api/$HTTPV2/rw/customreadonly
   238   >     user-agent: test
   238   >     user-agent: test
   239   > EOF
   239   > EOF
   240   using raw connection to peer
   240   using raw connection to peer
   241   s>     GET /api/exp-http-v2-0001/rw/customreadonly HTTP/1.1\r\n
   241   s>     GET /api/exp-http-v2-0002/rw/customreadonly HTTP/1.1\r\n
   242   s>     Accept-Encoding: identity\r\n
   242   s>     Accept-Encoding: identity\r\n
   243   s>     user-agent: test\r\n
   243   s>     user-agent: test\r\n
   244   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   244   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   245   s>     \r\n
   245   s>     \r\n
   246   s> makefile('rb', None)
   246   s> makefile('rb', None)
   257   $ sendhttpraw << EOF
   257   $ sendhttpraw << EOF
   258   > httprequest GET api/$HTTPV2/rw/badcommand
   258   > httprequest GET api/$HTTPV2/rw/badcommand
   259   >     user-agent: test
   259   >     user-agent: test
   260   > EOF
   260   > EOF
   261   using raw connection to peer
   261   using raw connection to peer
   262   s>     GET /api/exp-http-v2-0001/rw/badcommand HTTP/1.1\r\n
   262   s>     GET /api/exp-http-v2-0002/rw/badcommand HTTP/1.1\r\n
   263   s>     Accept-Encoding: identity\r\n
   263   s>     Accept-Encoding: identity\r\n
   264   s>     user-agent: test\r\n
   264   s>     user-agent: test\r\n
   265   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   265   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   266   s>     \r\n
   266   s>     \r\n
   267   s> makefile('rb', None)
   267   s> makefile('rb', None)
   278   $ sendhttpraw << EOF
   278   $ sendhttpraw << EOF
   279   > httprequest POST api/$HTTPV2/rw/customreadonly
   279   > httprequest POST api/$HTTPV2/rw/customreadonly
   280   >     user-agent: test
   280   >     user-agent: test
   281   > EOF
   281   > EOF
   282   using raw connection to peer
   282   using raw connection to peer
   283   s>     POST /api/exp-http-v2-0001/rw/customreadonly HTTP/1.1\r\n
   283   s>     POST /api/exp-http-v2-0002/rw/customreadonly HTTP/1.1\r\n
   284   s>     Accept-Encoding: identity\r\n
   284   s>     Accept-Encoding: identity\r\n
   285   s>     user-agent: test\r\n
   285   s>     user-agent: test\r\n
   286   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   286   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   287   s>     \r\n
   287   s>     \r\n
   288   s> makefile('rb', None)
   288   s> makefile('rb', None)
   316   >     accept: $MEDIATYPE
   316   >     accept: $MEDIATYPE
   317   >     content-type: $MEDIATYPE
   317   >     content-type: $MEDIATYPE
   318   >     frame 1 1 stream-begin command-request new cbor:{b'name': b'customreadonly'}
   318   >     frame 1 1 stream-begin command-request new cbor:{b'name': b'customreadonly'}
   319   > EOF
   319   > EOF
   320   using raw connection to peer
   320   using raw connection to peer
   321   s>     POST /api/exp-http-v2-0001/rw/customreadonly HTTP/1.1\r\n
   321   s>     POST /api/exp-http-v2-0002/rw/customreadonly HTTP/1.1\r\n
   322   s>     Accept-Encoding: identity\r\n
   322   s>     Accept-Encoding: identity\r\n
   323   s>     accept: application/mercurial-exp-framing-0005\r\n
   323   s>     accept: application/mercurial-exp-framing-0005\r\n
   324   s>     content-type: application/mercurial-exp-framing-0005\r\n
   324   s>     content-type: application/mercurial-exp-framing-0005\r\n
   325   s>     user-agent: test\r\n
   325   s>     user-agent: test\r\n
   326   s>     content-length: 29\r\n
   326   s>     content-length: 29\r\n
   352   > httprequest POST api/$HTTPV2/rw/badcommand
   352   > httprequest POST api/$HTTPV2/rw/badcommand
   353   >     user-agent: test
   353   >     user-agent: test
   354   >     accept: $MEDIATYPE
   354   >     accept: $MEDIATYPE
   355   > EOF
   355   > EOF
   356   using raw connection to peer
   356   using raw connection to peer
   357   s>     POST /api/exp-http-v2-0001/rw/badcommand HTTP/1.1\r\n
   357   s>     POST /api/exp-http-v2-0002/rw/badcommand HTTP/1.1\r\n
   358   s>     Accept-Encoding: identity\r\n
   358   s>     Accept-Encoding: identity\r\n
   359   s>     accept: application/mercurial-exp-framing-0005\r\n
   359   s>     accept: application/mercurial-exp-framing-0005\r\n
   360   s>     user-agent: test\r\n
   360   s>     user-agent: test\r\n
   361   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   361   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   362   s>     \r\n
   362   s>     \r\n
   374   $ sendhttpraw << EOF
   374   $ sendhttpraw << EOF
   375   > httprequest POST api/$HTTPV2/ro/debugreflect
   375   > httprequest POST api/$HTTPV2/ro/debugreflect
   376   >     user-agent: test
   376   >     user-agent: test
   377   > EOF
   377   > EOF
   378   using raw connection to peer
   378   using raw connection to peer
   379   s>     POST /api/exp-http-v2-0001/ro/debugreflect HTTP/1.1\r\n
   379   s>     POST /api/exp-http-v2-0002/ro/debugreflect HTTP/1.1\r\n
   380   s>     Accept-Encoding: identity\r\n
   380   s>     Accept-Encoding: identity\r\n
   381   s>     user-agent: test\r\n
   381   s>     user-agent: test\r\n
   382   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   382   s>     host: $LOCALIP:$HGPORT\r\n (glob)
   383   s>     \r\n
   383   s>     \r\n
   384   s> makefile('rb', None)
   384   s> makefile('rb', None)
   414   >     content-type: $MEDIATYPE
   414   >     content-type: $MEDIATYPE
   415   >     user-agent: test
   415   >     user-agent: test
   416   >     frame 1 1 stream-begin command-request new cbor:{b'name': b'command1', b'args': {b'foo': b'val1', b'bar1': b'val'}}
   416   >     frame 1 1 stream-begin command-request new cbor:{b'name': b'command1', b'args': {b'foo': b'val1', b'bar1': b'val'}}
   417   > EOF
   417   > EOF
   418   using raw connection to peer
   418   using raw connection to peer
   419   s>     POST /api/exp-http-v2-0001/ro/debugreflect HTTP/1.1\r\n
   419   s>     POST /api/exp-http-v2-0002/ro/debugreflect HTTP/1.1\r\n
   420   s>     Accept-Encoding: identity\r\n
   420   s>     Accept-Encoding: identity\r\n
   421   s>     accept: application/mercurial-exp-framing-0005\r\n
   421   s>     accept: application/mercurial-exp-framing-0005\r\n
   422   s>     content-type: application/mercurial-exp-framing-0005\r\n
   422   s>     content-type: application/mercurial-exp-framing-0005\r\n
   423   s>     user-agent: test\r\n
   423   s>     user-agent: test\r\n
   424   s>     content-length: 47\r\n
   424   s>     content-length: 47\r\n
   445   >     content-type: $MEDIATYPE
   445   >     content-type: $MEDIATYPE
   446   >     user-agent: test
   446   >     user-agent: test
   447   >     frame 1 1 stream-begin command-request new cbor:{b'name': b'customreadonly'}
   447   >     frame 1 1 stream-begin command-request new cbor:{b'name': b'customreadonly'}
   448   > EOF
   448   > EOF
   449   using raw connection to peer
   449   using raw connection to peer
   450   s>     POST /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n
   450   s>     POST /api/exp-http-v2-0002/ro/customreadonly HTTP/1.1\r\n
   451   s>     Accept-Encoding: identity\r\n
   451   s>     Accept-Encoding: identity\r\n
   452   s>     accept: application/mercurial-exp-framing-0005\r\n
   452   s>     accept: application/mercurial-exp-framing-0005\r\n
   453   s>     content-type: application/mercurial-exp-framing-0005\r\n
   453   s>     content-type: application/mercurial-exp-framing-0005\r\n
   454   s>     user-agent: test\r\n
   454   s>     user-agent: test\r\n
   455   s>     content-length: 29\r\n
   455   s>     content-length: 29\r\n
   484   >     user-agent: test
   484   >     user-agent: test
   485   >     frame 1 1 stream-begin command-request new cbor:{b'name': b'customreadonly'}
   485   >     frame 1 1 stream-begin command-request new cbor:{b'name': b'customreadonly'}
   486   >     frame 3 1 0 command-request new cbor:{b'name': b'customreadonly'}
   486   >     frame 3 1 0 command-request new cbor:{b'name': b'customreadonly'}
   487   > EOF
   487   > EOF
   488   using raw connection to peer
   488   using raw connection to peer
   489   s>     POST /api/exp-http-v2-0001/ro/multirequest HTTP/1.1\r\n
   489   s>     POST /api/exp-http-v2-0002/ro/multirequest HTTP/1.1\r\n
   490   s>     Accept-Encoding: identity\r\n
   490   s>     Accept-Encoding: identity\r\n
   491   s>     *\r\n (glob)
   491   s>     *\r\n (glob)
   492   s>     *\r\n (glob)
   492   s>     *\r\n (glob)
   493   s>     user-agent: test\r\n
   493   s>     user-agent: test\r\n
   494   s>     content-length: 58\r\n
   494   s>     content-length: 58\r\n
   534   >     frame 3 1 0 command-request new|more \xa2Dargs\xa1Inamespace
   534   >     frame 3 1 0 command-request new|more \xa2Dargs\xa1Inamespace
   535   >     frame 3 1 0 command-request continuation JnamespacesDnameHlistkeys
   535   >     frame 3 1 0 command-request continuation JnamespacesDnameHlistkeys
   536   >     frame 1 1 0 command-request continuation IbookmarksDnameHlistkeys
   536   >     frame 1 1 0 command-request continuation IbookmarksDnameHlistkeys
   537   > EOF
   537   > EOF
   538   using raw connection to peer
   538   using raw connection to peer
   539   s>     POST /api/exp-http-v2-0001/ro/multirequest HTTP/1.1\r\n
   539   s>     POST /api/exp-http-v2-0002/ro/multirequest HTTP/1.1\r\n
   540   s>     Accept-Encoding: identity\r\n
   540   s>     Accept-Encoding: identity\r\n
   541   s>     accept: application/mercurial-exp-framing-0005\r\n
   541   s>     accept: application/mercurial-exp-framing-0005\r\n
   542   s>     content-type: application/mercurial-exp-framing-0005\r\n
   542   s>     content-type: application/mercurial-exp-framing-0005\r\n
   543   s>     user-agent: test\r\n
   543   s>     user-agent: test\r\n
   544   s>     content-length: 115\r\n
   544   s>     content-length: 115\r\n
   596   >     content-type: $MEDIATYPE
   596   >     content-type: $MEDIATYPE
   597   >     user-agent: test
   597   >     user-agent: test
   598   >     frame 1 1 stream-begin command-request new cbor:{b'name': b'pushkey'}
   598   >     frame 1 1 stream-begin command-request new cbor:{b'name': b'pushkey'}
   599   > EOF
   599   > EOF
   600   using raw connection to peer
   600   using raw connection to peer
   601   s>     POST /api/exp-http-v2-0001/ro/multirequest HTTP/1.1\r\n
   601   s>     POST /api/exp-http-v2-0002/ro/multirequest HTTP/1.1\r\n
   602   s>     Accept-Encoding: identity\r\n
   602   s>     Accept-Encoding: identity\r\n
   603   s>     accept: application/mercurial-exp-framing-0005\r\n
   603   s>     accept: application/mercurial-exp-framing-0005\r\n
   604   s>     content-type: application/mercurial-exp-framing-0005\r\n
   604   s>     content-type: application/mercurial-exp-framing-0005\r\n
   605   s>     user-agent: test\r\n
   605   s>     user-agent: test\r\n
   606   s>     content-length: 22\r\n
   606   s>     content-length: 22\r\n