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

Method testIssue2861

test/beast/http/parser.cpp:532–567  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

530 }
531
532 void
533 testIssue2861()
534 {
535 // Partial parsing of the final chunk when
536 // the final chunk is the only chunk in the body.
537 error_code ec;
538 flat_buffer b;
539 response_parser<string_body> p;
540
541 ostream(b) <<
542 "HTTP/1.1 200 OK\r\n"
543 "Transfer-Encoding: chunked\r\n"
544 "\r\n";
545
546 auto used = p.put(b.data(), ec);
547 b.consume(used);
548 BEAST_EXPECT(! ec);
549 BEAST_EXPECT(! p.is_done());
550
551 ostream(b) << "0\r\n"; // needs an extra CRLF
552 used = p.put(b.data(), ec);
553 BEAST_EXPECT(used == 3);
554 b.consume(used);
555 BEAST_EXPECT(ec == error::need_more);
556
557 ostream(b) << "\r";
558 used = p.put(b.data(), ec);
559 BEAST_EXPECT(used == 0);
560 BEAST_EXPECT(ec == error::need_more);
561
562 ostream(b) << "\n";
563 used = p.put(b.data(), ec);
564 BEAST_EXPECT(used == 2);
565 BEAST_EXPECT(!ec);
566 BEAST_EXPECT(p.is_done());
567 }
568
569 void
570 run() override

Callers

nothing calls this directly

Calls 4

putMethod · 0.45
dataMethod · 0.45
consumeMethod · 0.45
is_doneMethod · 0.45

Tested by

no test coverage detected