| 1528 | } |
| 1529 | |
| 1530 | void testChunkedBodySize() |
| 1531 | { |
| 1532 | string_view resp = |
| 1533 | "HTTP/1.1 200 OK\r\n" |
| 1534 | "Server: test\r\n" |
| 1535 | "Transfer-Encoding: chunked\r\n" |
| 1536 | "\r\n" |
| 1537 | |
| 1538 | // chunk 1 |
| 1539 | "4\r\n" |
| 1540 | "Wiki\r\n" |
| 1541 | |
| 1542 | // chunk 2 |
| 1543 | "5\r\n" |
| 1544 | "pedia\r\n" |
| 1545 | |
| 1546 | // chunk 3 |
| 1547 | "E\r\n" |
| 1548 | " in\r\n" |
| 1549 | "\r\n" |
| 1550 | "chunks.\r\n" |
| 1551 | |
| 1552 | // end |
| 1553 | "0\r\n" |
| 1554 | "\r\n"; |
| 1555 | |
| 1556 | { // body limit not exceeded |
| 1557 | test_parser<false> p; |
| 1558 | p.eager(true); |
| 1559 | p.body_limit(23); |
| 1560 | error_code ec; |
| 1561 | p.put(net::buffer(resp.data(), resp.size()), ec); |
| 1562 | BEAST_EXPECT(!ec); |
| 1563 | p.put_eof(ec); |
| 1564 | BEAST_EXPECT(!ec); |
| 1565 | } |
| 1566 | |
| 1567 | { // body limit exceeded |
| 1568 | test_parser<false> p; |
| 1569 | p.eager(true); |
| 1570 | p.body_limit(22); |
| 1571 | error_code ec; |
| 1572 | p.put(net::buffer(resp.data(), resp.size()), ec); |
| 1573 | BEAST_EXPECT(ec == error::body_limit); |
| 1574 | p.put_eof(ec); |
| 1575 | BEAST_EXPECT(ec == error::partial_message); |
| 1576 | } |
| 1577 | } |
| 1578 | |
| 1579 | void |
| 1580 | testUnlimitedBody() |
nothing calls this directly
no test coverage detected