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

Method testLimits

test/beast/http/basic_parser.cpp:853–965  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

851 }
852
853 void
854 testLimits()
855 {
856 {
857 multi_buffer b;
858 ostream(b) <<
859 "POST / HTTP/1.1\r\n"
860 "Content-Length: 2\r\n"
861 "\r\n"
862 "**";
863 error_code ec;
864 test_parser<true> p;
865 p.header_limit(10);
866 p.eager(true);
867 p.put(b.data(), ec);
868 BEAST_EXPECTS(ec == error::header_limit, ec.message());
869 }
870 {
871 multi_buffer b;
872 ostream(b) <<
873 "POST / HTTP/1.1\r\n";
874 error_code ec;
875 test_parser<true> p;
876 p.header_limit(18);
877 p.eager(true);
878 b.consume(p.put(b.data(), ec));
879 BEAST_EXPECTS(ec == error::need_more, ec.message());
880 ostream(b) <<
881 "field: value\r\n";
882 b.consume(p.put(b.data(), ec));
883 BEAST_EXPECT(! p.is_done());
884 BEAST_EXPECTS(ec == error::header_limit, ec.message());
885 }
886 {
887 multi_buffer b;
888 ostream(b) <<
889 "POST / HTTP/1.1\r\n"
890 "Transfer-Encoding: chunked\r\n"
891 "\r\n"
892 "0\r\n";
893 error_code ec;
894 test_parser<true> p;
895 p.header_limit(47);
896 p.eager(true);
897 b.consume(p.put(b.data(), ec));
898 BEAST_EXPECTS(ec == error::need_more, ec.message());
899 ostream(b) <<
900 "field: value\r\n"
901 "\r\n";
902 b.consume(p.put(b.data(), ec));
903 BEAST_EXPECT(! p.is_done());
904 BEAST_EXPECTS(ec == error::header_limit, ec.message());
905 }
906 {
907 multi_buffer b;
908 ostream(b) <<
909 "POST / HTTP/1.1\r\n"
910 "Content-Length: 2\r\n"

Callers

nothing calls this directly

Calls 8

header_limitMethod · 0.80
eagerMethod · 0.80
messageMethod · 0.80
body_limitMethod · 0.80
putMethod · 0.45
dataMethod · 0.45
consumeMethod · 0.45
is_doneMethod · 0.45

Tested by

no test coverage detected