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