HTTP support improvements:

* RFC2616 compliance
* Case insensitive equality, inequality operators for strings
* Improvements to http::parser
* Tidy up HTTP method enumeration
This commit is contained in:
Vinnie Falco
2014-07-31 15:45:27 -07:00
parent df32f27762
commit 5b8bb822ba
11 changed files with 1389 additions and 262 deletions

View File

@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2012, 2013 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -17,29 +17,48 @@
*/
//==============================================================================
#if BEAST_INCLUDE_BEASTCONFIG
#include "../../BeastConfig.h"
#endif
#include <beast/http/basic_message.h>
#include <beast/unit_test/suite.h>
namespace beast {
namespace http {
class basic_message_tests : public unit_test::suite
class basic_message_test : public beast::unit_test::suite
{
public:
void testCreate()
std::pair <basic_message, bool>
request (std::string const& text)
{
pass();
basic_message m;
basic_message::parser p (m, true);
auto result (p.write (boost::asio::buffer(text)));
auto result2 (p.eof());
return std::make_pair (std::move(m), result.first);
}
void run()
void
run()
{
testCreate();
auto const result = request (
"GET / HTTP/1.1\r\n"
//"Connection: Upgrade\r\n"
//"Upgrade: Ripple\r\n"
"Field: \t Value \t \r\n"
"Blib: Continu\r\n"
" ation\r\n"
"Field: Hey\r\n"
"Content-Length: 1\r\n"
"\r\n"
"x"
);
log << "|" << result.first.headers["Field"] << "|";
pass();
}
};
BEAST_DEFINE_TESTSUITE(basic_message,http,beast);
}
}
} // http
} // beast