##// END OF EJS Templates
tests: add setsockopt() output on Python 3...
Gregory Szorc -
r41350:f790a4e7 default
parent child Browse files
Show More
@@ -1,293 +1,299 b''
1 1 #require no-chg
2 2
3 3 $ send() {
4 4 > hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT/
5 5 > }
6 6
7 7 $ hg init server
8 8 $ hg -R server serve -p $HGPORT -d --pid-file hg.pid
9 9 $ cat hg.pid > $DAEMON_PIDS
10 10
11 11 Request to /api fails unless web.apiserver is enabled
12 12
13 13 $ get-with-headers.py $LOCALIP:$HGPORT api
14 14 400 no such method: api
15 15
16 16 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
17 17 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
18 18 <head>
19 19 <link rel="icon" href="/static/hgicon.png" type="image/png" />
20 20 <meta name="robots" content="index, nofollow" />
21 21 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
22 22 <script type="text/javascript" src="/static/mercurial.js"></script>
23 23
24 24 <title>$TESTTMP/server: error</title>
25 25 </head>
26 26 <body>
27 27
28 28 <div class="container">
29 29 <div class="menu">
30 30 <div class="logo">
31 31 <a href="https://mercurial-scm.org/">
32 32 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
33 33 </div>
34 34 <ul>
35 35 <li><a href="/shortlog">log</a></li>
36 36 <li><a href="/graph">graph</a></li>
37 37 <li><a href="/tags">tags</a></li>
38 38 <li><a href="/bookmarks">bookmarks</a></li>
39 39 <li><a href="/branches">branches</a></li>
40 40 </ul>
41 41 <ul>
42 42 <li><a href="/help">help</a></li>
43 43 </ul>
44 44 </div>
45 45
46 46 <div class="main">
47 47
48 48 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
49 49 <h3>error</h3>
50 50
51 51
52 52 <form class="search" action="/log">
53 53
54 54 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
55 55 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
56 56 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
57 57 </form>
58 58
59 59 <div class="description">
60 60 <p>
61 61 An error occurred while processing your request:
62 62 </p>
63 63 <p>
64 64 no such method: api
65 65 </p>
66 66 </div>
67 67 </div>
68 68 </div>
69 69
70 70
71 71
72 72 </body>
73 73 </html>
74 74
75 75 [1]
76 76
77 77 $ get-with-headers.py $LOCALIP:$HGPORT api/
78 78 400 no such method: api
79 79
80 80 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
81 81 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
82 82 <head>
83 83 <link rel="icon" href="/static/hgicon.png" type="image/png" />
84 84 <meta name="robots" content="index, nofollow" />
85 85 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
86 86 <script type="text/javascript" src="/static/mercurial.js"></script>
87 87
88 88 <title>$TESTTMP/server: error</title>
89 89 </head>
90 90 <body>
91 91
92 92 <div class="container">
93 93 <div class="menu">
94 94 <div class="logo">
95 95 <a href="https://mercurial-scm.org/">
96 96 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
97 97 </div>
98 98 <ul>
99 99 <li><a href="/shortlog">log</a></li>
100 100 <li><a href="/graph">graph</a></li>
101 101 <li><a href="/tags">tags</a></li>
102 102 <li><a href="/bookmarks">bookmarks</a></li>
103 103 <li><a href="/branches">branches</a></li>
104 104 </ul>
105 105 <ul>
106 106 <li><a href="/help">help</a></li>
107 107 </ul>
108 108 </div>
109 109
110 110 <div class="main">
111 111
112 112 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
113 113 <h3>error</h3>
114 114
115 115
116 116 <form class="search" action="/log">
117 117
118 118 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
119 119 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
120 120 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
121 121 </form>
122 122
123 123 <div class="description">
124 124 <p>
125 125 An error occurred while processing your request:
126 126 </p>
127 127 <p>
128 128 no such method: api
129 129 </p>
130 130 </div>
131 131 </div>
132 132 </div>
133 133
134 134
135 135
136 136 </body>
137 137 </html>
138 138
139 139 [1]
140 140
141 141 Restart server with support for API server
142 142
143 143 $ killdaemons.py
144 144 $ cat > server/.hg/hgrc << EOF
145 145 > [experimental]
146 146 > web.apiserver = true
147 147 > EOF
148 148
149 149 $ hg -R server serve -p $HGPORT -d --pid-file hg.pid
150 150 $ cat hg.pid > $DAEMON_PIDS
151 151
152 152 /api lists available APIs (empty since none are available by default)
153 153
154 154 $ send << EOF
155 155 > httprequest GET api
156 156 > user-agent: test
157 157 > EOF
158 158 using raw connection to peer
159 s> setsockopt(6, 1, 1) -> None (py3 !)
159 160 s> GET /api HTTP/1.1\r\n
160 161 s> Accept-Encoding: identity\r\n
161 162 s> user-agent: test\r\n
162 163 s> host: $LOCALIP:$HGPORT\r\n (glob)
163 164 s> \r\n
164 165 s> makefile('rb', None)
165 166 s> HTTP/1.1 200 OK\r\n
166 167 s> Server: testing stub value\r\n
167 168 s> Date: $HTTP_DATE$\r\n
168 169 s> Content-Type: text/plain\r\n
169 170 s> Content-Length: 100\r\n
170 171 s> \r\n
171 172 s> APIs can be accessed at /api/<name>, where <name> can be one of the following:\n
172 173 s> \n
173 174 s> (no available APIs)\n
174 175
175 176 $ send << EOF
176 177 > httprequest GET api/
177 178 > user-agent: test
178 179 > EOF
179 180 using raw connection to peer
181 s> setsockopt(6, 1, 1) -> None (py3 !)
180 182 s> GET /api/ HTTP/1.1\r\n
181 183 s> Accept-Encoding: identity\r\n
182 184 s> user-agent: test\r\n
183 185 s> host: $LOCALIP:$HGPORT\r\n (glob)
184 186 s> \r\n
185 187 s> makefile('rb', None)
186 188 s> HTTP/1.1 200 OK\r\n
187 189 s> Server: testing stub value\r\n
188 190 s> Date: $HTTP_DATE$\r\n
189 191 s> Content-Type: text/plain\r\n
190 192 s> Content-Length: 100\r\n
191 193 s> \r\n
192 194 s> APIs can be accessed at /api/<name>, where <name> can be one of the following:\n
193 195 s> \n
194 196 s> (no available APIs)\n
195 197
196 198 Accessing an unknown API yields a 404
197 199
198 200 $ send << EOF
199 201 > httprequest GET api/unknown
200 202 > user-agent: test
201 203 > EOF
202 204 using raw connection to peer
205 s> setsockopt(6, 1, 1) -> None (py3 !)
203 206 s> GET /api/unknown HTTP/1.1\r\n
204 207 s> Accept-Encoding: identity\r\n
205 208 s> user-agent: test\r\n
206 209 s> host: $LOCALIP:$HGPORT\r\n (glob)
207 210 s> \r\n
208 211 s> makefile('rb', None)
209 212 s> HTTP/1.1 404 Not Found\r\n
210 213 s> Server: testing stub value\r\n
211 214 s> Date: $HTTP_DATE$\r\n
212 215 s> Content-Type: text/plain\r\n
213 216 s> Content-Length: 33\r\n
214 217 s> \r\n
215 218 s> Unknown API: unknown\n
216 219 s> Known APIs:
217 220
218 221 Accessing a known but not enabled API yields a different error
219 222
220 223 $ send << EOF
221 224 > httprequest GET api/exp-http-v2-0003
222 225 > user-agent: test
223 226 > EOF
224 227 using raw connection to peer
228 s> setsockopt(6, 1, 1) -> None (py3 !)
225 229 s> GET /api/exp-http-v2-0003 HTTP/1.1\r\n
226 230 s> Accept-Encoding: identity\r\n
227 231 s> user-agent: test\r\n
228 232 s> host: $LOCALIP:$HGPORT\r\n (glob)
229 233 s> \r\n
230 234 s> makefile('rb', None)
231 235 s> HTTP/1.1 404 Not Found\r\n
232 236 s> Server: testing stub value\r\n
233 237 s> Date: $HTTP_DATE$\r\n
234 238 s> Content-Type: text/plain\r\n
235 239 s> Content-Length: 33\r\n
236 240 s> \r\n
237 241 s> API exp-http-v2-0003 not enabled\n
238 242
239 243 Restart server with support for HTTP v2 API
240 244
241 245 $ killdaemons.py
242 246 $ cat > server/.hg/hgrc << EOF
243 247 > [experimental]
244 248 > web.apiserver = true
245 249 > web.api.http-v2 = true
246 250 > EOF
247 251
248 252 $ hg -R server serve -p $HGPORT -d --pid-file hg.pid
249 253 $ cat hg.pid > $DAEMON_PIDS
250 254
251 255 /api lists the HTTP v2 protocol as available
252 256
253 257 $ send << EOF
254 258 > httprequest GET api
255 259 > user-agent: test
256 260 > EOF
257 261 using raw connection to peer
262 s> setsockopt(6, 1, 1) -> None (py3 !)
258 263 s> GET /api HTTP/1.1\r\n
259 264 s> Accept-Encoding: identity\r\n
260 265 s> user-agent: test\r\n
261 266 s> host: $LOCALIP:$HGPORT\r\n (glob)
262 267 s> \r\n
263 268 s> makefile('rb', None)
264 269 s> HTTP/1.1 200 OK\r\n
265 270 s> Server: testing stub value\r\n
266 271 s> Date: $HTTP_DATE$\r\n
267 272 s> Content-Type: text/plain\r\n
268 273 s> Content-Length: 96\r\n
269 274 s> \r\n
270 275 s> APIs can be accessed at /api/<name>, where <name> can be one of the following:\n
271 276 s> \n
272 277 s> exp-http-v2-0003
273 278
274 279 $ send << EOF
275 280 > httprequest GET api/
276 281 > user-agent: test
277 282 > EOF
278 283 using raw connection to peer
284 s> setsockopt(6, 1, 1) -> None (py3 !)
279 285 s> GET /api/ HTTP/1.1\r\n
280 286 s> Accept-Encoding: identity\r\n
281 287 s> user-agent: test\r\n
282 288 s> host: $LOCALIP:$HGPORT\r\n (glob)
283 289 s> \r\n
284 290 s> makefile('rb', None)
285 291 s> HTTP/1.1 200 OK\r\n
286 292 s> Server: testing stub value\r\n
287 293 s> Date: $HTTP_DATE$\r\n
288 294 s> Content-Type: text/plain\r\n
289 295 s> Content-Length: 96\r\n
290 296 s> \r\n
291 297 s> APIs can be accessed at /api/<name>, where <name> can be one of the following:\n
292 298 s> \n
293 299 s> exp-http-v2-0003
General Comments 0
You need to be logged in to leave comments. Login now