]>
git.proxmox.com Git - ceph.git/blob - ceph/src/Beast/test/http/header_parser.cpp
2 // Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 // Test that header file is self-contained.
9 #include <beast/http/header_parser.hpp>
11 #include <beast/core/flat_streambuf.hpp>
12 #include <beast/http/read.hpp>
13 #include <beast/unit_test/suite.hpp>
14 #include <beast/test/string_istream.hpp>
15 #include <beast/test/yield_to.hpp>
20 class header_parser_test
21 : public beast::unit_test::suite
22 , public test::enable_yield_to
29 test::string_istream is
{ios_
,
31 "User-Agent: test\r\n"
34 flat_streambuf db
{1024};
35 header_parser
<true, fields
> p
;
37 BEAST_EXPECT(p
.is_complete());
40 test::string_istream is
{ios_
,
42 "User-Agent: test\r\n"
43 "Content-Length: 1\r\n"
47 flat_streambuf db
{1024};
48 header_parser
<true, fields
> p
;
50 BEAST_EXPECT(! p
.is_complete());
51 BEAST_EXPECT(p
.state() == parse_state::body
);
62 BEAST_DEFINE_TESTSUITE(header_parser
,http
,beast
);