MCPcopy Create free account
hub / github.com/boostorg/beast / testRead

Method testRead

test/beast/http/read.cpp:260–344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258 }
259
260 void testRead(yield_context do_yield)
261 {
262 static std::size_t constexpr limit = 100;
263 std::size_t n;
264
265 for(n = 0; n < limit; ++n)
266 {
267 test::fail_count fc{n};
268 test::stream c{ioc_, fc,
269 "GET / HTTP/1.1\r\n"
270 "Host: localhost\r\n"
271 "User-Agent: test\r\n"
272 "Content-Length: 0\r\n"
273 "\r\n"
274 };
275 request<dynamic_body> m;
276 try
277 {
278 multi_buffer b;
279 read(c, b, m);
280 break;
281 }
282 catch(std::exception const&)
283 {
284 }
285 }
286 BEAST_EXPECT(n < limit);
287
288 for(n = 0; n < limit; ++n)
289 {
290 test::fail_count fc{n};
291 test::stream ts{ioc_, fc,
292 "GET / HTTP/1.1\r\n"
293 "Host: localhost\r\n"
294 "User-Agent: test\r\n"
295 "Content-Length: 0\r\n"
296 "\r\n"
297 };
298 request<dynamic_body> m;
299 error_code ec = test::error::test_failure;
300 multi_buffer b;
301 read(ts, b, m, ec);
302 if(! ec)
303 break;
304 }
305 BEAST_EXPECT(n < limit);
306
307 for(n = 0; n < limit; ++n)
308 {
309 test::fail_count fc{n};
310 test::stream c{ioc_, fc,
311 "GET / HTTP/1.1\r\n"
312 "Host: localhost\r\n"
313 "User-Agent: test\r\n"
314 "Content-Length: 0\r\n"
315 "\r\n"
316 };
317 request<dynamic_body> m;

Callers

nothing calls this directly

Calls 3

async_read_someFunction · 0.85
readFunction · 0.50
async_readFunction · 0.50

Tested by

no test coverage detected