tests/test-http-api.t
author Matt Harbison <matt_harbison@yahoo.com>
Sun, 24 Jun 2018 01:13:09 -0400
changeset 38483 3efadf2317c7
parent 38021 538e850ae737
child 39814 d059cb669632
permissions -rw-r--r--
windows: add a method to convert Unix style command lines to Windows style This started as a copy/paste of `os.path.expandvars()`, but limited to a given dictionary of variables, converting `foo = foo + bar` to `foo += bar`, and adding 'b' string prefixes. Then code was added to make sure that a value being substituted in wouldn't itself be expanded by cmd.exe. But that left inconsistent results between `$var1` and `%var1%` when its value was '%foo%'- since neither were touched, `$var1` wouldn't expand but `%var1%` would. So instead, this just converts the Unix style to Windows style (if the variable exists, because Windows will leave `%missing%` as-is), and lets cmd.exe do its thing. I then dropped the %% -> % conversion (because Windows doesn't do this), and added the ability to escape the '$' with '\'. The escape character is dropped, for consistency with shell handling. After everything seemed stable and working, running the whole test suite flagged a problem near the end of test-bookmarks.t:1069. The problem is cmd.exe won't pass empty variables to its child, so defined but empty variables are now skipped. I can't think of anything better, and it seems like a pre-existing violation of the documentation, which calls out that HG_OLDNODE is empty on bookmark creation. Future additions could potentially be replacing strong quotes with double quotes (cmd.exe doesn't know what to do with the former), escaping a double quote, and some tilde expansion via os.path.expanduser(). I've got some doubts about replacing the strong quotes in case sh.exe is run, but it seems like the right thing to do the vast majority of the time. The original form of this was discussed about a year ago[1]. [1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-July/100735.html
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38021
538e850ae737 tests: mark tests that fail when using chg as #require no-chg
Kyle Lippincott <spectral@google.com>
parents: 37093
diff changeset
     1
#require no-chg
538e850ae737 tests: mark tests that fail when using chg as #require no-chg
Kyle Lippincott <spectral@google.com>
parents: 37093
diff changeset
     2
37046
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     3
  $ send() {
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     4
  >   hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT/
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     5
  > }
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     6
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     7
  $ hg init server
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     8
  $ hg -R server serve -p $HGPORT -d --pid-file hg.pid
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     9
  $ cat hg.pid > $DAEMON_PIDS
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    10
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    11
Request to /api fails unless web.apiserver is enabled
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    12
37093
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    13
  $ get-with-headers.py $LOCALIP:$HGPORT api
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    14
  400 no such method: api
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    15
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    16
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    17
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    18
  <head>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    19
  <link rel="icon" href="/static/hgicon.png" type="image/png" />
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    20
  <meta name="robots" content="index, nofollow" />
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    21
  <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    22
  <script type="text/javascript" src="/static/mercurial.js"></script>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    23
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    24
  <title>$TESTTMP/server: error</title>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    25
  </head>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    26
  <body>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    27
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    28
  <div class="container">
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    29
  <div class="menu">
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    30
  <div class="logo">
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    31
  <a href="https://mercurial-scm.org/">
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    32
  <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    33
  </div>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    34
  <ul>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    35
  <li><a href="/shortlog">log</a></li>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    36
  <li><a href="/graph">graph</a></li>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    37
  <li><a href="/tags">tags</a></li>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    38
  <li><a href="/bookmarks">bookmarks</a></li>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    39
  <li><a href="/branches">branches</a></li>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    40
  </ul>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    41
  <ul>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    42
  <li><a href="/help">help</a></li>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    43
  </ul>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    44
  </div>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    45
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    46
  <div class="main">
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    47
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    48
  <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    49
  <h3>error</h3>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    50
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    51
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    52
  <form class="search" action="/log">
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    53
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    54
  <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    55
  <div id="hint">Find changesets by keywords (author, files, the commit message), revision
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    56
  number or hash, or <a href="/help/revsets">revset expression</a>.</div>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    57
  </form>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    58
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    59
  <div class="description">
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    60
  <p>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    61
  An error occurred while processing your request:
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    62
  </p>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    63
  <p>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    64
  no such method: api
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    65
  </p>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    66
  </div>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    67
  </div>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    68
  </div>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    69
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    70
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    71
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    72
  </body>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    73
  </html>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    74
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    75
  [1]
37046
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    76
37093
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    77
  $ get-with-headers.py $LOCALIP:$HGPORT api/
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    78
  400 no such method: api
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    79
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    80
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    81
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    82
  <head>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    83
  <link rel="icon" href="/static/hgicon.png" type="image/png" />
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    84
  <meta name="robots" content="index, nofollow" />
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    85
  <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    86
  <script type="text/javascript" src="/static/mercurial.js"></script>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    87
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    88
  <title>$TESTTMP/server: error</title>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    89
  </head>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    90
  <body>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    91
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    92
  <div class="container">
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    93
  <div class="menu">
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    94
  <div class="logo">
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    95
  <a href="https://mercurial-scm.org/">
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    96
  <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    97
  </div>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    98
  <ul>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
    99
  <li><a href="/shortlog">log</a></li>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   100
  <li><a href="/graph">graph</a></li>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   101
  <li><a href="/tags">tags</a></li>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   102
  <li><a href="/bookmarks">bookmarks</a></li>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   103
  <li><a href="/branches">branches</a></li>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   104
  </ul>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   105
  <ul>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   106
  <li><a href="/help">help</a></li>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   107
  </ul>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   108
  </div>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   109
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   110
  <div class="main">
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   111
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   112
  <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   113
  <h3>error</h3>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   114
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   115
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   116
  <form class="search" action="/log">
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   117
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   118
  <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   119
  <div id="hint">Find changesets by keywords (author, files, the commit message), revision
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   120
  number or hash, or <a href="/help/revsets">revset expression</a>.</div>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   121
  </form>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   122
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   123
  <div class="description">
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   124
  <p>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   125
  An error occurred while processing your request:
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   126
  </p>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   127
  <p>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   128
  no such method: api
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   129
  </p>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   130
  </div>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   131
  </div>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   132
  </div>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   133
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   134
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   135
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   136
  </body>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   137
  </html>
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   138
  
db114320df7e hgweb: don't responsd to api requests unless feature is enabled
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37046
diff changeset
   139
  [1]
37046
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   140
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   141
Restart server with support for API server
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   142
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   143
  $ killdaemons.py
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   144
  $ cat > server/.hg/hgrc << EOF
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   145
  > [experimental]
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   146
  > web.apiserver = true
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   147
  > EOF
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   148
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   149
  $ hg -R server serve -p $HGPORT -d --pid-file hg.pid
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   150
  $ cat hg.pid > $DAEMON_PIDS
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   151
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   152
/api lists available APIs (empty since none are available by default)
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   153
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   154
  $ send << EOF
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   155
  > httprequest GET api
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   156
  >     user-agent: test
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   157
  > EOF
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   158
  using raw connection to peer
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   159
  s>     GET /api HTTP/1.1\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   160
  s>     Accept-Encoding: identity\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   161
  s>     user-agent: test\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   162
  s>     host: $LOCALIP:$HGPORT\r\n (glob)
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   163
  s>     \r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   164
  s> makefile('rb', None)
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   165
  s>     HTTP/1.1 200 OK\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   166
  s>     Server: testing stub value\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   167
  s>     Date: $HTTP_DATE$\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   168
  s>     Content-Type: text/plain\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   169
  s>     Content-Length: 100\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   170
  s>     \r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   171
  s>     APIs can be accessed at /api/<name>, where <name> can be one of the following:\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   172
  s>     \n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   173
  s>     (no available APIs)\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   174
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   175
  $ send << EOF
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   176
  > httprequest GET api/
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   177
  >     user-agent: test
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   178
  > EOF
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   179
  using raw connection to peer
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   180
  s>     GET /api/ HTTP/1.1\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   181
  s>     Accept-Encoding: identity\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   182
  s>     user-agent: test\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   183
  s>     host: $LOCALIP:$HGPORT\r\n (glob)
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   184
  s>     \r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   185
  s> makefile('rb', None)
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   186
  s>     HTTP/1.1 200 OK\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   187
  s>     Server: testing stub value\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   188
  s>     Date: $HTTP_DATE$\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   189
  s>     Content-Type: text/plain\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   190
  s>     Content-Length: 100\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   191
  s>     \r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   192
  s>     APIs can be accessed at /api/<name>, where <name> can be one of the following:\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   193
  s>     \n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   194
  s>     (no available APIs)\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   195
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   196
Accessing an unknown API yields a 404
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   197
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   198
  $ send << EOF
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   199
  > httprequest GET api/unknown
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   200
  >     user-agent: test
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   201
  > EOF
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   202
  using raw connection to peer
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   203
  s>     GET /api/unknown HTTP/1.1\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   204
  s>     Accept-Encoding: identity\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   205
  s>     user-agent: test\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   206
  s>     host: $LOCALIP:$HGPORT\r\n (glob)
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   207
  s>     \r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   208
  s> makefile('rb', None)
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   209
  s>     HTTP/1.1 404 Not Found\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   210
  s>     Server: testing stub value\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   211
  s>     Date: $HTTP_DATE$\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   212
  s>     Content-Type: text/plain\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   213
  s>     Content-Length: 33\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   214
  s>     \r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   215
  s>     Unknown API: unknown\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   216
  s>     Known APIs: 
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   217
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   218
Accessing a known but not enabled API yields a different error
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   219
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   220
  $ send << EOF
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   221
  > httprequest GET api/exp-http-v2-0001
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   222
  >     user-agent: test
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   223
  > EOF
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   224
  using raw connection to peer
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   225
  s>     GET /api/exp-http-v2-0001 HTTP/1.1\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   226
  s>     Accept-Encoding: identity\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   227
  s>     user-agent: test\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   228
  s>     host: $LOCALIP:$HGPORT\r\n (glob)
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   229
  s>     \r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   230
  s> makefile('rb', None)
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   231
  s>     HTTP/1.1 404 Not Found\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   232
  s>     Server: testing stub value\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   233
  s>     Date: $HTTP_DATE$\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   234
  s>     Content-Type: text/plain\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   235
  s>     Content-Length: 33\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   236
  s>     \r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   237
  s>     API exp-http-v2-0001 not enabled\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   238
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   239
Restart server with support for HTTP v2 API
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   240
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   241
  $ killdaemons.py
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   242
  $ cat > server/.hg/hgrc << EOF
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   243
  > [experimental]
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   244
  > web.apiserver = true
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   245
  > web.api.http-v2 = true
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   246
  > EOF
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   247
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   248
  $ hg -R server serve -p $HGPORT -d --pid-file hg.pid
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   249
  $ cat hg.pid > $DAEMON_PIDS
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   250
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   251
/api lists the HTTP v2 protocol as available
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   252
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   253
  $ send << EOF
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   254
  > httprequest GET api
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   255
  >     user-agent: test
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   256
  > EOF
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   257
  using raw connection to peer
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   258
  s>     GET /api HTTP/1.1\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   259
  s>     Accept-Encoding: identity\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   260
  s>     user-agent: test\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   261
  s>     host: $LOCALIP:$HGPORT\r\n (glob)
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   262
  s>     \r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   263
  s> makefile('rb', None)
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   264
  s>     HTTP/1.1 200 OK\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   265
  s>     Server: testing stub value\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   266
  s>     Date: $HTTP_DATE$\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   267
  s>     Content-Type: text/plain\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   268
  s>     Content-Length: 96\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   269
  s>     \r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   270
  s>     APIs can be accessed at /api/<name>, where <name> can be one of the following:\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   271
  s>     \n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   272
  s>     exp-http-v2-0001
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   273
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   274
  $ send << EOF
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   275
  > httprequest GET api/
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   276
  >     user-agent: test
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   277
  > EOF
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   278
  using raw connection to peer
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   279
  s>     GET /api/ HTTP/1.1\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   280
  s>     Accept-Encoding: identity\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   281
  s>     user-agent: test\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   282
  s>     host: $LOCALIP:$HGPORT\r\n (glob)
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   283
  s>     \r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   284
  s> makefile('rb', None)
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   285
  s>     HTTP/1.1 200 OK\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   286
  s>     Server: testing stub value\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   287
  s>     Date: $HTTP_DATE$\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   288
  s>     Content-Type: text/plain\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   289
  s>     Content-Length: 96\r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   290
  s>     \r\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   291
  s>     APIs can be accessed at /api/<name>, where <name> can be one of the following:\n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   292
  s>     \n
1cfef5693203 wireproto: support /api/* URL space for exposing APIs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   293
  s>     exp-http-v2-0001