mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
Fix a crash when parsing empty HTTP headers
This commit is contained in:
@@ -25,6 +25,7 @@ HEAD
|
||||
- Bug: Fix handler allocation crash with multithreaded io_service.
|
||||
- Bug: Fixes incorrect whitespace handling in header parsing. #301 Thank you
|
||||
Wolfram Schroers for reporting
|
||||
- Bug: Fix a crash when parsing empty HTTP headers. Thank you Thingol for reporting.
|
||||
|
||||
0.3.0-alpha4 - 2013-10-11
|
||||
- HTTP requests ending normally are no longer logged as errors. Thank you Banaan
|
||||
|
||||
@@ -363,6 +363,7 @@ BOOST_AUTO_TEST_CASE( strip_lws ) {
|
||||
std::string test5 = " foo ";
|
||||
std::string test6 = " \r\n foo ";
|
||||
std::string test7 = " \t foo ";
|
||||
std::string test8 = " \t ";
|
||||
|
||||
BOOST_CHECK_EQUAL( websocketpp::http::parser::strip_lws(test1), "foo" );
|
||||
BOOST_CHECK_EQUAL( websocketpp::http::parser::strip_lws(test2), "foo" );
|
||||
@@ -371,6 +372,7 @@ BOOST_AUTO_TEST_CASE( strip_lws ) {
|
||||
BOOST_CHECK_EQUAL( websocketpp::http::parser::strip_lws(test5), "foo" );
|
||||
BOOST_CHECK_EQUAL( websocketpp::http::parser::strip_lws(test6), "foo" );
|
||||
BOOST_CHECK_EQUAL( websocketpp::http::parser::strip_lws(test7), "foo" );
|
||||
BOOST_CHECK_EQUAL( websocketpp::http::parser::strip_lws(test8), "" );
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( case_insensitive_headers ) {
|
||||
|
||||
@@ -369,6 +369,9 @@ InputIterator extract_parameters(InputIterator begin, InputIterator end,
|
||||
|
||||
inline std::string strip_lws(std::string const & input) {
|
||||
std::string::const_iterator begin = extract_all_lws(input.begin(),input.end());
|
||||
if (begin == input.end()) {
|
||||
return std::string();
|
||||
}
|
||||
std::string::const_reverse_iterator end = extract_all_lws(input.rbegin(),input.rend());
|
||||
|
||||
return std::string(begin,end.base());
|
||||
|
||||
Reference in New Issue
Block a user