annotate tests/test-http-api.t @ 40022:33eb670e2834

wireprotov2: define semantics for content redirects When I implemented the clonebundles feature and deployed it on hg.mozilla.org using Amazon S3 as a content server, server-side CPU and bandwidth usage dropped off a cliff and a ton of server scaling headaches went away pretty much the instant clients with support for clonebundles were rolled out to Firefox CI. An obvious takeaway from that experience was that offloading server load to scalable file servers - potentially backed by a CDN - is a really good idea. Another takeaway was that Mercurial's wire protocol wasn't in a good position to support data offload generally. In wire protocol version 1, there isn't a mechanism in the protocol to say "grab the data from over here instead." For HTTP, we could teach the client to follow HTTP redirects. Or we could invent a media type that encoded redirects inline. But for SSH, we were pretty much out of luck because that protocol wasn't very flexible. Wire protocol version 2 offers the opportunity to do something better. The recent generic server-side content caching layer in the wire protocol version 2 server demonstrated that it is possible to have drop-in caching of responses to command requests. This by itself adds tons of value and already makes the built-in server much more scalable. But I don't want to stop there. The existing server-side caching implementation has a big weakness: it requires the server to send data to the client. This means that the Mercurial server is potentially sending gigabytes of data to thousands of clients. This is problematic because compared to scaling static file servers, scaling dynamic servers is *hard*. A solution to this is to "offload" serving of content to something that isn't the Mercurial server. By offloading content serving, you turn the Mercurial server from a centralized monolithic service to a distributed mostly-indexing service. Assuming high rates of content offload, this should drastically reduce the total work performed by the Mercurial server, both in terms of CPU and data transfer. This will make Mercurial servers vastly easier to scale. This commit defines the semantics for "content redirects" in wire protocol version 2. Essentially: * Servers advertise the set of locations a response could be served from. * When making requests, clients advertise the set of locations they are willing to fetch content from. * Servers can then replace the inline response with one that says "get the response from over here instead." This feature - when fully implemented - will allow extending the server-side caching layer to facilitate such things as integrating your server-side cache with a scalable blob store (such as S3 or a CDN) and offloading most data transfer to that external service. This feature could also be leveraged for load balancing. e.g. requests could come into a central server and then get redirected to an available mirror depending on server availability or locality. There's tons of potential :) Differential Revision: https://phab.mercurial-scm.org/D4774
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 26 Sep 2018 18:02:06 -0700
parents d059cb669632
children 41263df08109
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
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
39814
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 38021
diff changeset
221 > httprequest GET api/exp-http-v2-0002
37046
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
39814
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 38021
diff changeset
225 s> GET /api/exp-http-v2-0002 HTTP/1.1\r\n
37046
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
39814
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 38021
diff changeset
237 s> API exp-http-v2-0002 not enabled\n
37046
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
39814
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 38021
diff changeset
272 s> exp-http-v2-0002
37046
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
39814
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 38021
diff changeset
293 s> exp-http-v2-0002