forked from boostorg/beast
+1
-2
@@ -47,9 +47,8 @@ unit-test http-tests :
|
||||
http/dynamic_body.cpp
|
||||
http/error.cpp
|
||||
http/fields.cpp
|
||||
http/header_parser.cpp
|
||||
http/message.cpp
|
||||
http/message_parser.cpp
|
||||
http/parser.cpp
|
||||
http/read.cpp
|
||||
http/rfc7230.cpp
|
||||
http/serializer.cpp
|
||||
|
||||
@@ -17,9 +17,8 @@ add_executable (http-tests
|
||||
empty_body.cpp
|
||||
error.cpp
|
||||
fields.cpp
|
||||
header_parser.cpp
|
||||
message.cpp
|
||||
message_parser.cpp
|
||||
parser.cpp
|
||||
read.cpp
|
||||
rfc7230.cpp
|
||||
serializer.cpp
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <beast/core/ostream.hpp>
|
||||
#include <beast/http/fields.hpp>
|
||||
#include <beast/http/message_parser.hpp>
|
||||
#include <beast/http/parser.hpp>
|
||||
#include <beast/http/read.hpp>
|
||||
#include <beast/http/write.hpp>
|
||||
#include <beast/test/string_istream.hpp>
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
// Test that header file is self-contained.
|
||||
#include <beast/http/header_parser.hpp>
|
||||
|
||||
#include <beast/core/flat_buffer.hpp>
|
||||
#include <beast/http/read.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
#include <beast/test/string_istream.hpp>
|
||||
#include <beast/test/yield_to.hpp>
|
||||
|
||||
namespace beast {
|
||||
namespace http {
|
||||
|
||||
class header_parser_test
|
||||
: public beast::unit_test::suite
|
||||
, public test::enable_yield_to
|
||||
{
|
||||
public:
|
||||
static
|
||||
boost::asio::const_buffers_1
|
||||
buf(string_view s)
|
||||
{
|
||||
return {s.data(), s.size()};
|
||||
}
|
||||
|
||||
void
|
||||
testParse()
|
||||
{
|
||||
{
|
||||
test::string_istream is{ios_,
|
||||
"GET / HTTP/1.1\r\n"
|
||||
"User-Agent: test\r\n"
|
||||
"\r\n"
|
||||
};
|
||||
flat_buffer db{1024};
|
||||
header_parser<true, fields> p;
|
||||
read_some(is, db, p);
|
||||
BEAST_EXPECT(p.is_header_done());
|
||||
}
|
||||
{
|
||||
test::string_istream is{ios_,
|
||||
"POST / HTTP/1.1\r\n"
|
||||
"User-Agent: test\r\n"
|
||||
"Content-Length: 1\r\n"
|
||||
"\r\n"
|
||||
"*"
|
||||
};
|
||||
flat_buffer db{1024};
|
||||
header_parser<true, fields> p;
|
||||
read_some(is, db, p);
|
||||
BEAST_EXPECT(p.is_header_done());
|
||||
BEAST_EXPECT(! p.is_done());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
run() override
|
||||
{
|
||||
testParse();
|
||||
}
|
||||
};
|
||||
|
||||
BEAST_DEFINE_TESTSUITE(header_parser,http,beast);
|
||||
|
||||
} // http
|
||||
} // beast
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
//
|
||||
|
||||
// Test that header file is self-contained.
|
||||
#include <beast/http/message_parser.hpp>
|
||||
#include <beast/http/parser.hpp>
|
||||
|
||||
#include "test_parser.hpp"
|
||||
|
||||
@@ -25,7 +25,58 @@
|
||||
namespace beast {
|
||||
namespace http {
|
||||
|
||||
class message_parser_test
|
||||
class header_parser_test
|
||||
: public beast::unit_test::suite
|
||||
, public test::enable_yield_to
|
||||
{
|
||||
public:
|
||||
static
|
||||
boost::asio::const_buffers_1
|
||||
buf(string_view s)
|
||||
{
|
||||
return {s.data(), s.size()};
|
||||
}
|
||||
|
||||
void
|
||||
testParse()
|
||||
{
|
||||
{
|
||||
test::string_istream is{ios_,
|
||||
"GET / HTTP/1.1\r\n"
|
||||
"User-Agent: test\r\n"
|
||||
"\r\n"
|
||||
};
|
||||
flat_buffer db{1024};
|
||||
header_parser<true, fields> p;
|
||||
read_some(is, db, p);
|
||||
BEAST_EXPECT(p.is_header_done());
|
||||
}
|
||||
{
|
||||
test::string_istream is{ios_,
|
||||
"POST / HTTP/1.1\r\n"
|
||||
"User-Agent: test\r\n"
|
||||
"Content-Length: 1\r\n"
|
||||
"\r\n"
|
||||
"*"
|
||||
};
|
||||
flat_buffer db{1024};
|
||||
header_parser<true, fields> p;
|
||||
read_some(is, db, p);
|
||||
BEAST_EXPECT(p.is_header_done());
|
||||
BEAST_EXPECT(! p.is_done());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
run() override
|
||||
{
|
||||
testParse();
|
||||
}
|
||||
};
|
||||
|
||||
BEAST_DEFINE_TESTSUITE(header_parser,http,beast);
|
||||
|
||||
class parser_test
|
||||
: public beast::unit_test::suite
|
||||
, public beast::test::enable_yield_to
|
||||
{
|
||||
@@ -363,7 +414,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
BEAST_DEFINE_TESTSUITE(message_parser,http,beast);
|
||||
BEAST_DEFINE_TESTSUITE(parser,http,beast);
|
||||
|
||||
} // http
|
||||
} // beast
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
#include <beast/core/static_buffer.hpp>
|
||||
#include <beast/http/fields.hpp>
|
||||
#include <beast/http/dynamic_body.hpp>
|
||||
#include <beast/http/header_parser.hpp>
|
||||
#include <beast/http/parser.hpp>
|
||||
#include <beast/http/string_body.hpp>
|
||||
#include <beast/test/fail_stream.hpp>
|
||||
#include <beast/test/pipe_stream.hpp>
|
||||
|
||||
Reference in New Issue
Block a user