From 95ec68eb38dcbf0ffb39fdcca781906b2b053511 Mon Sep 17 00:00:00 2001 From: cnagune Date: Thu, 21 May 2015 23:09:05 +0900 Subject: [PATCH 001/123] fix timeout testcase - change broken link --- libs/network/test/http/client_get_timeout_test.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libs/network/test/http/client_get_timeout_test.cpp b/libs/network/test/http/client_get_timeout_test.cpp index 9eb0103b9..2b6807903 100644 --- a/libs/network/test/http/client_get_timeout_test.cpp +++ b/libs/network/test/http/client_get_timeout_test.cpp @@ -25,8 +25,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(http_get_test_timeout_1_0, client, client_types) { BOOST_AUTO_TEST_CASE_TEMPLATE(http_get_test_timeout_with_options, client, client_types) { typename client::request request( - "http://cznic.dl.sourceforge.net/project/boost/boost/1.55.0/" - "boost_1_55_0.tar.bz2"); + "http://releases.ubuntu.com/14.04.2/ubuntu-14.04.2-desktop-amd64.iso"); typename client::response response; typename client::options options; client client_(options.timeout(1)); From be97dfedbeb000a9c85904dbf994786ca56cba72 Mon Sep 17 00:00:00 2001 From: cnagune Date: Thu, 13 Aug 2015 15:49:59 +0900 Subject: [PATCH 002/123] fix boost::network::uri::decode error - out of range because of '%' --- boost/network/uri/decode.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/boost/network/uri/decode.hpp b/boost/network/uri/decode.hpp index e9e80e984..f261e991a 100644 --- a/boost/network/uri/decode.hpp +++ b/boost/network/uri/decode.hpp @@ -59,8 +59,14 @@ OutputIterator decode(const InputIterator &in_begin, while (it != in_end) { if (*it == '%') { ++it; + if (it == in_end) { + throw std::runtime_error("decoding fail because of '%'"); + } value_type v0 = detail::letter_to_hex(*it); ++it; + if (it == in_end) { + throw std::runtime_error("decoding fail because of '%'"); + } value_type v1 = detail::letter_to_hex(*it); ++it; *out++ = 0x10 * v0 + v1; From 66dd835bbb4a96488e411a0a60ccbbc283061bb7 Mon Sep 17 00:00:00 2001 From: cnagune Date: Thu, 13 Aug 2015 16:08:30 +0900 Subject: [PATCH 003/123] Revert "fix timeout testcase - change broken link" This reverts commit 95ec68eb38dcbf0ffb39fdcca781906b2b053511. --- libs/network/test/http/client_get_timeout_test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/network/test/http/client_get_timeout_test.cpp b/libs/network/test/http/client_get_timeout_test.cpp index 2b6807903..9eb0103b9 100644 --- a/libs/network/test/http/client_get_timeout_test.cpp +++ b/libs/network/test/http/client_get_timeout_test.cpp @@ -25,7 +25,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(http_get_test_timeout_1_0, client, client_types) { BOOST_AUTO_TEST_CASE_TEMPLATE(http_get_test_timeout_with_options, client, client_types) { typename client::request request( - "http://releases.ubuntu.com/14.04.2/ubuntu-14.04.2-desktop-amd64.iso"); + "http://cznic.dl.sourceforge.net/project/boost/boost/1.55.0/" + "boost_1_55_0.tar.bz2"); typename client::response response; typename client::options options; client client_(options.timeout(1)); From 0a5e2fba05347fb1140e6fc6a4060188dc6163ba Mon Sep 17 00:00:00 2001 From: cnagune Date: Thu, 13 Aug 2015 17:26:36 +0900 Subject: [PATCH 004/123] fix boost::network::uri::decode error - add header --- boost/network/uri/decode.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/boost/network/uri/decode.hpp b/boost/network/uri/decode.hpp index f261e991a..33579d456 100644 --- a/boost/network/uri/decode.hpp +++ b/boost/network/uri/decode.hpp @@ -10,6 +10,7 @@ #include #include #include +#include namespace boost { namespace network { From 4ab9e488e1e64334ca67d897d3ce326a63d32575 Mon Sep 17 00:00:00 2001 From: cnagune Date: Fri, 14 Aug 2015 16:03:59 +0900 Subject: [PATCH 005/123] add testcase for boost::network::uri::decode --- boost/network/uri/decode.hpp | 10 ++-------- libs/network/test/uri/uri_encoding_test.cpp | 7 +++++++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/boost/network/uri/decode.hpp b/boost/network/uri/decode.hpp index 33579d456..0fd350014 100644 --- a/boost/network/uri/decode.hpp +++ b/boost/network/uri/decode.hpp @@ -59,15 +59,9 @@ OutputIterator decode(const InputIterator &in_begin, OutputIterator out = out_begin; while (it != in_end) { if (*it == '%') { - ++it; - if (it == in_end) { - throw std::runtime_error("decoding fail because of '%'"); - } + if (++it == in_end) throw std::runtime_error("decoding fail because of '%'"); value_type v0 = detail::letter_to_hex(*it); - ++it; - if (it == in_end) { - throw std::runtime_error("decoding fail because of '%'"); - } + if (++it == in_end) throw std::runtime_error("decoding fail because of '%'"); value_type v1 = detail::letter_to_hex(*it); ++it; *out++ = 0x10 * v0 + v1; diff --git a/libs/network/test/uri/uri_encoding_test.cpp b/libs/network/test/uri/uri_encoding_test.cpp index aaff45dbf..2190e33b6 100644 --- a/libs/network/test/uri/uri_encoding_test.cpp +++ b/libs/network/test/uri/uri_encoding_test.cpp @@ -47,3 +47,10 @@ BOOST_AUTO_TEST_CASE(decoding_multibyte_test) { uri::decode(encoded, std::back_inserter(instance)); BOOST_CHECK_EQUAL(instance, unencoded); } + +BOOST_AUTO_TEST_CASE(decoding_throw_test) { + const std::string encoded("%"); + + std::string instance; + BOOST_CHECK_THROW(uri::decoded(encoded), std::runtime_error); +} From 99b9eb38e8ebc8edb80ff1c4abbaf35e8cfcd146 Mon Sep 17 00:00:00 2001 From: cnagune Date: Fri, 14 Aug 2015 16:20:50 +0900 Subject: [PATCH 006/123] rename exception: std::out_of_range --- boost/network/uri/decode.hpp | 4 ++-- libs/network/test/uri/uri_encoding_test.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/boost/network/uri/decode.hpp b/boost/network/uri/decode.hpp index 0fd350014..0efc839e3 100644 --- a/boost/network/uri/decode.hpp +++ b/boost/network/uri/decode.hpp @@ -59,9 +59,9 @@ OutputIterator decode(const InputIterator &in_begin, OutputIterator out = out_begin; while (it != in_end) { if (*it == '%') { - if (++it == in_end) throw std::runtime_error("decoding fail because of '%'"); + if (++it == in_end) throw std::out_of_range("out_of_range exception"); value_type v0 = detail::letter_to_hex(*it); - if (++it == in_end) throw std::runtime_error("decoding fail because of '%'"); + if (++it == in_end) throw std::out_of_range("out_of_range exception"); value_type v1 = detail::letter_to_hex(*it); ++it; *out++ = 0x10 * v0 + v1; diff --git a/libs/network/test/uri/uri_encoding_test.cpp b/libs/network/test/uri/uri_encoding_test.cpp index 2190e33b6..2c2ddaaf6 100644 --- a/libs/network/test/uri/uri_encoding_test.cpp +++ b/libs/network/test/uri/uri_encoding_test.cpp @@ -52,5 +52,5 @@ BOOST_AUTO_TEST_CASE(decoding_throw_test) { const std::string encoded("%"); std::string instance; - BOOST_CHECK_THROW(uri::decoded(encoded), std::runtime_error); + BOOST_CHECK_THROW(uri::decoded(encoded), std::out_of_range); } From 8f5831fef7339ab202ee010bd186fb08a9a7810c Mon Sep 17 00:00:00 2001 From: cnagune Date: Fri, 14 Aug 2015 16:31:56 +0900 Subject: [PATCH 007/123] change std::out_of_range constractor string (what_arg) --- boost/network/uri/decode.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boost/network/uri/decode.hpp b/boost/network/uri/decode.hpp index 0efc839e3..7503d5665 100644 --- a/boost/network/uri/decode.hpp +++ b/boost/network/uri/decode.hpp @@ -59,9 +59,9 @@ OutputIterator decode(const InputIterator &in_begin, OutputIterator out = out_begin; while (it != in_end) { if (*it == '%') { - if (++it == in_end) throw std::out_of_range("out_of_range exception"); + if (++it == in_end) throw std::out_of_range("unexpected end of stream"); value_type v0 = detail::letter_to_hex(*it); - if (++it == in_end) throw std::out_of_range("out_of_range exception"); + if (++it == in_end) throw std::out_of_range("unexpected end of stream"); value_type v1 = detail::letter_to_hex(*it); ++it; *out++ = 0x10 * v0 + v1; From 71701d00dc3dc8ef367c117274e38ac4e56da1e0 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Mon, 14 Sep 2015 15:34:52 +1000 Subject: [PATCH 008/123] Change version info in CMakeLists.txt too; closes #475 --- package.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package.sh b/package.sh index 8338a2766..1d4d10df8 100755 --- a/package.sh +++ b/package.sh @@ -25,9 +25,12 @@ echo $BOOST_NETLIB_VERSION_INCREMENT sed -i '' 's/BOOST_NETLIB_VERSION_MAJOR [0-9]*/BOOST_NETLIB_VERSION_MAJOR '$BOOST_NETLIB_VERSION_MAJOR'/g' boost/network/version.hpp sed -i '' 's/BOOST_NETLIB_VERSION_MINOR [0-9]*/BOOST_NETLIB_VERSION_MINOR '$BOOST_NETLIB_VERSION_MINOR'/g' boost/network/version.hpp sed -i '' 's/BOOST_NETLIB_VERSION_INCREMENT [0-9]*/BOOST_NETLIB_VERSION_INCREMENT '$BOOST_NETLIB_VERSION_INCREMENT'/g' boost/network/version.hpp +sed -i '' 's/CPPNETLIB_VERSION_MAJOR [0-9]+/CPPNETLIB_VERSION_MAJOR '$BOOST_NETLIB_VERSION_MAJOR'/g' CMakeLists.txt +sed -i '' 's/CPPNETLIB_VERSION_MINOR [0-9]+/CPPNETLIB_VERSION_MINOR '$BOOST_NETLIB_VERSION_MINOR'/g' CMakeLists.txt +sed -i '' 's/CPPNETLIB_VERSION_PATCH [0-9]+/CPPNETLIB_VERSION_PATCH '$BOOST_NETLIB_VERSION_INCREMENT'/g' CMakeLists.txt # Show the diff -git diff boost/network/version.hpp +git diff boost/network/version.hpp CMakeLists.txt # Commit the change git add boost/network/version.hpp From df460a8602b07a6d5ae17a81929616b69ba1267f Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Mon, 14 Sep 2015 15:37:41 +1000 Subject: [PATCH 009/123] Also automatically add CMakeLists.txt --- package.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/package.sh b/package.sh index 1d4d10df8..6397ee9ed 100755 --- a/package.sh +++ b/package.sh @@ -34,6 +34,7 @@ git diff boost/network/version.hpp CMakeLists.txt # Commit the change git add boost/network/version.hpp +git add CMakeLists.txt git commit -m"Bumping release number to $VERSION" TAG="cpp-netlib-$VERSION" From 1ed82c51793016e5dd2381b461f4f1eb62a6ce7f Mon Sep 17 00:00:00 2001 From: Simon Haegler Date: Mon, 12 Oct 2015 20:02:28 +0200 Subject: [PATCH 010/123] hack-fixed windows debug assertion "incompatible string iterators" --- boost/network/uri/uri.hpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/boost/network/uri/uri.hpp b/boost/network/uri/uri.hpp index 726755147..a40771bfb 100644 --- a/boost/network/uri/uri.hpp +++ b/boost/network/uri/uri.hpp @@ -108,44 +108,60 @@ class BOOST_URI_DECL uri { return uri_parts_.fragment ? uri_parts_.fragment.get() : const_range_type(); } +// hackfix by Simon Haegler, Esri R&D Zurich +// this workaround is needed to avoid running into the "incompatible string iterator" assertion +// triggered by the default-constructed string iterators employed by cpp-netlib (see uri.ipp qi::rule declarations) +#if defined(_MSC_VER) && defined(_DEBUG) +# define CATCH_EMPTY_ITERATOR_RANGE if (range.begin()._Getcont() == 0 || range.end()._Getcont() == 0) { return string_type(); } +#else +# define CATCH_EMPTY_ITERATOR_RANGE +#endif + string_type scheme() const { const_range_type range = scheme_range(); - return range ? string_type(boost::begin(range), boost::end(range)) + CATCH_EMPTY_ITERATOR_RANGE + return range ? string_type(boost::begin(range), boost::end(range)) : string_type(); } string_type user_info() const { const_range_type range = user_info_range(); + CATCH_EMPTY_ITERATOR_RANGE return range ? string_type(boost::begin(range), boost::end(range)) : string_type(); } string_type host() const { const_range_type range = host_range(); + CATCH_EMPTY_ITERATOR_RANGE return range ? string_type(boost::begin(range), boost::end(range)) : string_type(); } string_type port() const { const_range_type range = port_range(); + CATCH_EMPTY_ITERATOR_RANGE return range ? string_type(boost::begin(range), boost::end(range)) : string_type(); } string_type path() const { const_range_type range = path_range(); + CATCH_EMPTY_ITERATOR_RANGE return range ? string_type(boost::begin(range), boost::end(range)) : string_type(); } string_type query() const { const_range_type range = query_range(); + CATCH_EMPTY_ITERATOR_RANGE return range ? string_type(boost::begin(range), boost::end(range)) : string_type(); } string_type fragment() const { const_range_type range = fragment_range(); + CATCH_EMPTY_ITERATOR_RANGE return range ? string_type(boost::begin(range), boost::end(range)) : string_type(); } From 7bb35daaaf2fd71b0e65657659b6a09a4db5a67b Mon Sep 17 00:00:00 2001 From: Simon Haegler Date: Mon, 12 Oct 2015 20:03:18 +0200 Subject: [PATCH 011/123] ignoring eclipse project files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f8f6375ac..9e4137734 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ Testing libs/mime/test/mime-roundtrip *.a _build +/.project From 913ada7dc566d45ece5f805ffd62c11d6643c120 Mon Sep 17 00:00:00 2001 From: Sergey Nizovtsev Date: Mon, 26 Oct 2015 18:03:22 +0300 Subject: [PATCH 012/123] Fixes http::async_connection::default_error that always set error flag --- boost/network/protocol/http/server/async_connection.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boost/network/protocol/http/server/async_connection.hpp b/boost/network/protocol/http/server/async_connection.hpp index 6a0a30d60..e8f566d22 100644 --- a/boost/network/protocol/http/server/async_connection.hpp +++ b/boost/network/protocol/http/server/async_connection.hpp @@ -334,7 +334,7 @@ struct async_connection } void default_error(boost::system::error_code const& ec) { - error_encountered = in_place(ec); + if (ec) error_encountered = in_place(ec); } typedef boost::array From a3705948dbde9e4e9656e2dec45d948ae5d7b22a Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Thu, 29 Oct 2015 00:57:39 +1100 Subject: [PATCH 013/123] Run clang-tidy with all checks. These changes haven't been tested; just a raw starting point for fixing things up later on. Generated with: clang-tidy -checks='*' -fix-errors ../libs/network/test/*.cpp -header-filter='boost/network/*' From within a build directory, like this: (while in cpp-netlib) mkdir build cmake -G Ninja -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DOPENSSL_ROOT_DIR=/Users/dberris/homebrew/Cellar/openssl/1.0.2d_1 -DBOOST_ROOT=/Users/dberris/Source/boost_1_56_0 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. --- boost/network/constants.hpp | 4 +- boost/network/detail/debug.hpp | 2 +- boost/network/detail/directive_base.hpp | 2 +- boost/network/detail/wrapper_base.hpp | 4 +- boost/network/message.hpp | 3 +- .../directives/detail/string_directive.hpp | 12 +++--- boost/network/message/directives/header.hpp | 14 +++---- .../message/directives/remove_header.hpp | 2 +- boost/network/message/message_concept.hpp | 6 +-- .../network/message/modifiers/add_header.hpp | 10 ++--- boost/network/message/modifiers/body.hpp | 4 +- .../message/modifiers/clear_headers.hpp | 10 ++--- .../network/message/modifiers/destination.hpp | 6 +-- .../message/modifiers/remove_header.hpp | 5 +-- boost/network/message/modifiers/source.hpp | 4 +- boost/network/message/traits/body.hpp | 18 +++++---- boost/network/message/traits/destination.hpp | 15 ++++--- boost/network/message/traits/headers.hpp | 20 +++++----- boost/network/message/traits/source.hpp | 15 ++++--- boost/network/message/transformers.hpp | 6 +-- .../message/transformers/selectors.hpp | 20 +++++----- .../network/message/transformers/to_lower.hpp | 18 ++++----- .../network/message/transformers/to_upper.hpp | 18 ++++----- boost/network/message/wrappers/body.hpp | 7 ++-- boost/network/message/wrappers/headers.hpp | 9 ++--- boost/network/message_fwd.hpp | 6 +-- .../protocol/http/algorithms/linearize.hpp | 22 ++++++----- boost/network/protocol/http/client.hpp | 14 +++---- .../protocol/http/client/async_impl.hpp | 10 ++--- .../http/client/connection/async_base.hpp | 8 ++-- .../http/client/connection/async_normal.hpp | 39 +++++++++++-------- .../connection/async_protocol_handler.hpp | 22 ++++++----- .../client/connection/connection_delegate.hpp | 14 ++++--- .../connection_delegate_factory.hpp | 22 ++++++----- .../client/connection/normal_delegate.hpp | 28 +++++++------ .../http/client/connection/ssl_delegate.hpp | 28 +++++++------ .../http/client/connection/sync_base.hpp | 24 ++++++------ .../http/client/connection/sync_normal.hpp | 17 ++++---- .../http/client/connection/sync_ssl.hpp | 16 ++++---- boost/network/protocol/http/client/facade.hpp | 18 ++++----- boost/network/protocol/http/client/macros.hpp | 4 +- .../network/protocol/http/client/options.hpp | 25 ++++++------ boost/network/protocol/http/client/pimpl.hpp | 10 ++--- .../protocol/http/client/sync_impl.hpp | 23 +++++------ boost/network/protocol/http/impl/message.ipp | 26 ++++++++----- boost/network/protocol/http/impl/request.hpp | 18 ++++----- boost/network/protocol/http/impl/response.ipp | 2 +- boost/network/protocol/http/message.hpp | 2 +- .../protocol/http/message/async_message.hpp | 7 ++-- .../http/message/directives/major_version.hpp | 11 ++++-- .../http/message/directives/method.hpp | 9 +++-- .../http/message/directives/minor_version.hpp | 11 ++++-- .../http/message/directives/status.hpp | 14 +++---- .../message/directives/status_message.hpp | 2 +- .../protocol/http/message/directives/uri.hpp | 2 +- .../http/message/directives/version.hpp | 2 +- .../network/protocol/http/message/header.hpp | 2 +- .../protocol/http/message/header/name.hpp | 9 +++-- .../protocol/http/message/header/value.hpp | 9 +++-- .../protocol/http/message/header_concept.hpp | 9 +++-- .../protocol/http/message/message_base.hpp | 2 +- .../protocol/http/message/modifiers/body.hpp | 21 +++++----- .../http/message/modifiers/clear_headers.hpp | 19 +++++---- .../http/message/modifiers/destination.hpp | 23 +++++------ .../http/message/modifiers/headers.hpp | 10 ++--- .../http/message/modifiers/major_version.hpp | 11 ++++-- .../http/message/modifiers/method.hpp | 9 +++-- .../http/message/modifiers/minor_version.hpp | 11 ++++-- .../http/message/modifiers/source.hpp | 25 ++++++------ .../http/message/modifiers/status.hpp | 4 +- .../http/message/modifiers/status_message.hpp | 4 +- .../http/message/modifiers/version.hpp | 6 +-- .../protocol/http/message/traits/status.hpp | 14 ++++--- .../http/message/traits/status_message.hpp | 14 ++++--- .../protocol/http/message/traits/version.hpp | 16 +++++--- .../protocol/http/message/wrappers/anchor.hpp | 6 +-- .../http/message/wrappers/headers.hpp | 10 ++--- .../protocol/http/message/wrappers/host.hpp | 4 +- .../http/message/wrappers/major_version.hpp | 13 ++++--- .../protocol/http/message/wrappers/method.hpp | 11 ++++-- .../http/message/wrappers/minor_version.hpp | 13 ++++--- .../protocol/http/message/wrappers/path.hpp | 4 +- .../protocol/http/message/wrappers/port.hpp | 4 +- .../http/message/wrappers/protocol.hpp | 4 +- .../protocol/http/message/wrappers/query.hpp | 2 +- .../protocol/http/message/wrappers/ready.hpp | 9 +++-- .../http/message/wrappers/status_message.hpp | 4 +- .../protocol/http/message/wrappers/uri.hpp | 4 +- .../protocol/http/parser/incremental.hpp | 22 ++++++----- .../http/policies/async_connection.hpp | 18 ++++----- .../protocol/http/policies/async_resolver.hpp | 6 +-- .../http/policies/pooled_connection.hpp | 14 +++---- .../http/policies/simple_connection.hpp | 28 ++++++------- .../protocol/http/policies/sync_resolver.hpp | 8 ++-- boost/network/protocol/http/request.hpp | 22 +++++------ .../network/protocol/http/request_concept.hpp | 2 +- boost/network/protocol/http/response.hpp | 2 +- .../protocol/http/response_concept.hpp | 2 +- .../http/support/client_or_server.hpp | 11 ++++-- .../protocol/http/support/is_client.hpp | 11 ++++-- .../protocol/http/support/is_keepalive.hpp | 9 +++-- .../protocol/http/support/is_server.hpp | 9 +++-- .../protocol/http/support/is_simple.hpp | 9 +++-- .../protocol/http/support/sync_only.hpp | 9 +++-- boost/network/protocol/http/tags.hpp | 20 ++++++---- .../http/traits/connection_keepalive.hpp | 11 ++++-- .../http/traits/connection_policy.hpp | 6 +-- .../protocol/http/traits/delegate_factory.hpp | 12 ++++-- .../protocol/http/traits/impl/chunk_cache.ipp | 2 +- .../http/traits/impl/headers_container.ipp | 8 ++-- .../http/traits/impl/response_code.ipp | 2 +- .../network/protocol/http/traits/resolver.hpp | 4 +- .../protocol/http/traits/resolver_policy.hpp | 6 +-- boost/network/protocol/http/traits/vector.hpp | 6 ++- boost/network/support/is_async.hpp | 6 +-- boost/network/support/is_default_wstring.hpp | 2 +- boost/network/support/is_pod.hpp | 8 +++- boost/network/support/is_tcp.hpp | 4 +- boost/network/support/is_udp.hpp | 6 +-- boost/network/support/pod_or_normal.hpp | 10 +++-- boost/network/support/sync_only.hpp | 10 +++-- boost/network/traits/headers_container.hpp | 9 ++--- boost/network/traits/istream.hpp | 6 ++- boost/network/traits/istringstream.hpp | 4 +- boost/network/traits/ostream_iterator.hpp | 2 +- boost/network/traits/ostringstream.hpp | 12 ++---- boost/network/traits/string.hpp | 4 +- boost/network/uri/accessors.hpp | 10 +---- boost/network/uri/builder.hpp | 4 +- boost/network/uri/decode.hpp | 2 +- boost/network/uri/detail/uri_parts.hpp | 2 +- boost/network/uri/directives/authority.hpp | 2 +- boost/network/uri/directives/fragment.hpp | 2 +- boost/network/uri/directives/host.hpp | 2 +- boost/network/uri/directives/path.hpp | 6 +-- boost/network/uri/directives/port.hpp | 4 +- boost/network/uri/directives/query.hpp | 4 +- boost/network/uri/directives/scheme.hpp | 4 +- boost/network/uri/directives/user_info.hpp | 2 +- boost/network/uri/encode.hpp | 2 +- boost/network/uri/uri.hpp | 8 ++-- boost/network/utils/thread_pool.hpp | 21 +++++----- boost/network/version.hpp | 2 +- 143 files changed, 773 insertions(+), 642 deletions(-) diff --git a/boost/network/constants.hpp b/boost/network/constants.hpp index 6aa7e45d8..a9ebfe657 100644 --- a/boost/network/constants.hpp +++ b/boost/network/constants.hpp @@ -6,9 +6,9 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include #include #include -#include namespace boost { namespace network { @@ -124,7 +124,7 @@ struct constants_wide { return https_; } }; -} +} // namespace impl template struct constants diff --git a/boost/network/detail/debug.hpp b/boost/network/detail/debug.hpp index 093ca551c..df77a7625 100644 --- a/boost/network/detail/debug.hpp +++ b/boost/network/detail/debug.hpp @@ -15,7 +15,7 @@ #include #ifndef BOOST_NETWORK_MESSAGE #define BOOST_NETWORK_MESSAGE(msg) \ - std::cerr << "[DEBUG " << __FILE__ << ':' << __LINE__ << "]: " << msg \ + std::cerr << "[DEBUG " << __FILE__ << ':' << __LINE__ << "]: " << (msg) \ << std::endl; #endif #else diff --git a/boost/network/detail/directive_base.hpp b/boost/network/detail/directive_base.hpp index e405642e3..7fdef9fb6 100644 --- a/boost/network/detail/directive_base.hpp +++ b/boost/network/detail/directive_base.hpp @@ -20,7 +20,7 @@ struct directive_base { // explicit directive_base(basic_message & message_) // : _message(message_) protected: - ~directive_base() {}; // can only be extended + ~directive_base() = default;default;; // can only be extended // mutable basic_message & _message; }; diff --git a/boost/network/detail/wrapper_base.hpp b/boost/network/detail/wrapper_base.hpp index 12793dfee..609b03456 100644 --- a/boost/network/detail/wrapper_base.hpp +++ b/boost/network/detail/wrapper_base.hpp @@ -17,7 +17,7 @@ struct wrapper_base { explicit wrapper_base(Message& message_) : _message(message_) {}; protected: - ~wrapper_base() {}; // for extending only + ~wrapper_base() = default;default;; // for extending only Message& _message; }; @@ -27,7 +27,7 @@ struct wrapper_base_const { explicit wrapper_base_const(Message const& message_) : _message(message_) {} protected: - ~wrapper_base_const() {}; // for extending only + ~wrapper_base_const() = default;default;; // for extending only Message const& _message; }; diff --git a/boost/network/message.hpp b/boost/network/message.hpp index f0519d879..6e639c6fd 100644 --- a/boost/network/message.hpp +++ b/boost/network/message.hpp @@ -8,8 +8,7 @@ #include #include -#include -#include +#include boost/network/traits/headers_container.hpp> #include #include #include diff --git a/boost/network/message/directives/detail/string_directive.hpp b/boost/network/message/directives/detail/string_directive.hpp index 33d288a72..15eedf5f6 100644 --- a/boost/network/message/directives/detail/string_directive.hpp +++ b/boost/network/message/directives/detail/string_directive.hpp @@ -8,12 +8,10 @@ #include #include -#include -#include -#include -#include -#include -#include +#include > +#include #include +#include +#include ble_if.hpp> /** * @@ -34,7 +32,7 @@ #define BOOST_NETWORK_STRING_DIRECTIVE(name, value, body, pod_body) \ template \ struct name##_directive { \ - ValueType const& value; \ + ValueType const& ((value)); \ explicit name##_directive(ValueType const& value_) : value(value_) {} \ name##_directive(name##_directive const& other) : value(other.value) {} \ template class Message> \ diff --git a/boost/network/message/directives/header.hpp b/boost/network/message/directives/header.hpp index da1f8e2a0..17e464782 100644 --- a/boost/network/message/directives/header.hpp +++ b/boost/network/message/directives/header.hpp @@ -7,17 +7,13 @@ #ifndef __NETWORK_MESSAGE_DIRECTIVES_HEADER_HPP__ #define __NETWORK_MESSAGE_DIRECTIVES_HEADER_HPP__ -#include -#include -#include -#include +#include pp> +#include nclude ude #include #include -#include -#include -#include - -namespace boost { +#include r.hpp> +#include > +#include pace boost { namespace network { namespace impl { diff --git a/boost/network/message/directives/remove_header.hpp b/boost/network/message/directives/remove_header.hpp index 0961436ad..c2f373822 100644 --- a/boost/network/message/directives/remove_header.hpp +++ b/boost/network/message/directives/remove_header.hpp @@ -34,7 +34,7 @@ struct remove_header_directive { } // namespace impl inline impl::remove_header_directive remove_header( - std::string header_name) { + std::string /*header_name*/ame*/) { return impl::remove_header_directive(header_name); } diff --git a/boost/network/message/message_concept.hpp b/boost/network/message/message_concept.hpp index 6abac8615..ddff3f0f2 100644 --- a/boost/network/message/message_concept.hpp +++ b/boost/network/message/message_concept.hpp @@ -14,11 +14,7 @@ #include #include #include -#include -#include -#include - -namespace boost { +#include de oost { namespace network { template diff --git a/boost/network/message/modifiers/add_header.hpp b/boost/network/message/modifiers/add_header.hpp index 51889a681..7049c22ee 100644 --- a/boost/network/message/modifiers/add_header.hpp +++ b/boost/network/message/modifiers/add_header.hpp @@ -7,11 +7,9 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include -#include -#include -#include -#include +#include nc.hpp> +#include ort/is_pod.hpp> +#include le_if.hpp> namespace boost { namespace network { @@ -38,7 +36,7 @@ inline typename enable_if, void>::type add_header( typename Message::header_type header = {key, value}; message.headers.insert(message.headers.end(), header); } -} +} // namespace impl // namespace impl template class Message, class KeyType, class ValueType> diff --git a/boost/network/message/modifiers/body.hpp b/boost/network/message/modifiers/body.hpp index 1fc1d3471..f294edcf8 100644 --- a/boost/network/message/modifiers/body.hpp +++ b/boost/network/message/modifiers/body.hpp @@ -13,13 +13,13 @@ namespace boost { namespace network { template class Message, class ValueType> -inline void body_impl(Message& message, ValueType const& body, tags::pod) { +inline void body_impl(Message& message, ValueType const& body, tags::pod /*unused*/ /*unused*/) { message.body = body; } template class Message, class ValueType> inline void body_impl(Message& message, ValueType const& body, - tags::normal) { + tags::normal /*unused*/ /*unused*/) { message.body(body); } diff --git a/boost/network/message/modifiers/clear_headers.hpp b/boost/network/message/modifiers/clear_headers.hpp index 74991dc61..f33435020 100644 --- a/boost/network/message/modifiers/clear_headers.hpp +++ b/boost/network/message/modifiers/clear_headers.hpp @@ -6,12 +6,10 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include -#include -#include -#include -#include -#include +#include _async.hpp> +#include .hpp> +#include e.hpp> +#include le_if.hpp> namespace boost { namespace network { diff --git a/boost/network/message/modifiers/destination.hpp b/boost/network/message/modifiers/destination.hpp index 2d461ee6f..111f05cbc 100644 --- a/boost/network/message/modifiers/destination.hpp +++ b/boost/network/message/modifiers/destination.hpp @@ -17,16 +17,16 @@ namespace impl { template inline void destination(Message const &message, ValueType const &destination_, - Tag const &, mpl::false_ const &) { + Tag const & /*unused*/ /*unused*/, mpl::false_ const & /*unused*/ /*unused*/) { message.destination(destination_); } template inline void destination(Message const &message, ValueType const &destination_, - Tag const &, mpl::true_ const &) { + Tag const & /*unused*/ /*unused*/, mpl::true_ const & /*unused*/ /*unused*/) { message.destination(destination_); } -} +} // namespace impl // namespace impl template class Message, class ValueType> inline void destination(Message const &message, diff --git a/boost/network/message/modifiers/remove_header.hpp b/boost/network/message/modifiers/remove_header.hpp index 57a94fef9..b2b812b53 100644 --- a/boost/network/message/modifiers/remove_header.hpp +++ b/boost/network/message/modifiers/remove_header.hpp @@ -9,9 +9,8 @@ #include #include -#include -#include -#include +#include _if.hpp> +#include e #include namespace boost { diff --git a/boost/network/message/modifiers/source.hpp b/boost/network/message/modifiers/source.hpp index dfaca0512..6e4e39402 100644 --- a/boost/network/message/modifiers/source.hpp +++ b/boost/network/message/modifiers/source.hpp @@ -16,13 +16,13 @@ namespace impl { template inline void source(Message const &message, ValueType const &source_, - Tag const &, mpl::false_ const &) { + Tag const & /*unused*/ /*unused*/, mpl::false_ const & /*unused*/ /*unused*/) { message.source(source_); } template inline void source(Message const &message, ValueType const &source_, - Tag const &, mpl::true_ const &) { + Tag const & /*unused*/ /*unused*/, mpl::true_ const & /*unused*/ /*unused*/) { message.source(source_); } diff --git a/boost/network/message/traits/body.hpp b/boost/network/message/traits/body.hpp index 17f682dbf..57d62fef6 100644 --- a/boost/network/message/traits/body.hpp +++ b/boost/network/message/traits/body.hpp @@ -7,12 +7,10 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include -#include -#include -#include -#include -#include +#include .hpp> +#include _sync.hpp> +#include re.hpp> +#include /is_same.hpp> namespace boost { namespace network { @@ -36,8 +34,12 @@ struct body } // namespace traits -} /* network */ +} // namespace network + // namespace network + /* network */ -} /* boost */ +} // namespace boost + // namespace boost + /* boost */ #endif // BOOST_NETWORK_MESSAGE_TRAITS_BODY_HPP_20100903 diff --git a/boost/network/message/traits/destination.hpp b/boost/network/message/traits/destination.hpp index 1016cdfb8..fc55d7a9c 100644 --- a/boost/network/message/traits/destination.hpp +++ b/boost/network/message/traits/destination.hpp @@ -7,11 +7,10 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include -#include -#include +#include > +#include hpp> #include -#include +#include /is_same.hpp> namespace boost { namespace network { @@ -35,8 +34,12 @@ struct destination } // namespace traits -} /* network */ +} // namespace network + // namespace network + /* network */ -} /* boost */ +} // namespace boost + // namespace boost + /* boost */ #endif // BOOST_NETWORK_MESSAGE_TRAITS_DESTINATION_HPP_20100903 diff --git a/boost/network/message/traits/headers.hpp b/boost/network/message/traits/headers.hpp index 8f6f5549d..2f44d6a6e 100644 --- a/boost/network/message/traits/headers.hpp +++ b/boost/network/message/traits/headers.hpp @@ -7,13 +7,11 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include -#include -#include -#include -#include -#include -#include +#include ude p> +#include .hpp> +#include appers.hpp> +#include port/is_async.hpp> +#include port/is_sync.hpp> namespace boost { namespace network { @@ -49,8 +47,12 @@ struct header_value } // namespace traits -} /* network */ +} // namespace network + // namespace network + /* network */ -} /* boost */ +} // namespace boost + // namespace boost + /* boost */ #endif // BOOST_NETWORK_MESSAGE_TRAITS_HEADERS_HPP_20100903 diff --git a/boost/network/message/traits/source.hpp b/boost/network/message/traits/source.hpp index f1b8c2fbe..95b806e55 100644 --- a/boost/network/message/traits/source.hpp +++ b/boost/network/message/traits/source.hpp @@ -6,11 +6,10 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include -#include -#include +#include > +#include hpp> #include -#include +#include /is_same.hpp> namespace boost { namespace network { @@ -34,8 +33,12 @@ struct source } // namespace traits -} /* network */ +} // namespace network + // namespace network + /* network */ -} /* boost */ +} // namespace boost + // namespace boost + /* boost */ #endif // BOOST_NETWORK_MESSAGE_TRAITS_SOURCE_HPP_20100903 diff --git a/boost/network/message/transformers.hpp b/boost/network/message/transformers.hpp index 0b990dfae..0fc23e179 100644 --- a/boost/network/message/transformers.hpp +++ b/boost/network/message/transformers.hpp @@ -30,11 +30,11 @@ struct get_real_algorithm { template struct transform_impl : public get_real_algorithm::type {}; -} // namspace impl +} // namespace impl template -inline impl::transform_impl transform(Algorithm, - Selector) { +inline impl::transform_impl transform(Algorithm /*unused*/ /*unused*/, + Selector /*unused*/ /*unused*/) { return impl::transform_impl(); } diff --git a/boost/network/message/transformers/selectors.hpp b/boost/network/message/transformers/selectors.hpp index 4b7a39632..eefb0f36c 100644 --- a/boost/network/message/transformers/selectors.hpp +++ b/boost/network/message/transformers/selectors.hpp @@ -14,23 +14,23 @@ struct source_selector; struct destination_selector; } // namespace selectors -selectors::source_selector source_(selectors::source_selector); -selectors::destination_selector destination_(selectors::destination_selector); +selectors::source_selector source_(selectors::source_selector /*unused*/ /*unused*/); +selectors::destination_selector destination_(selectors::destination_selector /*unused*/ /*unused*/); namespace selectors { struct source_selector { private: - source_selector() {}; - source_selector(source_selector const &) {}; - friend source_selector boost::network::source_(source_selector); + source_selector() = default;default;; + source_selector(source_selector const & /*unused*/ /*unused*/) {}; + friend source_selector boost::network::source_(source_selector /*unused*/ /*unused*/); }; struct destination_selector { private: - destination_selector() {}; - destination_selector(destination_selector const &) {}; + destination_selector() = default;default;; + destination_selector(destination_selector const & /*unused*/ /*unused*/) {}; friend destination_selector boost::network::destination_( - destination_selector); + destination_selector /*unused*/ /*unused*/); }; } // namespace selectors @@ -39,12 +39,12 @@ typedef selectors::source_selector (*source_selector_t)( typedef selectors::destination_selector (*destination_selector_t)( selectors::destination_selector); -inline selectors::source_selector source_(selectors::source_selector) { +inline selectors::source_selector source_(selectors::source_selector /*unused*/ /*unused*/) { return selectors::source_selector(); } inline selectors::destination_selector destination_( - selectors::destination_selector) { + selectors::destination_selector /*unused*/ /*unused*/) { return selectors::destination_selector(); } diff --git a/boost/network/message/transformers/to_lower.hpp b/boost/network/message/transformers/to_lower.hpp index 4979f1b15..a53886c27 100644 --- a/boost/network/message/transformers/to_lower.hpp +++ b/boost/network/message/transformers/to_lower.hpp @@ -34,7 +34,7 @@ struct to_lower_transformer { } protected: - ~to_lower_transformer() {} + ~to_lower_transformer() = default;default; }; template <> @@ -45,17 +45,17 @@ struct to_lower_transformer { } protected: - ~to_lower_transformer() {}; + ~to_lower_transformer() = default;default;; }; } // namespace impl namespace detail { struct to_lower_placeholder_helper; -} +} // namespace detail // namespace detail detail::to_lower_placeholder_helper to_lower_( - detail::to_lower_placeholder_helper); + detail::to_lower_placeholder_helper /*unused*/ /*unused*/); namespace detail { @@ -64,18 +64,18 @@ struct to_lower_placeholder_helper { struct type : public impl::to_lower_transformer {}; private: - to_lower_placeholder_helper() {} - to_lower_placeholder_helper(to_lower_placeholder_helper const &) {} + to_lower_placeholder_helper() = default;default; + to_lower_placeholder_helper(to_lower_placeholder_helper const & /*unused*/ /*unused*/) {} friend to_lower_placeholder_helper boost::network::to_lower_( - to_lower_placeholder_helper); + to_lower_placeholder_helper /*unused*/ /*unused*/); }; -} +} // namespace detail // namespace detail typedef detail::to_lower_placeholder_helper (*to_lower_placeholder)( detail::to_lower_placeholder_helper); inline detail::to_lower_placeholder_helper to_lower_( - detail::to_lower_placeholder_helper) { + detail::to_lower_placeholder_helper /*unused*/ /*unused*/) { return detail::to_lower_placeholder_helper(); } diff --git a/boost/network/message/transformers/to_upper.hpp b/boost/network/message/transformers/to_upper.hpp index 6e41ef7ff..111bba940 100644 --- a/boost/network/message/transformers/to_upper.hpp +++ b/boost/network/message/transformers/to_upper.hpp @@ -34,7 +34,7 @@ struct to_upper_transformer { } protected: - ~to_upper_transformer() {}; + ~to_upper_transformer() = default;default;; }; template <> @@ -45,17 +45,17 @@ struct to_upper_transformer { } protected: - ~to_upper_transformer() {}; + ~to_upper_transformer() = default;default;; }; } // namespace impl namespace detail { struct to_upper_placeholder_helper; -} +} // namespace detail // namespace detail detail::to_upper_placeholder_helper to_upper_( - detail::to_upper_placeholder_helper); + detail::to_upper_placeholder_helper /*unused*/ /*unused*/); namespace detail { @@ -64,18 +64,18 @@ struct to_upper_placeholder_helper { struct type : public impl::to_upper_transformer {}; private: - to_upper_placeholder_helper() {} - to_upper_placeholder_helper(to_upper_placeholder_helper const &) {} + to_upper_placeholder_helper() = default;default; + to_upper_placeholder_helper(to_upper_placeholder_helper const & /*unused*/ /*unused*/) {} friend to_upper_placeholder_helper boost::network::to_upper_( - to_upper_placeholder_helper); + to_upper_placeholder_helper /*unused*/ /*unused*/); }; -} +} // namespace detail // namespace detail typedef detail::to_upper_placeholder_helper (*to_upper_placeholder)( detail::to_upper_placeholder_helper); inline detail::to_upper_placeholder_helper to_upper_( - detail::to_upper_placeholder_helper) { + detail::to_upper_placeholder_helper /*unused*/ /*unused*/) { return detail::to_upper_placeholder_helper(); } diff --git a/boost/network/message/wrappers/body.hpp b/boost/network/message/wrappers/body.hpp index 4dd1d5eb0..dd128889f 100644 --- a/boost/network/message/wrappers/body.hpp +++ b/boost/network/message/wrappers/body.hpp @@ -7,9 +7,8 @@ #ifndef __NETWORK_MESSAGE_WRAPPERS_BODY_HPP__ #define __NETWORK_MESSAGE_WRAPPERS_BODY_HPP__ -#include -#include -#include +#include e.hpp> +#include ude namespace boost { namespace network { @@ -72,7 +71,7 @@ struct body_wrapper_const }; template -inline std::ostream& operator<<(std::ostream& os, +inline std::ostream& operator<<(std::ostream& /*os*/*os*/, body_wrapper const& body) { os << static_cast::string_type>(body); return os; diff --git a/boost/network/message/wrappers/headers.hpp b/boost/network/message/wrappers/headers.hpp index 5efeb94e0..d47f21253 100644 --- a/boost/network/message/wrappers/headers.hpp +++ b/boost/network/message/wrappers/headers.hpp @@ -7,9 +7,8 @@ #ifndef __NETWORK_MESSAGE_WRAPPERS_HEADERS_HPP__ #define __NETWORK_MESSAGE_WRAPPERS_HEADERS_HPP__ -#include -#include -#include +#include tainer.hpp> +#include boost/range/iterator_range.hpp> #include #include @@ -60,12 +59,12 @@ struct headers_wrapper explicit headers_wrapper(basic_message const& message_) : wrapper_base(message_) {}; - range_type operator[](string_type const& key) const { + range_type operator[](string_type /*unused*/ /*unused*/const& key) const { return headers_wrapper::_message.headers().equal_range(key); }; typename message_type::headers_container_type::size_type count( - string_type const& key) const { + string_type /*unused*/ /*unused*/const& key) const { return headers_wrapper::_message.headers().count(key); }; diff --git a/boost/network/message_fwd.hpp b/boost/network/message_fwd.hpp index 08eaf46cd..e2c0e4fd4 100644 --- a/boost/network/message_fwd.hpp +++ b/boost/network/message_fwd.hpp @@ -12,7 +12,5 @@ namespace network { template struct basic_message; -} // namespace boost -} // namespace network - -#endif // __2008817MESSAGE_FWD_INC__ +} // namespace networkk +} // namespace boostendif // __2008817MESSAGE_FWD_INC__ diff --git a/boost/network/protocol/http/algorithms/linearize.hpp b/boost/network/protocol/http/algorithms/linearize.hpp index d0347fd04..c37e221bf 100644 --- a/boost/network/protocol/http/algorithms/linearize.hpp +++ b/boost/network/protocol/http/algorithms/linearize.hpp @@ -9,16 +9,16 @@ #include #include -#include +#include +#include +#include #include #include #include #include -#include -#include +#include #include #include -#include #include namespace boost { @@ -69,8 +69,9 @@ BOOST_CONCEPT_REQUIRES(((ClientRequest)), (OutputIterator)) connection = consts::connection(), close = consts::close(); boost::copy(method, oi); *oi = consts::space_char(); - if (request.path().empty() || request.path()[0] != consts::slash_char()) - *oi = consts::slash_char(); + if (request.path().empty() || request.path()[0] != consts::slash_char()) { + *oi = consts::slash_char(); +} boost::copy(request.path(), oi); if (!request.query().empty()) { *oi = consts::question_mark_char(); @@ -183,10 +184,13 @@ BOOST_CONCEPT_REQUIRES(((ClientRequest)), (OutputIterator)) return boost::copy(body_data, oi); } -} /* http */ +} // namespace http + /* http */ -} /* net */ +} // namespace network + /* net */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_ALGORITHMS_LINEARIZE_HPP_20101028 */ diff --git a/boost/network/protocol/http/client.hpp b/boost/network/protocol/http/client.hpp index 1e315a8fb..941584ebc 100644 --- a/boost/network/protocol/http/client.hpp +++ b/boost/network/protocol/http/client.hpp @@ -6,22 +6,22 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include -#include +#include #include -#include #include +#include +#include #include -#include #include #include #include -#include +#include #include -#include -#include #include +#include +#include +#include #include #include diff --git a/boost/network/protocol/http/client/async_impl.hpp b/boost/network/protocol/http/client/async_impl.hpp index 1c0eb1fe7..a88f42c09 100644 --- a/boost/network/protocol/http/client/async_impl.hpp +++ b/boost/network/protocol/http/client/async_impl.hpp @@ -11,8 +11,8 @@ #include #include #include -#include #include +#include #include namespace boost { @@ -38,7 +38,7 @@ struct async_client async_client(bool cache_resolved, bool follow_redirect, bool always_verify_peer, int timeout, - boost::shared_ptr service, + boost::shared_ptr /*service*/, optional const& certificate_filename, optional const& verify_path, optional const& certificate_file, @@ -65,7 +65,7 @@ struct async_client boost::bind(&boost::asio::io_service::run, &service_))); } - ~async_client() throw() { sentinel_.reset(); } + ~async_client() throw() = default; void wait_complete() { sentinel_.reset(); @@ -77,8 +77,8 @@ struct async_client basic_response const request_skeleton( basic_request const& request_, string_type const& method, - bool get_body, body_callback_function_type callback, - body_generator_function_type generator) { + bool get_body, body_callback_function_type /*callback*/, + body_generator_function_type /*generator*/) { typename connection_base::connection_ptr connection_; connection_ = connection_base::get_connection( resolver_, request_, always_verify_peer_, certificate_filename_, diff --git a/boost/network/protocol/http/client/connection/async_base.hpp b/boost/network/protocol/http/client/connection/async_base.hpp index ada856a22..f769302d6 100644 --- a/boost/network/protocol/http/client/connection/async_base.hpp +++ b/boost/network/protocol/http/client/connection/async_base.hpp @@ -8,8 +8,8 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include #include +#include #include #include @@ -40,8 +40,8 @@ struct async_connection_base { static connection_ptr new_connection( resolve_function resolve, resolver_type &resolver, bool follow_redirect, bool always_verify_peer, bool https, int timeout, - optional certificate_filename = optional(), - optional const &verify_path = optional(), + optional /*certificate_filename*/ optional(), + optional /*unused*/const &verify_path = optional(), optional certificate_file = optional(), optional private_key_file = optional(), optional ciphers = optional(), @@ -66,7 +66,7 @@ struct async_connection_base { bool get_body, body_callback_function_type callback, body_generator_function_type generator) = 0; - virtual ~async_connection_base() {} + virtual ~async_connection_base() = default; }; } // namespace impl diff --git a/boost/network/protocol/http/client/connection/async_normal.hpp b/boost/network/protocol/http/client/connection/async_normal.hpp index f5590d7fc..8c194f0b5 100644 --- a/boost/network/protocol/http/client/connection/async_normal.hpp +++ b/boost/network/protocol/http/client/connection/async_normal.hpp @@ -9,23 +9,23 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include #include -#include -#include +#include #include #include +#include +#include #include #include #include #include #include #include -#include #include -#include +#include #include #include +#include #include #include @@ -201,7 +201,7 @@ struct http_async_connection void handle_sent_request(bool get_body, body_callback_function_type callback, body_generator_function_type generator, boost::system::error_code const& ec, - std::size_t bytes_transferred) { + std::size_t /*bytes_transferred*/) { // TODO(dberris): review parameter necessity. (void)bytes_transferred; @@ -242,7 +242,7 @@ struct http_async_connection void handle_received_data(state_t state, bool get_body, body_callback_function_type callback, boost::system::error_code const& ec, - std::size_t bytes_transferred) { + std::size_t /*bytes_transferred*/) { static const long short_read_error = 335544539; bool is_ssl_short_read_error = #ifdef BOOST_NETWORK_ENABLE_HTTPS @@ -265,7 +265,8 @@ struct http_async_connection this_type::shared_from_this(), version, get_body, callback, placeholders::error, placeholders::bytes_transferred)), bytes_transferred); - if (!parsed_ok || indeterminate(parsed_ok)) return; + if (!parsed_ok || indeterminate(parsed_ok) != nullptr) { return; +} case status: if (ec == boost::asio::error::eof) return; parsed_ok = this->parse_status( @@ -275,7 +276,8 @@ struct http_async_connection this_type::shared_from_this(), status, get_body, callback, placeholders::error, placeholders::bytes_transferred)), bytes_transferred); - if (!parsed_ok || indeterminate(parsed_ok)) return; + if (!parsed_ok || indeterminate(parsed_ok) != nullptr) { return; +} case status_message: if (ec == boost::asio::error::eof) return; parsed_ok = this->parse_status_message( @@ -285,7 +287,8 @@ struct http_async_connection get_body, callback, placeholders::error, placeholders::bytes_transferred)), bytes_transferred); - if (!parsed_ok || indeterminate(parsed_ok)) return; + if (!parsed_ok || indeterminate(parsed_ok) != nullptr) { return; +} case headers: if (ec == boost::asio::error::eof) return; // In the following, remainder is the number of bytes that @@ -302,7 +305,8 @@ struct http_async_connection placeholders::error, placeholders::bytes_transferred)), bytes_transferred); - if (!parsed_ok || indeterminate(parsed_ok)) return; + if (!parsed_ok || indeterminate(parsed_ok) != nullptr) { return; +} if (!get_body) { // We short-circuit here because the user does not @@ -382,12 +386,13 @@ struct http_async_connection string_type body_string; std::swap(body_string, this->partial_parsed); body_string.append(this->part.begin(), bytes_transferred); - if (this->is_chunk_encoding) + if (this->is_chunk_encoding) { this->body_promise.set_value(parse_chunk_encoding(body_string)); - else + } else { this->body_promise.set_value(body_string); +} } - // TODO set the destination value somewhere! + // TODO(dberris): set the destination value somewhere! this->destination_promise.set_value(""); this->source_promise.set_value(""); this->part.assign('\0'); @@ -473,12 +478,14 @@ struct http_async_connection iter = std::search(begin, body_string.end(), crlf.begin(), crlf.end())) { string_type line(begin, iter); - if (line.empty()) break; + if (line.empty()) { break; +} std::stringstream stream(line); int len; stream >> std::hex >> len; std::advance(iter, 2); - if (!len) break; + if (len == 0) { break; +} if (len <= body_string.end() - iter) { body.insert(body.end(), iter, iter + len); std::advance(iter, len + 2); diff --git a/boost/network/protocol/http/client/connection/async_protocol_handler.hpp b/boost/network/protocol/http/client/connection/async_protocol_handler.hpp index 7c8792ae2..7db22d560 100644 --- a/boost/network/protocol/http/client/connection/async_protocol_handler.hpp +++ b/boost/network/protocol/http/client/connection/async_protocol_handler.hpp @@ -24,9 +24,9 @@ struct http_async_protocol_handler { #ifdef BOOST_NETWORK_DEBUG struct debug_escaper { string_type& string; - explicit debug_escaper(string_type& string_) : string(string_) {} + explicit debug_escaper(string_type& /*string_*/) : string(string_) {} debug_escaper(debug_escaper const& other) : string(other.string) {} - void operator()(typename string_type::value_type input) { + void operator()(typename string_type:: /*value_type*/ input) { if (!algorithm::is_print()(input)) { typename ostringstream::type escaped_stream; if (input == '\r') { @@ -228,7 +228,7 @@ struct http_async_protocol_handler { return parsed_ok; } - void parse_headers_real(string_type& headers_part) { + void parse_headers_real(string_type& /*headers_part*/) { typename boost::iterator_range input_range = boost::make_iterator_range(headers_part), result_range; @@ -318,7 +318,7 @@ struct http_async_protocol_handler { template void parse_body(Delegate& delegate_, Callback callback, size_t bytes) { - // TODO: we should really not use a string for the partial body + // TODO(dberris): we should really not use a string for the partial body // buffer. partial_parsed.append(part_begin, bytes); part_begin = part.begin(); @@ -327,7 +327,7 @@ struct http_async_protocol_handler { } typedef response_parser response_parser_type; - // TODO: make 1024 go away and become a configurable value. + // TODO(dberris): make 1024 go away and become a configurable value. typedef boost::array::type, 1024> buffer_type; response_parser_type response_parser_; @@ -344,13 +344,17 @@ struct http_async_protocol_handler { bool is_chunk_encoding; }; -} /* impl */ +} // namespace impl + /* impl */ -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_IMPL_HTTP_ASYNC_PROTOCOL_HANDLER_HPP_20101015 \ */ diff --git a/boost/network/protocol/http/client/connection/connection_delegate.hpp b/boost/network/protocol/http/client/connection/connection_delegate.hpp index 79fa1ca4d..2dd573ed4 100644 --- a/boost/network/protocol/http/client/connection/connection_delegate.hpp +++ b/boost/network/protocol/http/client/connection/connection_delegate.hpp @@ -22,16 +22,20 @@ struct connection_delegate { asio::mutable_buffers_1 const &read_buffer, function handler) = 0; virtual void disconnect() = 0; - virtual ~connection_delegate() {} + virtual ~connection_delegate() = default; }; -} /* impl */ +} // namespace impl + /* impl */ -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_CONNECTION_DELEGATE_HPP_ \ */ diff --git a/boost/network/protocol/http/client/connection/connection_delegate_factory.hpp b/boost/network/protocol/http/client/connection/connection_delegate_factory.hpp index 425cc27ef..042d45f01 100644 --- a/boost/network/protocol/http/client/connection/connection_delegate_factory.hpp +++ b/boost/network/protocol/http/client/connection/connection_delegate_factory.hpp @@ -7,9 +7,9 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include #include #include +#include #ifdef BOOST_NETWORK_ENABLE_HTTPS #include #endif /* BOOST_NETWORK_ENABLE_HTTPS */ @@ -30,12 +30,12 @@ struct connection_delegate_factory { // This is the factory method that actually returns the delegate // instance. - // TODO Support passing in proxy settings when crafting connections. + // TODO(dberris): Support passing in proxy settings when crafting connections. static connection_delegate_ptr new_connection_delegate( asio::io_service& service, bool https, bool always_verify_peer, - optional certificate_filename, - optional verify_path, optional certificate_file, - optional private_key_file, optional ciphers, + optional /*certificate_filename*/, + optional /*verify_path*/, optional /*certificate_file*/, + optional /*private_key_file*/, optional /*ciphers*/, long ssl_options) { connection_delegate_ptr delegate; if (https) { @@ -53,10 +53,14 @@ struct connection_delegate_factory { } }; -} /* impl */ -} /* http */ -} /* network */ -} /* boost */ +} // namespace impl + /* impl */ +} // namespace http + /* http */ +} // namespace network + /* network */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_DELEGATE_FACTORY_HPP_20110819 \ */ diff --git a/boost/network/protocol/http/client/connection/normal_delegate.hpp b/boost/network/protocol/http/client/connection/normal_delegate.hpp index ae6ace333..f744c0fab 100644 --- a/boost/network/protocol/http/client/connection/normal_delegate.hpp +++ b/boost/network/protocol/http/client/connection/normal_delegate.hpp @@ -7,9 +7,9 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include #include #include -#include namespace boost { namespace network { @@ -17,18 +17,18 @@ namespace http { namespace impl { struct normal_delegate : connection_delegate { - normal_delegate(asio::io_service &service); + explicit normal_delegate(asio::io_service &service); virtual void connect(asio::ip::tcp::endpoint &endpoint, std::string host, boost::uint16_t source_port, function handler); - virtual void write( + void write( asio::streambuf &command_streambuf, - function handler); - virtual void read_some( + function handler) override; + void read_some( asio::mutable_buffers_1 const &read_buffer, - function handler); - virtual void disconnect(); - ~normal_delegate(); + function handler) override; + void disconnect() override; + ~normal_delegate() override; private: asio::io_service &service_; @@ -38,13 +38,17 @@ struct normal_delegate : connection_delegate { normal_delegate &operator=(normal_delegate); // = delete }; -} /* impl */ +} // namespace impl + /* impl */ -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #ifdef BOOST_NETWORK_NO_LIB #include diff --git a/boost/network/protocol/http/client/connection/ssl_delegate.hpp b/boost/network/protocol/http/client/connection/ssl_delegate.hpp index 712fc5173..942837797 100644 --- a/boost/network/protocol/http/client/connection/ssl_delegate.hpp +++ b/boost/network/protocol/http/client/connection/ssl_delegate.hpp @@ -9,11 +9,11 @@ #include #include -#include -#include #include +#include #include #include +#include namespace boost { namespace network { @@ -31,14 +31,14 @@ struct ssl_delegate : connection_delegate, virtual void connect(asio::ip::tcp::endpoint &endpoint, std::string host, boost::uint16_t source_port, function handler); - virtual void write( + void write( asio::streambuf &command_streambuf, - function handler); - virtual void read_some( + function handler) override; + void read_some( asio::mutable_buffers_1 const &read_buffer, - function handler); - virtual void disconnect(); - ~ssl_delegate(); + function handler) override; + void disconnect() override; + ~ssl_delegate() override; private: asio::io_service &service_; @@ -60,13 +60,17 @@ struct ssl_delegate : connection_delegate, function handler); }; -} /* impl */ +} // namespace impl + /* impl */ -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #ifdef BOOST_NETWORK_NO_LIB #include diff --git a/boost/network/protocol/http/client/connection/sync_base.hpp b/boost/network/protocol/http/client/connection/sync_base.hpp index 4b81220fc..afe10baf2 100644 --- a/boost/network/protocol/http/client/connection/sync_base.hpp +++ b/boost/network/protocol/http/client/connection/sync_base.hpp @@ -8,14 +8,14 @@ // http://www.boost.org/LICENSE_1_0.txt) #include -#include #include +#include #include #include #include #include -#include #include +#include #include #ifdef BOOST_NETWORK_ENABLE_HTTPS @@ -39,7 +39,7 @@ struct sync_connection_base_impl { template void init_socket(Socket& socket_, resolver_type& resolver_, - string_type const& hostname, string_type const& port, + string_type /*unused*/const& hostname, string_type const& port, resolver_function_type resolve_) { using boost::asio::ip::tcp; boost::system::error_code error = boost::asio::error::host_not_found; @@ -100,7 +100,7 @@ struct sync_connection_base_impl { } template - void send_request_impl(Socket& socket_, string_type const& method, + void send_request_impl(Socket& socket_, string_type /*unused*/const& method, boost::asio::streambuf& request_buffer) { // TODO(dberris): review parameter necessity. (void)method; @@ -198,7 +198,8 @@ struct sync_connection_base_impl { size_t length = lexical_cast(boost::begin(content_length_range)->second) - already_read; - if (length == 0) return; + if (length == 0) { return; +} size_t bytes_read = 0; while ((bytes_read = boost::asio::read(socket_, response_buffer, boost::asio::transfer_at_least(1), @@ -214,15 +215,16 @@ struct sync_connection_base_impl { void read_body(Socket& socket_, basic_response& response_, boost::asio::streambuf& response_buffer) { typename ostringstream::type body_stream; - // TODO tag dispatch based on whether it's HTTP 1.0 or HTTP 1.1 + // TODO(dberris): tag dispatch based on whether it's HTTP 1.0 or HTTP 1.1 if (version_major == 1 && version_minor == 0) { read_body_normal(socket_, response_, response_buffer, body_stream); } else if (version_major == 1 && version_minor == 1) { - if (response_.version() == "HTTP/1.0") + if (response_.version() == "HTTP/1.0") { read_body_normal(socket_, response_, response_buffer, body_stream); - else + } else { read_body_transfer_chunk_encoding(socket_, response_, response_buffer, body_stream); +} } else { throw std::runtime_error("Unsupported HTTP version number."); } @@ -248,7 +250,7 @@ struct sync_connection_base { new_connection( resolver_type& resolver, resolver_function_type resolve, bool https, bool always_verify_peer, int timeout, - optional const& certificate_filename = + optional /*unused*/const& certificate_filename = optional(), optional const& verify_path = optional(), optional const& certificate_file = @@ -288,10 +290,10 @@ struct sync_connection_base { boost::asio::streambuf& response_buffer) = 0; virtual bool is_open() = 0; virtual void close_socket() = 0; - virtual ~sync_connection_base() {} + virtual ~sync_connection_base() = default; protected: - sync_connection_base() {} + sync_connection_base() = default; }; } // namespace impl diff --git a/boost/network/protocol/http/client/connection/sync_normal.hpp b/boost/network/protocol/http/client/connection/sync_normal.hpp index e9d3f3262..a21da75ce 100644 --- a/boost/network/protocol/http/client/connection/sync_normal.hpp +++ b/boost/network/protocol/http/client/connection/sync_normal.hpp @@ -50,11 +50,11 @@ struct http_sync_connection resolve_(resolve), socket_(resolver.get_io_service()) {} - void init_socket(string_type const& hostname, string_type const& port) { + void init_socket(string_type /*unused*/const& hostname, string_type const& port) { connection_base::init_socket(socket_, resolver_, hostname, port, resolve_); } - void send_request_impl(string_type const& method, + void send_request_impl(string_type /*unused*/const& method, basic_request const& request_, body_generator_function_type generator) { boost::asio::streambuf request_buffer; @@ -107,16 +107,19 @@ struct http_sync_connection void close_socket() { timer_.cancel(); - if (!is_open()) return; + if (!is_open()) { return; +} boost::system::error_code ignored; socket_.shutdown(boost::asio::ip::tcp::socket::shutdown_both, ignored); - if (ignored) return; + if (ignored != nullptr) { return; +} socket_.close(ignored); } private: void handle_timeout(boost::system::error_code const& ec) { - if (!ec) close_socket(); + if (!ec) { close_socket(); +} } int timeout_; @@ -127,8 +130,8 @@ struct http_sync_connection }; } // namespace impl -} // nmaespace http +} // namespace http } // namespace network -} // nmaespace boost +} // namespace boost #endif // BOOST_NETWORK_PROTOCOL_HTTP_IMPL_HTTP_SYNC_CONNECTION_20100 diff --git a/boost/network/protocol/http/client/connection/sync_ssl.hpp b/boost/network/protocol/http/client/connection/sync_ssl.hpp index 7561289de..b57930a0e 100644 --- a/boost/network/protocol/http/client/connection/sync_ssl.hpp +++ b/boost/network/protocol/http/client/connection/sync_ssl.hpp @@ -13,9 +13,9 @@ #include #include #include +#include +#include #include -#include -#include #include #include @@ -52,7 +52,7 @@ struct https_sync_connection https_sync_connection( resolver_type& resolver, resolver_function_type resolve, bool always_verify_peer, int timeout, - optional const& certificate_filename = + optional /*unused*/const& certificate_filename = optional(), optional const& verify_path = optional(), optional const& certificate_file = optional(), @@ -95,13 +95,13 @@ struct https_sync_connection boost::asio::ssl::context::pem); } - void init_socket(string_type const& hostname, string_type const& port) { + void init_socket(string_type /*unused*/const& hostname, string_type const& port) { connection_base::init_socket(socket_.lowest_layer(), resolver_, hostname, port, resolve_); socket_.handshake(boost::asio::ssl::stream_base::client); } - void send_request_impl(string_type const& method, + void send_request_impl(string_type /*unused*/const& method, basic_request const& request_, body_generator_function_type generator) { boost::asio::streambuf request_buffer; @@ -157,7 +157,8 @@ struct https_sync_connection boost::system::error_code ignored; socket_.lowest_layer().shutdown(boost::asio::ip::tcp::socket::shutdown_both, ignored); - if (ignored) return; + if (ignored != nullptr) { return; +} socket_.lowest_layer().close(ignored); } @@ -165,7 +166,8 @@ struct https_sync_connection private: void handle_timeout(boost::system::error_code const& ec) { - if (!ec) close_socket(); + if (!ec) { close_socket(); +} } int timeout_; diff --git a/boost/network/protocol/http/client/facade.hpp b/boost/network/protocol/http/client/facade.hpp index 68c02ce18..0f1e46504 100644 --- a/boost/network/protocol/http/client/facade.hpp +++ b/boost/network/protocol/http/client/facade.hpp @@ -7,10 +7,10 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include #include #include -#include -#include +#include namespace boost { namespace network { @@ -46,13 +46,13 @@ struct basic_client_facade { } response get(request const& request, - body_callback_function_type body_handler = + body_callback_function_type /*body_handler*/ body_callback_function_type()) { return pimpl->request_skeleton(request, "GET", true, body_handler, body_generator_function_type()); } - response post(request request, string_type const& body = string_type(), + response post(request request, string_type /*unused*/const& body = string_type(), string_type const& content_type = string_type(), body_callback_function_type body_handler = body_callback_function_type(), @@ -83,13 +83,13 @@ struct basic_client_facade { response post(request const& request, body_generator_function_type body_generator, - body_callback_function_type callback = + body_callback_function_type /*callback*/ = body_generator_function_type()) { return pimpl->request_skeleton(request, "POST", true, callback, body_generator); } - response post(request const& request, body_callback_function_type callback, + response post(request const& request, body_callback_function_type /*callback*/, body_generator_function_type body_generator = body_generator_function_type()) { return post(request, string_type(), string_type(), callback, @@ -103,7 +103,7 @@ struct basic_client_facade { return post(request, body, string_type(), callback, body_generator); } - response put(request request, string_type const& body = string_type(), + response put(request request, string_type /*unused*/const& body = string_type(), string_type const& content_type = string_type(), body_callback_function_type body_handler = body_callback_function_type(), @@ -132,7 +132,7 @@ struct basic_client_facade { body_generator); } - response put(request const& request, body_callback_function_type callback, + response put(request const& request, body_callback_function_type /*callback*/, body_generator_function_type body_generator = body_generator_function_type()) { return put(request, string_type(), string_type(), callback, body_generator); @@ -146,7 +146,7 @@ struct basic_client_facade { } response delete_(request const& request, - body_callback_function_type body_handler = + body_callback_function_type /*body_handler*/ body_callback_function_type()) { return pimpl->request_skeleton(request, "DELETE", true, body_handler, body_generator_function_type()); diff --git a/boost/network/protocol/http/client/macros.hpp b/boost/network/protocol/http/client/macros.hpp index c64cc7a0f..3ca515e00 100644 --- a/boost/network/protocol/http/client/macros.hpp +++ b/boost/network/protocol/http/client/macros.hpp @@ -12,8 +12,8 @@ #ifndef BOOST_NETWORK_HTTP_BODY_CALLBACK #define BOOST_NETWORK_HTTP_BODY_CALLBACK(function_name, range_name, \ error_name) \ - void function_name(boost::iterator_range const& range_name, \ - boost::system::error_code const& error_name) + void function_name(boost::iterator_range const& (range_name), \ + boost::system::error_code const& (error_name)) #endif #endif /* BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_MACROS_HPP_20110430 */ diff --git a/boost/network/protocol/http/client/options.hpp b/boost/network/protocol/http/client/options.hpp index 8207dcaa7..b4676b5c7 100644 --- a/boost/network/protocol/http/client/options.hpp +++ b/boost/network/protocol/http/client/options.hpp @@ -1,10 +1,10 @@ #ifndef BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_OPTIONS_HPP_20130128 #define BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_OPTIONS_HPP_20130128 +#include #include -#include #include -#include +#include // Copyright 2013 Google, Inc. // Copyright 2013 Dean Michael Berris @@ -76,27 +76,27 @@ struct client_options { return *this; } - client_options& openssl_certificate(string_type const& v) { + client_options& openssl_certificate(string_type /*unused*/const& v) { openssl_certificate_ = v; return *this; } - client_options& openssl_verify_path(string_type const& v) { + client_options& openssl_verify_path(string_type /*unused*/const& v) { openssl_verify_path_ = v; return *this; } - client_options& openssl_certificate_file(string_type const& v) { + client_options& openssl_certificate_file(string_type /*unused*/const& v) { openssl_certificate_file_ = v; return *this; } - client_options& openssl_private_key_file(string_type const& v) { + client_options& openssl_private_key_file(string_type /*unused*/const& v) { openssl_private_key_file_ = v; return *this; } - client_options& openssl_ciphers(string_type const& v) { + client_options& openssl_ciphers(string_type /*unused*/const& v) { openssl_ciphers_ = v; return *this; } @@ -106,7 +106,7 @@ struct client_options { return *this; } - client_options& io_service(boost::shared_ptr v) { + client_options& io_service(boost::shared_ptr /*v*/) { io_service_ = v; return *this; } @@ -174,8 +174,11 @@ inline void swap(client_options& a, client_options& b) { a.swap(b); } -} /* http */ -} /* network */ -} /* boost */ +} // namespace http + /* http */ +} // namespace network + /* network */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_OPTIONS_HPP_20130128 */ diff --git a/boost/network/protocol/http/client/pimpl.hpp b/boost/network/protocol/http/client/pimpl.hpp index d66aa3874..7cca7d3d8 100644 --- a/boost/network/protocol/http/client/pimpl.hpp +++ b/boost/network/protocol/http/client/pimpl.hpp @@ -6,11 +6,11 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include -#include -#include #include #include +#include +#include +#include #include #include @@ -72,13 +72,13 @@ struct basic_client_impl optional const& certificate_file, optional const& private_key_file, optional const& ciphers, long ssl_options, - boost::shared_ptr service, + boost::shared_ptr /*service*/, int timeout) : base_type(cache_resolved, follow_redirect, always_verify_peer, timeout, service, certificate_filename, verify_path, certificate_file, private_key_file, ciphers, ssl_options) {} - ~basic_client_impl() {} + ~basic_client_impl() = default; }; } // namespace http diff --git a/boost/network/protocol/http/client/sync_impl.hpp b/boost/network/protocol/http/client/sync_impl.hpp index 5051fbd85..32163b48a 100644 --- a/boost/network/protocol/http/client/sync_impl.hpp +++ b/boost/network/protocol/http/client/sync_impl.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include +#include #include +#include #include +#include +#include +#include // Copyright 2013 Google, Inc. // Copyright 2010 Dean Michael Berris @@ -50,8 +50,8 @@ struct sync_client sync_client( bool cache_resolved, bool follow_redirect, bool always_verify_peer, - int timeout, boost::shared_ptr service, - optional const& certificate_filename = + int timeout, boost::shared_ptr /*service*/, + optional /*unused*/const& certificate_filename = optional(), optional const& verify_path = optional(), optional const& certificate_file = optional(), @@ -71,16 +71,13 @@ struct sync_client ssl_options_(ssl_options), always_verify_peer_(always_verify_peer) {} - ~sync_client() { - connection_base::cleanup(); - service_ptr.reset(); - } + ~sync_client() = default; void wait_complete() {} basic_response request_skeleton(basic_request const& request_, - string_type method, bool get_body, - body_callback_function_type callback, + string_type /*method*/, bool get_body, + body_callback_function_type /*callback*/, body_generator_function_type generator) { typename connection_base::connection_ptr connection_; connection_ = connection_base::get_connection( diff --git a/boost/network/protocol/http/impl/message.ipp b/boost/network/protocol/http/impl/message.ipp index 5171cdecc..2bb7feefe 100644 --- a/boost/network/protocol/http/impl/message.ipp +++ b/boost/network/protocol/http/impl/message.ipp @@ -10,10 +10,10 @@ #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_IPP #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_IPP -#include #include -#include +#include #include +#include namespace boost { namespace network { @@ -41,7 +41,7 @@ typename message_impl::string_type const message_impl::url_decode( decode_buf[0] = str[++pos]; decode_buf[1] = str[++pos]; decode_buf[2] = '\0'; - result += static_cast(strtol(decode_buf, 0, 16)); + result += static_cast(strtol(decode_buf, nullptr, 16)); } else { // recover from error by not decoding character result += '%'; @@ -120,8 +120,9 @@ message_impl::make_query_string( for (typename query_container::type::const_iterator i = query_params.begin(); i != query_params.end(); ++i) { - if (i != query_params.begin()) query_string += '&'; - query_string += url_encode(i->first); + if (i != query_params.begin()) { query_string += '&'; + +}query_string += url_encode(i->first); query_string += '='; query_string += url_encode(i->second); } @@ -196,14 +197,17 @@ bool message_impl::base64_decode( char base64code3; base64code0 = decoding_data[static_cast(input_ptr[i])]; - if (base64code0 == nop) // non base64 character + if (base64code0 == nop) { // non base64 character return false; - if (!(++i < input_length)) // we need at least two input bytes for +} + if (!(++i < input_length)) { // we need at least two input bytes for // first byte output return false; +} base64code1 = decoding_data[static_cast(input_ptr[i])]; - if (base64code1 == nop) // non base64 character + if (base64code1 == nop) { // non base64 character return false; +} output += ((base64code0 << 2) | ((base64code1 >> 4) & 0x3)); @@ -214,8 +218,9 @@ bool message_impl::base64_decode( return true; } base64code2 = decoding_data[static_cast(input_ptr[i])]; - if (base64code2 == nop) // non base64 character + if (base64code2 == nop) { // non base64 character return false; +} output += ((base64code1 << 4) & 0xf0) | ((base64code2 >> 2) & 0x0f); } @@ -227,8 +232,9 @@ bool message_impl::base64_decode( return true; } base64code3 = decoding_data[static_cast(input_ptr[i])]; - if (base64code3 == nop) // non base64 character + if (base64code3 == nop) { // non base64 character return false; +} output += (((base64code2 << 6) & 0xc0) | base64code3); } diff --git a/boost/network/protocol/http/impl/request.hpp b/boost/network/protocol/http/impl/request.hpp index 29608f8a7..f3979ccf1 100644 --- a/boost/network/protocol/http/impl/request.hpp +++ b/boost/network/protocol/http/impl/request.hpp @@ -15,13 +15,13 @@ #include #include -#include -#include #include +#include +#include #include -#include #include +#include #include @@ -63,11 +63,11 @@ struct basic_request : public basic_message { typedef typename string::type string_type; typedef boost::uint16_t port_type; - explicit basic_request(string_type const& uri_) : uri_(uri_), source_port_(0) {} + explicit basic_request(string_type /*unused*/const& uri_) : uri_(uri_), source_port_(0) {} explicit basic_request(boost::network::uri::uri const& uri_) : uri_(uri_), source_port_(0) {} - void uri(string_type const& new_uri) { uri_ = new_uri; } + void uri(string_type /*unused*/const& new_uri) { uri_ = new_uri; } void uri(boost::network::uri::uri const& new_uri) { uri_ = new_uri; } @@ -185,7 +185,7 @@ namespace impl { template <> struct request_headers_wrapper { basic_request const& request_; - request_headers_wrapper(basic_request const& request_) + explicit request_headers_wrapper(basic_request const& request_) : request_(request_) {} typedef headers_container::type headers_container_type; operator headers_container_type() { return request_.headers; } @@ -195,7 +195,7 @@ template <> struct body_wrapper > { typedef string::type string_type; basic_request const& request_; - body_wrapper(basic_request const& request_) + explicit body_wrapper(basic_request const& request_) : request_(request_) {} operator string_type() { return request_.body; } }; @@ -203,7 +203,7 @@ struct body_wrapper > { template <> struct request_headers_wrapper { basic_request const& request_; - request_headers_wrapper( + explicit request_headers_wrapper( basic_request const& request_) : request_(request_) {} typedef headers_container::type @@ -215,7 +215,7 @@ template <> struct body_wrapper > { typedef string::type string_type; basic_request const& request_; - body_wrapper(basic_request const& request_) + explicit body_wrapper(basic_request const& request_) : request_(request_) {} operator string_type() { return request_.body; } }; diff --git a/boost/network/protocol/http/impl/response.ipp b/boost/network/protocol/http/impl/response.ipp index f41be41d9..fe15fa6d3 100644 --- a/boost/network/protocol/http/impl/response.ipp +++ b/boost/network/protocol/http/impl/response.ipp @@ -19,8 +19,8 @@ #include #include #include -#include #include +#include #include namespace boost { diff --git a/boost/network/protocol/http/message.hpp b/boost/network/protocol/http/message.hpp index fa2d44ce2..da89eb98b 100644 --- a/boost/network/protocol/http/message.hpp +++ b/boost/network/protocol/http/message.hpp @@ -90,7 +90,7 @@ struct message_impl : public basic_message { status_(other.status_), status_message_(other.status_message_) {} - void version(string_type const &version) const { version_ = version; } + void version(string_type /*unused*/const &version) const { version_ = version; } string_type const version() const { return version_; } diff --git a/boost/network/protocol/http/message/async_message.hpp b/boost/network/protocol/http/message/async_message.hpp index 854c70756..f39354828 100644 --- a/boost/network/protocol/http/message/async_message.hpp +++ b/boost/network/protocol/http/message/async_message.hpp @@ -9,13 +9,13 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include #include #include +#include // FIXME move this out to a trait -#include #include +#include #include namespace boost { @@ -27,7 +27,8 @@ namespace impl { template struct ready_wrapper; -} /* impl */ +} // namespace impl + /* impl */ template struct async_message { diff --git a/boost/network/protocol/http/message/directives/major_version.hpp b/boost/network/protocol/http/message/directives/major_version.hpp index 7828b04fb..626d84796 100644 --- a/boost/network/protocol/http/message/directives/major_version.hpp +++ b/boost/network/protocol/http/message/directives/major_version.hpp @@ -6,9 +6,9 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include #include #include -#include namespace boost { namespace network { @@ -31,11 +31,14 @@ inline major_version_directive major_version(boost::uint8_t major_version_) { return major_version_directive(major_version_); } -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DIRECTIVES_MAJOR_VERSION_HPP_20101120 \ */ diff --git a/boost/network/protocol/http/message/directives/method.hpp b/boost/network/protocol/http/message/directives/method.hpp index b9e2c1dfb..04f05b268 100644 --- a/boost/network/protocol/http/message/directives/method.hpp +++ b/boost/network/protocol/http/message/directives/method.hpp @@ -13,11 +13,14 @@ namespace http { BOOST_NETWORK_STRING_DIRECTIVE(method, method_, message.method(method_), message.method = method_); -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* booet */ +} // namespace boost + /* booet */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DIRECTIVES_METHOD_HPP_20101120 \ */ diff --git a/boost/network/protocol/http/message/directives/minor_version.hpp b/boost/network/protocol/http/message/directives/minor_version.hpp index 4c44414c9..c1fb2f19c 100644 --- a/boost/network/protocol/http/message/directives/minor_version.hpp +++ b/boost/network/protocol/http/message/directives/minor_version.hpp @@ -6,9 +6,9 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include #include #include -#include namespace boost { namespace network { @@ -31,11 +31,14 @@ inline minor_version_directive minor_version(boost::uint8_t minor_version_) { return minor_version_directive(minor_version_); } -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_DIRECTIVES_MINOR_VERSION_HPP_20101120 \ */ diff --git a/boost/network/protocol/http/message/directives/status.hpp b/boost/network/protocol/http/message/directives/status.hpp index 61a41e451..4f5ab9368 100644 --- a/boost/network/protocol/http/message/directives/status.hpp +++ b/boost/network/protocol/http/message/directives/status.hpp @@ -7,14 +7,14 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include +#include +#include #include +#include #include -#include -#include -#include #include -#include +#include +#include namespace boost { namespace network { @@ -42,14 +42,14 @@ struct status_directive { template struct status_visitor : boost::static_visitor<> { basic_response const &response; - status_visitor(basic_response const &response) : response(response) {} + explicit status_visitor(basic_response const &response) : response(response) {} void operator()(typename value::type const &status_) const { response.status(status_); } template - void operator()(T const &) const { + void operator()(T const & /*unused*/) const { // FIXME fail here! } }; diff --git a/boost/network/protocol/http/message/directives/status_message.hpp b/boost/network/protocol/http/message/directives/status_message.hpp index 2e437ec16..d8babadff 100644 --- a/boost/network/protocol/http/message/directives/status_message.hpp +++ b/boost/network/protocol/http/message/directives/status_message.hpp @@ -7,8 +7,8 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include #include +#include namespace boost { namespace network { diff --git a/boost/network/protocol/http/message/directives/uri.hpp b/boost/network/protocol/http/message/directives/uri.hpp index 1a4114269..f4f49846e 100644 --- a/boost/network/protocol/http/message/directives/uri.hpp +++ b/boost/network/protocol/http/message/directives/uri.hpp @@ -7,8 +7,8 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include #include +#include namespace boost { namespace network { diff --git a/boost/network/protocol/http/message/directives/version.hpp b/boost/network/protocol/http/message/directives/version.hpp index 16c3115d5..ddd882b21 100644 --- a/boost/network/protocol/http/message/directives/version.hpp +++ b/boost/network/protocol/http/message/directives/version.hpp @@ -7,8 +7,8 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include #include +#include namespace boost { namespace network { diff --git a/boost/network/protocol/http/message/header.hpp b/boost/network/protocol/http/message/header.hpp index 5be2ad808..a26758350 100644 --- a/boost/network/protocol/http/message/header.hpp +++ b/boost/network/protocol/http/message/header.hpp @@ -13,8 +13,8 @@ #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_HEADER_HPP_20101122 #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_HEADER_HPP_20101122 -#include #include +#include #include #include #include diff --git a/boost/network/protocol/http/message/header/name.hpp b/boost/network/protocol/http/message/header/name.hpp index a5f6dee2f..c663fced3 100644 --- a/boost/network/protocol/http/message/header/name.hpp +++ b/boost/network/protocol/http/message/header/name.hpp @@ -32,10 +32,13 @@ inline std::wstring const &name(response_header_wide const &h) { return h.name; } -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_HEADER_NAME_HPP_20101028 */ diff --git a/boost/network/protocol/http/message/header/value.hpp b/boost/network/protocol/http/message/header/value.hpp index dd581d00d..6766c5d16 100644 --- a/boost/network/protocol/http/message/header/value.hpp +++ b/boost/network/protocol/http/message/header/value.hpp @@ -42,10 +42,13 @@ inline response_header_wide::string_type const& value( return h.value; } -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_HEADER_VALUE_HPP_20101028 */ diff --git a/boost/network/protocol/http/message/header_concept.hpp b/boost/network/protocol/http/message/header_concept.hpp index f3134e251..45642376f 100644 --- a/boost/network/protocol/http/message/header_concept.hpp +++ b/boost/network/protocol/http/message/header_concept.hpp @@ -29,10 +29,13 @@ struct Header : DefaultConstructible, Assignable, CopyConstructible { H header; }; -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_HEADER_CONCEPT_HPP_20101028 */ diff --git a/boost/network/protocol/http/message/message_base.hpp b/boost/network/protocol/http/message/message_base.hpp index 39376531b..4cb55fb7b 100644 --- a/boost/network/protocol/http/message/message_base.hpp +++ b/boost/network/protocol/http/message/message_base.hpp @@ -7,8 +7,8 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include #include +#include namespace boost { namespace network { diff --git a/boost/network/protocol/http/message/modifiers/body.hpp b/boost/network/protocol/http/message/modifiers/body.hpp index dd1c7430b..7c56903b8 100644 --- a/boost/network/protocol/http/message/modifiers/body.hpp +++ b/boost/network/protocol/http/message/modifiers/body.hpp @@ -6,12 +6,12 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include +#include +#include #include #include -#include #include -#include -#include namespace boost { namespace network { @@ -26,15 +26,15 @@ struct basic_request; namespace impl { template -void body(basic_response &response, T const &value, mpl::false_ const &) { +void body(basic_response &response, T const &value, mpl::false_ const & /*unused*/) { response << ::boost::network::body(value); } template -void body(basic_response &response, T const &future, mpl::true_ const &) { +void body(basic_response &response, T const &future, mpl::true_ const & /*unused*/) { response.body(future); } -} +} // namespace impl template inline void body(basic_response &response, T const &value) { @@ -43,13 +43,13 @@ inline void body(basic_response &response, T const &value) { template inline void body_impl(basic_request &request, T const &value, - tags::server) { + tags::server /*unused*/) { request.body = value; } template inline void body_impl(basic_request &request, T const &value, - tags::client) { + tags::client /*unused*/) { request << ::boost::network::body(value); } @@ -64,11 +64,12 @@ namespace impl { template inline void body(Message const &message, ValueType const &body_, - http::tags::http_server, Async) { + http::tags::http_server /*unused*/, Async /*unused*/) { message.body = body_; } -} /* impl */ +} // namespace impl + /* impl */ } // namespace network diff --git a/boost/network/protocol/http/message/modifiers/clear_headers.hpp b/boost/network/protocol/http/message/modifiers/clear_headers.hpp index b723bb046..bd6720ec1 100644 --- a/boost/network/protocol/http/message/modifiers/clear_headers.hpp +++ b/boost/network/protocol/http/message/modifiers/clear_headers.hpp @@ -7,8 +7,8 @@ // http://www.boost.org/LICENSE_1_0.txt) #include -#include #include +#include #include namespace boost { @@ -16,23 +16,23 @@ namespace network { namespace http { template -inline void clear_headers_impl(basic_request& request, tags::pod) { +inline void clear_headers_impl(basic_request& request, tags::pod /*unused*/) { typedef typename basic_request::headers_container_type headers_container; headers_container().swap(request.headers); } template -inline void clear_headers_impl(basic_request& request, tags::normal) { +inline void clear_headers_impl(basic_request& request, tags::normal /*unused*/) { request.headers(typename basic_request::headers_container_type()); } template -inline void clear_headers_impl(basic_request& request, tags::client) { +inline void clear_headers_impl(basic_request& request, tags::client /*unused*/) { clear_headers_impl(request, typename pod_or_normal::type()); } template -inline void clear_headers_impl(basic_request& request, tags::server) { +inline void clear_headers_impl(basic_request& request, tags::server /*unused*/) { typedef typename basic_request::headers_container_type headers_container; headers_container().swap(request.headers); } @@ -42,11 +42,14 @@ inline void clear_headers(basic_request& request) { clear_headers_impl(request, typename client_or_server::type()); } -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_CLEAR_HEADER_HPP_20101128 \ */ diff --git a/boost/network/protocol/http/message/modifiers/destination.hpp b/boost/network/protocol/http/message/modifiers/destination.hpp index 902d7bd1f..50fd9128f 100644 --- a/boost/network/protocol/http/message/modifiers/destination.hpp +++ b/boost/network/protocol/http/message/modifiers/destination.hpp @@ -6,11 +6,11 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include #include -#include #include +#include #include -#include namespace boost { namespace network { @@ -26,16 +26,16 @@ namespace impl { template void destination(basic_response &response, T const &value, - mpl::false_ const &) { + mpl::false_ const & /*unused*/) { response << ::boost::network::destination(value); } template void destination(basic_response &response, T const &future, - mpl::true_ const &) { + mpl::true_ const & /*unused*/) { response.destination(future); } -} +} // namespace impl template inline void destination(basic_response &response, T const &value) { @@ -47,25 +47,25 @@ struct ServerRequest; template inline void destination_impl(basic_request &request, T const &value, - tags::server) { + tags::server /*unused*/) { request.destination = value; } template inline void destination_impl(basic_request &request, T const &value, - tags::pod) { + tags::pod /*unused*/) { request.destination = value; } template inline void destination_impl(basic_request &request, T const &value, - tags::normal) { + tags::normal /*unused*/) { request.destination(value); } template inline void destination_impl(basic_request &request, T const &value, - tags::client) { + tags::client /*unused*/) { destination_impl(request, value, typename pod_or_normal::type()); } @@ -80,11 +80,12 @@ namespace impl { template inline void destination(Message const &message, ValueType const &destination_, - http::tags::http_server, Async) { + http::tags::http_server /*unused*/, Async /*unused*/) { message.destination = destination_; } -} /* impl */ +} // namespace impl + /* impl */ } // namespace network diff --git a/boost/network/protocol/http/message/modifiers/headers.hpp b/boost/network/protocol/http/message/modifiers/headers.hpp index 903549415..826a22ea3 100644 --- a/boost/network/protocol/http/message/modifiers/headers.hpp +++ b/boost/network/protocol/http/message/modifiers/headers.hpp @@ -6,9 +6,9 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include #include #include -#include namespace boost { namespace network { @@ -24,22 +24,22 @@ namespace impl { template void headers(basic_response &response, T const &value, - mpl::false_ const &) { + mpl::false_ const & /*unused*/) { response << headers(value); } template void headers(basic_response &response, T const &future, - mpl::true_ const &) { + mpl::true_ const & /*unused*/) { response.headers(future); } template void headers(basic_request &request, T const &value, - tags::server const &) { + tags::server const & /*unused*/) { request.headers = value; } -} +} // namespace impl template inline void headers(basic_response &response, T const &value) { diff --git a/boost/network/protocol/http/message/modifiers/major_version.hpp b/boost/network/protocol/http/message/modifiers/major_version.hpp index fbe60eb62..ed6df4e72 100644 --- a/boost/network/protocol/http/message/modifiers/major_version.hpp +++ b/boost/network/protocol/http/message/modifiers/major_version.hpp @@ -6,9 +6,9 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include #include #include -#include namespace boost { namespace network { @@ -23,11 +23,14 @@ inline typename enable_if, void>::type major_version( request.http_version_major = major_version_; } -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_MAJOR_VERSION_HPP_20101120 \ */ diff --git a/boost/network/protocol/http/message/modifiers/method.hpp b/boost/network/protocol/http/message/modifiers/method.hpp index 8aeab4ce0..c48e43ba4 100644 --- a/boost/network/protocol/http/message/modifiers/method.hpp +++ b/boost/network/protocol/http/message/modifiers/method.hpp @@ -22,10 +22,13 @@ inline typename enable_if, void>::type method( request.method = method_; } -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_METHOD_HPP_20101118 */ diff --git a/boost/network/protocol/http/message/modifiers/minor_version.hpp b/boost/network/protocol/http/message/modifiers/minor_version.hpp index 0850ba921..752666d38 100644 --- a/boost/network/protocol/http/message/modifiers/minor_version.hpp +++ b/boost/network/protocol/http/message/modifiers/minor_version.hpp @@ -6,9 +6,9 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include #include #include -#include namespace boost { namespace network { @@ -23,11 +23,14 @@ inline typename enable_if, void>::type minor_version( request.http_version_minor = minor_version_; } -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_MINOR_VERSION_HPP_20101120 \ */ diff --git a/boost/network/protocol/http/message/modifiers/source.hpp b/boost/network/protocol/http/message/modifiers/source.hpp index 396b69fa4..989c733a2 100644 --- a/boost/network/protocol/http/message/modifiers/source.hpp +++ b/boost/network/protocol/http/message/modifiers/source.hpp @@ -6,12 +6,12 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include #include -#include +#include #include -#include +#include #include +#include namespace boost { namespace network { @@ -24,26 +24,26 @@ namespace impl { template void source(basic_response &response, T const &value, - mpl::false_ const &) { + mpl::false_ const & /*unused*/) { response << ::boost::network::source(value); } template void source(basic_response &response, T const &future, - mpl::true_ const &) { + mpl::true_ const & /*unused*/) { response.source(future); } template -void source(basic_request &request, T const &value, tags::server const &) { +void source(basic_request &request, T const &value, tags::server const & /*unused*/) { request.source = value; } template -void source(basic_request &request, T const &value, tags::client const &) { +void source(basic_request &request, T const &value, tags::client const & /*unused*/) { request << ::boost::network::source(value); } -} +} // namespace impl template inline void source(basic_response &response, T const &value) { @@ -52,13 +52,13 @@ inline void source(basic_response &response, T const &value) { template inline void source_impl(basic_request &request, T const &value, - tags::server) { + tags::server /*unused*/) { impl::source(request, value, Tag()); } template inline void source_impl(basic_request &request, T const &value, - tags::client) { + tags::client /*unused*/) { impl::source(request, value, Tag()); } @@ -73,11 +73,12 @@ namespace impl { template inline void source(Message const &message, ValueType const &source_, - http::tags::http_server const &, Async const &) { + http::tags::http_server const & /*unused*/, Async const & /*unused*/) { message.source = source_; } -} /* impl */ +} // namespace impl + /* impl */ } // namespace network diff --git a/boost/network/protocol/http/message/modifiers/status.hpp b/boost/network/protocol/http/message/modifiers/status.hpp index 27a774bef..811f3eacf 100644 --- a/boost/network/protocol/http/message/modifiers/status.hpp +++ b/boost/network/protocol/http/message/modifiers/status.hpp @@ -21,13 +21,13 @@ namespace impl { template void status(basic_response &response, T const &value, - mpl::false_ const &) { + mpl::false_ const & /*unused*/) { response << boost::network::http::status(value); } template void status(basic_response &response, T const &future, - mpl::true_ const &) { + mpl::true_ const & /*unused*/) { response.status(future); } diff --git a/boost/network/protocol/http/message/modifiers/status_message.hpp b/boost/network/protocol/http/message/modifiers/status_message.hpp index 750163053..3e574e128 100644 --- a/boost/network/protocol/http/message/modifiers/status_message.hpp +++ b/boost/network/protocol/http/message/modifiers/status_message.hpp @@ -21,13 +21,13 @@ namespace impl { template void status_message(basic_response &response, T const &value, - mpl::false_ const &) { + mpl::false_ const & /*unused*/) { response << boost::network::http::status_message(value); } template void status_message(basic_response &response, T const &future, - mpl::true_ const &) { + mpl::true_ const & /*unused*/) { response.status_message(future); } diff --git a/boost/network/protocol/http/message/modifiers/version.hpp b/boost/network/protocol/http/message/modifiers/version.hpp index f237870b2..9ed222aa2 100644 --- a/boost/network/protocol/http/message/modifiers/version.hpp +++ b/boost/network/protocol/http/message/modifiers/version.hpp @@ -7,10 +7,10 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include #include #include #include -#include namespace boost { namespace network { @@ -23,13 +23,13 @@ namespace impl { template void version(basic_response &response, T const &value, - mpl::false_ const &) { + mpl::false_ const & /*unused*/) { response << boost::network::http::version(value); } template void version(basic_response &response, T const &future, - mpl::true_ const &) { + mpl::true_ const & /*unused*/) { response.version(future); } diff --git a/boost/network/protocol/http/message/traits/status.hpp b/boost/network/protocol/http/message/traits/status.hpp index 93b66885f..4c04be143 100644 --- a/boost/network/protocol/http/message/traits/status.hpp +++ b/boost/network/protocol/http/message/traits/status.hpp @@ -6,8 +6,8 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include #include +#include #include namespace boost { @@ -27,10 +27,14 @@ struct status typename mpl::if_, boost::uint16_t, unsupported_tag >::type> {}; -} /* traits */ +} // namespace traits + /* traits */ -} /* http */ -} /* network */ -} /* boost */ +} // namespace http + /* http */ +} // namespace network + /* network */ +} // namespace boost + /* boost */ #endif diff --git a/boost/network/protocol/http/message/traits/status_message.hpp b/boost/network/protocol/http/message/traits/status_message.hpp index 92487ae78..280348f9e 100644 --- a/boost/network/protocol/http/message/traits/status_message.hpp +++ b/boost/network/protocol/http/message/traits/status_message.hpp @@ -7,8 +7,8 @@ // http://www.boost.org/LICENSE_1_0.txt) #include -#include #include +#include namespace boost { namespace network { @@ -31,10 +31,14 @@ struct status_message typename string::type, unsupported_tag >::type> {}; -} /* traits */ +} // namespace traits + /* traits */ -} /* http */ -} /* network */ -} /* boost */ +} // namespace http + /* http */ +} // namespace network + /* network */ +} // namespace boost + /* boost */ #endif diff --git a/boost/network/protocol/http/message/traits/version.hpp b/boost/network/protocol/http/message/traits/version.hpp index d4b998116..3fbcc7348 100644 --- a/boost/network/protocol/http/message/traits/version.hpp +++ b/boost/network/protocol/http/message/traits/version.hpp @@ -6,12 +6,12 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include #include #include -#include #include +#include #include -#include namespace boost { namespace network { @@ -43,10 +43,14 @@ struct version< typedef typename string::type type; }; -} /* traits */ +} // namespace traits + /* traits */ -} /* http */ -} /* network */ -} /* boost */ +} // namespace http + /* http */ +} // namespace network + /* network */ +} // namespace boost + /* boost */ #endif diff --git a/boost/network/protocol/http/message/wrappers/anchor.hpp b/boost/network/protocol/http/message/wrappers/anchor.hpp index 27c4dd51f..f65bda8c2 100644 --- a/boost/network/protocol/http/message/wrappers/anchor.hpp +++ b/boost/network/protocol/http/message/wrappers/anchor.hpp @@ -18,11 +18,11 @@ namespace impl { template struct anchor_wrapper { basic_request const& message_; - anchor_wrapper(basic_request const& message) : message_(message) {} + explicit anchor_wrapper(basic_request const& message) : message_(message) {} typedef typename basic_request::string_type string_type; operator string_type() { return message_.anchor(); } }; -} +} // namespace impl template inline impl::anchor_wrapper anchor(basic_request const& request) { @@ -33,6 +33,6 @@ inline impl::anchor_wrapper anchor(basic_request const& request) { } // namespace network -} // nmaespace boost +} // namespace boost #endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_ANCHOR_HPP_20100618 diff --git a/boost/network/protocol/http/message/wrappers/headers.hpp b/boost/network/protocol/http/message/wrappers/headers.hpp index a1bcd7103..818989bdb 100644 --- a/boost/network/protocol/http/message/wrappers/headers.hpp +++ b/boost/network/protocol/http/message/wrappers/headers.hpp @@ -41,11 +41,11 @@ struct request_headers_wrapper { explicit request_headers_wrapper(basic_request const& message) : message_(message) {} - range_type operator[](string_type const& key) const { + range_type operator[](string_type /*unused*/const& key) const { return message_.headers().equal_range(key); } - typename headers_container_type::size_type count(string_type const& key) + typename headers_container_type::size_type count(string_type /*unused*/const& key) const { return message_.headers().count(key); } @@ -76,11 +76,11 @@ struct response_headers_wrapper { explicit response_headers_wrapper(basic_response const& message) : message_(message) {} - range_type operator[](string_type const& key) const { + range_type operator[](string_type /*unused*/const& key) const { return message_.headers().equal_range(key); } - typename headers_container_type::size_type count(string_type const& key) + typename headers_container_type::size_type count(string_type /*unused*/const& key) const { return message_.headers().count(key); } @@ -114,7 +114,7 @@ inline impl::response_headers_wrapper headers( return impl::response_headers_wrapper(response_); } -} // namepace http +} // namespace http } // namespace network diff --git a/boost/network/protocol/http/message/wrappers/host.hpp b/boost/network/protocol/http/message/wrappers/host.hpp index 9841674da..20ad90742 100644 --- a/boost/network/protocol/http/message/wrappers/host.hpp +++ b/boost/network/protocol/http/message/wrappers/host.hpp @@ -20,13 +20,13 @@ template struct host_wrapper { basic_request const& message_; - host_wrapper(basic_request const& message) : message_(message) {} + explicit host_wrapper(basic_request const& message) : message_(message) {} typedef typename basic_request::string_type string_type; operator string_type() { return message_.host(); } }; -} +} // namespace impl template inline impl::host_wrapper host(basic_request const& request) { diff --git a/boost/network/protocol/http/message/wrappers/major_version.hpp b/boost/network/protocol/http/message/wrappers/major_version.hpp index 40ad3d527..7e2484848 100644 --- a/boost/network/protocol/http/message/wrappers/major_version.hpp +++ b/boost/network/protocol/http/message/wrappers/major_version.hpp @@ -6,9 +6,9 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include -#include #include +#include +#include namespace boost { namespace network { @@ -31,11 +31,14 @@ major_version(basic_request const& request) { return major_version_wrapper(request); } -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_MAJOR_VERSION_HPP_20101120 \ */ diff --git a/boost/network/protocol/http/message/wrappers/method.hpp b/boost/network/protocol/http/message/wrappers/method.hpp index 6f194d3f8..2a07189ee 100644 --- a/boost/network/protocol/http/message/wrappers/method.hpp +++ b/boost/network/protocol/http/message/wrappers/method.hpp @@ -6,8 +6,8 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include #include +#include namespace boost { namespace network { @@ -34,10 +34,13 @@ method(basic_request const& message) { return method_wrapper(message); } -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_METHOD_HPP_20101118 */ diff --git a/boost/network/protocol/http/message/wrappers/minor_version.hpp b/boost/network/protocol/http/message/wrappers/minor_version.hpp index aad54e387..1f179dedf 100644 --- a/boost/network/protocol/http/message/wrappers/minor_version.hpp +++ b/boost/network/protocol/http/message/wrappers/minor_version.hpp @@ -6,9 +6,9 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include -#include #include +#include +#include namespace boost { namespace network { @@ -31,11 +31,14 @@ minor_version(basic_request const& request) { return minor_version_wrapper(request); } -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_MINOR_VERSION_HPP_20101120 \ */ diff --git a/boost/network/protocol/http/message/wrappers/path.hpp b/boost/network/protocol/http/message/wrappers/path.hpp index 56f67e5c3..75166b1ac 100644 --- a/boost/network/protocol/http/message/wrappers/path.hpp +++ b/boost/network/protocol/http/message/wrappers/path.hpp @@ -20,13 +20,13 @@ template struct path_wrapper { basic_request const& message_; - path_wrapper(basic_request const& message) : message_(message) {} + explicit path_wrapper(basic_request const& message) : message_(message) {} typedef typename basic_request::string_type string_type; operator string_type() { return message_.path(); } }; -} +} // namespace impl template inline impl::path_wrapper path(basic_request const& request) { diff --git a/boost/network/protocol/http/message/wrappers/port.hpp b/boost/network/protocol/http/message/wrappers/port.hpp index f05d9dc81..506cb753c 100644 --- a/boost/network/protocol/http/message/wrappers/port.hpp +++ b/boost/network/protocol/http/message/wrappers/port.hpp @@ -9,9 +9,9 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include #include #include +#include #include namespace boost { @@ -27,7 +27,7 @@ template struct port_wrapper { basic_request const& message_; - port_wrapper(basic_request const& message) : message_(message) {} + explicit port_wrapper(basic_request const& message) : message_(message) {} typedef typename basic_request::port_type port_type; diff --git a/boost/network/protocol/http/message/wrappers/protocol.hpp b/boost/network/protocol/http/message/wrappers/protocol.hpp index 0b18fda82..3f8e4999d 100644 --- a/boost/network/protocol/http/message/wrappers/protocol.hpp +++ b/boost/network/protocol/http/message/wrappers/protocol.hpp @@ -18,11 +18,11 @@ namespace impl { template struct protocol_wrapper { basic_request const& message_; - protocol_wrapper(basic_request const& message) : message_(message) {} + explicit protocol_wrapper(basic_request const& message) : message_(message) {} typedef typename basic_request::string_type string_type; operator string_type() { return message_.protocol(); } }; -} +} // namespace impl template inline impl::protocol_wrapper protocol(basic_request const& request) { diff --git a/boost/network/protocol/http/message/wrappers/query.hpp b/boost/network/protocol/http/message/wrappers/query.hpp index 3d3353c65..04998f4c5 100644 --- a/boost/network/protocol/http/message/wrappers/query.hpp +++ b/boost/network/protocol/http/message/wrappers/query.hpp @@ -20,7 +20,7 @@ template struct query_wrapper { basic_request const& message_; - query_wrapper(basic_request const& message) : message_(message) {} + explicit query_wrapper(basic_request const& message) : message_(message) {} typedef typename basic_request::string_type string_type; diff --git a/boost/network/protocol/http/message/wrappers/ready.hpp b/boost/network/protocol/http/message/wrappers/ready.hpp index cb1ab3544..80a965a3b 100644 --- a/boost/network/protocol/http/message/wrappers/ready.hpp +++ b/boost/network/protocol/http/message/wrappers/ready.hpp @@ -38,10 +38,13 @@ inline bool ready(async_message const& message) { return impl::ready_wrapper(message); } -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_READY_HPP_20100618 */ diff --git a/boost/network/protocol/http/message/wrappers/status_message.hpp b/boost/network/protocol/http/message/wrappers/status_message.hpp index ea4c8fc4d..a08421acb 100644 --- a/boost/network/protocol/http/message/wrappers/status_message.hpp +++ b/boost/network/protocol/http/message/wrappers/status_message.hpp @@ -36,8 +36,8 @@ struct status_message_wrapper { }; template -inline std::ostream& operator<<(std::ostream& os, - const status_message_wrapper& wrapper) { +inline std::ostream& operator<<(std::ostream& /*os*/, + const status_message_wrapper& /*wrapper*/) { return os << static_cast::type>(wrapper); } diff --git a/boost/network/protocol/http/message/wrappers/uri.hpp b/boost/network/protocol/http/message/wrappers/uri.hpp index 2e80d1c62..67d8745b1 100644 --- a/boost/network/protocol/http/message/wrappers/uri.hpp +++ b/boost/network/protocol/http/message/wrappers/uri.hpp @@ -20,12 +20,12 @@ namespace impl { template struct uri_wrapper { basic_request const& message_; - uri_wrapper(basic_request const& message) : message_(message) {} + explicit uri_wrapper(basic_request const& message) : message_(message) {} typedef typename basic_request::string_type string_type; operator string_type() { return message_.uri().raw(); } operator boost::network::uri::uri() { return message_.uri(); } }; -} +} // namespace impl template inline impl::uri_wrapper uri(basic_request const& request) { diff --git a/boost/network/protocol/http/parser/incremental.hpp b/boost/network/protocol/http/parser/incremental.hpp index ba7222a3a..d81b23920 100644 --- a/boost/network/protocol/http/parser/incremental.hpp +++ b/boost/network/protocol/http/parser/incremental.hpp @@ -8,12 +8,12 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include -#include +#include #include -#include #include -#include +#include +#include +#include #include namespace boost { @@ -53,7 +53,7 @@ struct response_parser { response_parser(response_parser const& other) : state_(other.state_) {} - ~response_parser() {} + ~response_parser() = default; void swap(response_parser& other) { std::swap(other.state_, this->state_); } @@ -290,7 +290,8 @@ struct response_parser { local_range = boost::make_iterator_range(current, end); } - if (state_ == stop_state) parsed_ok = true; + if (state_ == stop_state) { parsed_ok = true; +} return fusion::make_tuple(parsed_ok, boost::make_iterator_range(start, current)); } @@ -303,10 +304,13 @@ struct response_parser { state_t state_; }; -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif diff --git a/boost/network/protocol/http/policies/async_connection.hpp b/boost/network/protocol/http/policies/async_connection.hpp index 667712b39..8ddb4181a 100644 --- a/boost/network/protocol/http/policies/async_connection.hpp +++ b/boost/network/protocol/http/policies/async_connection.hpp @@ -9,16 +9,16 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include -#include -#include #include -#include +#include #include -#include +#include +#include +#include #include -#include +#include #include +#include namespace boost { namespace network { @@ -39,7 +39,7 @@ struct async_connection_policy : resolver_policy::type { connection_impl(bool follow_redirect, bool always_verify_peer, resolve_function resolve, resolver_type& resolver, bool https, int timeout, - optional const& certificate_filename, + optional /*unused*/const& certificate_filename, optional const& verify_path, optional const& certificate_file, optional const& private_key_file, @@ -53,7 +53,7 @@ struct async_connection_policy : resolver_policy::type { ciphers, ssl_options); } - basic_response send_request(string_type const& method, + basic_response send_request(string_type /*unused*/const& method, basic_request const& request_, bool get_body, body_callback_function_type callback, @@ -70,7 +70,7 @@ struct async_connection_policy : resolver_policy::type { connection_ptr get_connection( resolver_type& resolver, basic_request const& request_, bool always_verify_peer, - optional const& certificate_filename = + optional /*unused*/const& certificate_filename = optional(), optional const& verify_path = optional(), optional const& certificate_file = optional(), diff --git a/boost/network/protocol/http/policies/async_resolver.hpp b/boost/network/protocol/http/policies/async_resolver.hpp index 61a710147..641f4c969 100644 --- a/boost/network/protocol/http/policies/async_resolver.hpp +++ b/boost/network/protocol/http/policies/async_resolver.hpp @@ -6,8 +6,8 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include #include +#include #include namespace boost { @@ -40,7 +40,7 @@ struct async_resolver : boost::enable_shared_from_this > { explicit async_resolver(bool cache_resolved) : cache_resolved_(cache_resolved), endpoint_cache_() {} - void resolve(resolver_type &resolver_, string_type const &host, + void resolve(resolver_type &resolver_, string_type /*unused*/const &host, boost::uint16_t port, resolve_completion_function once_resolved) { if (cache_resolved_) { @@ -63,7 +63,7 @@ struct async_resolver : boost::enable_shared_from_this > { boost::asio::placeholders::iterator))); } - void handle_resolve(string_type const &host, + void handle_resolve(string_type /*unused*/const &host, resolve_completion_function once_resolved, boost::system::error_code const &ec, resolver_iterator endpoint_iterator) { diff --git a/boost/network/protocol/http/policies/pooled_connection.hpp b/boost/network/protocol/http/policies/pooled_connection.hpp index 2ac32845a..664bb633d 100644 --- a/boost/network/protocol/http/policies/pooled_connection.hpp +++ b/boost/network/protocol/http/policies/pooled_connection.hpp @@ -9,11 +9,11 @@ #include -#include -#include -#include #include +#include #include +#include +#include #include #ifndef BOOST_NETWORK_HTTP_MAXIMUM_REDIRECT_COUNT @@ -47,7 +47,7 @@ struct pooled_connection_policy : resolver_policy::type { get_connection_function; connection_impl( - resolver_type& resolver, bool follow_redirect, string_type const& host, + resolver_type& resolver, bool follow_redirect, string_type /*unused*/const& host, string_type const& port, resolver_function_type resolve, get_connection_function get_connection, bool https, bool always_verify_peer, int timeout, @@ -77,7 +77,7 @@ struct pooled_connection_policy : resolver_policy::type { (void)port; } - basic_response send_request(string_type const& method, + basic_response send_request(string_type /*unused*/const& method, basic_request request_, bool get_body, body_callback_function_type callback, body_generator_function_type generator) { @@ -86,7 +86,7 @@ struct pooled_connection_policy : resolver_policy::type { private: basic_response send_request_impl( - string_type const& method, basic_request request_, bool get_body, + string_type /*unused*/const& method, basic_request request_, bool get_body, body_callback_function_type callback, body_generator_function_type generator) { // TODO(dberris): review parameter necessity. @@ -190,7 +190,7 @@ struct pooled_connection_policy : resolver_policy::type { connection_ptr get_connection( resolver_type& resolver, basic_request const& request_, bool always_verify_peer, - optional const& certificate_filename = + optional /*unused*/const& certificate_filename = optional(), optional const& verify_path = optional(), optional const& certificate_file = optional(), diff --git a/boost/network/protocol/http/policies/simple_connection.hpp b/boost/network/protocol/http/policies/simple_connection.hpp index 4e9677ab9..92cff2dea 100644 --- a/boost/network/protocol/http/policies/simple_connection.hpp +++ b/boost/network/protocol/http/policies/simple_connection.hpp @@ -8,19 +8,19 @@ // http://www.boost.org/LICENSE_1_0.txt) #include -#include -#include -#include -#include #include -#include -#include +#include #include +#include #include +#include +#include +#include +#include #include +#include +#include #include -#include -#include namespace boost { namespace network { @@ -42,7 +42,7 @@ struct simple_connection_policy : resolver_policy::type { struct connection_impl { connection_impl( resolver_type& resolver, bool follow_redirect, bool always_verify_peer, - string_type const& hostname, string_type const& port, + string_type /*unused*/const& hostname, string_type const& port, resolver_function_type resolve, bool https, int timeout, optional const& certificate_filename = optional(), @@ -65,7 +65,7 @@ struct simple_connection_policy : resolver_policy::type { ciphers, ssl_options)); } - basic_response send_request(string_type const& method, + basic_response send_request(string_type /*unused*/const& method, basic_request request_, bool get_body, body_callback_function_type callback, body_generator_function_type generator) { @@ -99,10 +99,12 @@ struct simple_connection_policy : resolver_policy::type { } else throw std::runtime_error( "Location header not defined in redirect response."); - } else + } else { break; - } else +} + } else { break; +} } while (true); return response_; } @@ -117,7 +119,7 @@ struct simple_connection_policy : resolver_policy::type { connection_ptr get_connection( resolver_type& resolver, basic_request const& request_, bool always_verify_peer, - optional const& certificate_filename = + optional /*unused*/const& certificate_filename = optional(), optional const& verify_path = optional(), optional const& certificate_file = optional(), diff --git a/boost/network/protocol/http/policies/sync_resolver.hpp b/boost/network/protocol/http/policies/sync_resolver.hpp index 9f93b9852..8aa64d8f3 100644 --- a/boost/network/protocol/http/policies/sync_resolver.hpp +++ b/boost/network/protocol/http/policies/sync_resolver.hpp @@ -6,12 +6,12 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include #include +#include #include #include -#include #include +#include #include namespace boost { @@ -35,10 +35,10 @@ struct sync_resolver { resolved_cache endpoint_cache_; bool cache_resolved_; - sync_resolver(bool cache_resolved) : cache_resolved_(cache_resolved) {} + explicit sync_resolver(bool cache_resolved) : cache_resolved_(cache_resolved) {} resolver_iterator_pair resolve(resolver_type& resolver_, - string_type const& hostname, + string_type /*unused*/const& hostname, string_type const& port) { if (cache_resolved_) { typename resolved_cache::iterator cached_iterator = diff --git a/boost/network/protocol/http/request.hpp b/boost/network/protocol/http/request.hpp index 8c6881186..7327bb825 100644 --- a/boost/network/protocol/http/request.hpp +++ b/boost/network/protocol/http/request.hpp @@ -9,39 +9,39 @@ // Implement the HTTP Request Object -#include -#include #include +#include +#include #include #include #include -#include #include +#include #include #include -#include #include -#include #include -#include #include -#include +#include +#include +#include #include +#include #include #include #include #include -#include -#include -#include #include #include +#include +#include +#include #include #include -#include #include +#include #include #include diff --git a/boost/network/protocol/http/request_concept.hpp b/boost/network/protocol/http/request_concept.hpp index 4d843cbb8..09094d86d 100644 --- a/boost/network/protocol/http/request_concept.hpp +++ b/boost/network/protocol/http/request_concept.hpp @@ -8,9 +8,9 @@ // http://www.boost.org/LICENSE_1_0.txt) #include -#include #include #include +#include #include namespace boost { diff --git a/boost/network/protocol/http/response.hpp b/boost/network/protocol/http/response.hpp index dea1f46e8..fa7a2eefe 100644 --- a/boost/network/protocol/http/response.hpp +++ b/boost/network/protocol/http/response.hpp @@ -25,8 +25,8 @@ #include #include -#include #include +#include #include #include #include diff --git a/boost/network/protocol/http/response_concept.hpp b/boost/network/protocol/http/response_concept.hpp index 631282961..d262b97be 100644 --- a/boost/network/protocol/http/response_concept.hpp +++ b/boost/network/protocol/http/response_concept.hpp @@ -9,8 +9,8 @@ #include #include -#include #include +#include #include #include diff --git a/boost/network/protocol/http/support/client_or_server.hpp b/boost/network/protocol/http/support/client_or_server.hpp index 434d6f35b..1e23aa0a1 100644 --- a/boost/network/protocol/http/support/client_or_server.hpp +++ b/boost/network/protocol/http/support/client_or_server.hpp @@ -8,7 +8,7 @@ #include #include -#include +#include namespace boost { namespace network { @@ -32,10 +32,13 @@ struct client_or_server >::type> { typedef tags::client type; }; -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_SUPPORT_CLIENT_OR_SERVER_HPP_20101127 */ diff --git a/boost/network/protocol/http/support/is_client.hpp b/boost/network/protocol/http/support/is_client.hpp index c4201c1c9..c4447fbd4 100644 --- a/boost/network/protocol/http/support/is_client.hpp +++ b/boost/network/protocol/http/support/is_client.hpp @@ -6,8 +6,8 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include #include -#include namespace boost { namespace network { @@ -20,10 +20,13 @@ template struct is_client< Tag, typename enable_if::type> : mpl::true_ {}; -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_SUPPORT_IS_CLIENT_HPP_20101118 */ diff --git a/boost/network/protocol/http/support/is_keepalive.hpp b/boost/network/protocol/http/support/is_keepalive.hpp index a063167f3..994e5e822 100644 --- a/boost/network/protocol/http/support/is_keepalive.hpp +++ b/boost/network/protocol/http/support/is_keepalive.hpp @@ -23,10 +23,13 @@ template struct is_keepalive< Tag, typename enable_if::type> : mpl::true_ {}; -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_SUPPORT_IS_KEEPALIVE_HPP_20100927 */ diff --git a/boost/network/protocol/http/support/is_server.hpp b/boost/network/protocol/http/support/is_server.hpp index 365ad6e30..11b845df1 100644 --- a/boost/network/protocol/http/support/is_server.hpp +++ b/boost/network/protocol/http/support/is_server.hpp @@ -20,10 +20,13 @@ template struct is_server< Tag, typename enable_if::type> : mpl::true_ {}; -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_SUPPORT_IS_SERVER_HPP_20101118 */ diff --git a/boost/network/protocol/http/support/is_simple.hpp b/boost/network/protocol/http/support/is_simple.hpp index c329df8fb..d7e7fee5d 100644 --- a/boost/network/protocol/http/support/is_simple.hpp +++ b/boost/network/protocol/http/support/is_simple.hpp @@ -20,10 +20,13 @@ template struct is_simple< Tag, typename enable_if::type> : mpl::true_ {}; -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_SUPPORT_IS_SIMPLE_HPP_20100927 */ diff --git a/boost/network/protocol/http/support/sync_only.hpp b/boost/network/protocol/http/support/sync_only.hpp index 6a3eb3fe8..3700df235 100644 --- a/boost/network/protocol/http/support/sync_only.hpp +++ b/boost/network/protocol/http/support/sync_only.hpp @@ -21,10 +21,13 @@ struct sync_only tags::sync>::type, mpl::inherit > {}; -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_SUPPORT_SYNC_ONLY_HPP_20100927 */ diff --git a/boost/network/protocol/http/tags.hpp b/boost/network/protocol/http/tags.hpp index bdf8b4439..fcf67a1ae 100644 --- a/boost/network/protocol/http/tags.hpp +++ b/boost/network/protocol/http/tags.hpp @@ -6,9 +6,7 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include - -namespace boost { +#include space boost { namespace network { namespace http { namespace tags { @@ -60,12 +58,20 @@ BOOST_NETWORK_DEFINE_TAG(http_async_8bit_tcp_resolve); BOOST_NETWORK_DEFINE_TAG(http_server); BOOST_NETWORK_DEFINE_TAG(http_async_server); -} /* tags */ +} // namespace tags + // namespace tags + /* tags */ -} /* http */ +} // namespace http + // namespace http + /* http */ -} /* network */ +} // namespace network + // namespace network + /* network */ -} /* boost */ +} // namespace boost + // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_TAGS_HPP_20101019 */ diff --git a/boost/network/protocol/http/traits/connection_keepalive.hpp b/boost/network/protocol/http/traits/connection_keepalive.hpp index 0069b3a36..891367f00 100644 --- a/boost/network/protocol/http/traits/connection_keepalive.hpp +++ b/boost/network/protocol/http/traits/connection_keepalive.hpp @@ -6,8 +6,8 @@ #ifndef BOOST_NETWORK_PROTOCOL_HTTP_TRAITS_CONECTION_KEEPALIVE_20091218 #define BOOST_NETWORK_PROTOCOL_HTTP_TRAITS_CONECTION_KEEPALIVE_20091218 -#include #include +#include namespace boost { namespace network { @@ -16,10 +16,13 @@ namespace http { template struct connection_keepalive : is_keepalive {}; -} /* http */ +} // namespace http + /* http */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif // BOOST_NETWORK_PROTOCOL_HTTP_TRAITS_CONECTION_KEEPALIVE_20091218 diff --git a/boost/network/protocol/http/traits/connection_policy.hpp b/boost/network/protocol/http/traits/connection_policy.hpp index 4ee96eee3..f4b9173c9 100644 --- a/boost/network/protocol/http/traits/connection_policy.hpp +++ b/boost/network/protocol/http/traits/connection_policy.hpp @@ -7,15 +7,15 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include #include +#include #include #include #include -#include -#include #include #include +#include +#include namespace boost { namespace network { diff --git a/boost/network/protocol/http/traits/delegate_factory.hpp b/boost/network/protocol/http/traits/delegate_factory.hpp index cec92c266..2eece8d15 100644 --- a/boost/network/protocol/http/traits/delegate_factory.hpp +++ b/boost/network/protocol/http/traits/delegate_factory.hpp @@ -18,7 +18,8 @@ namespace impl { template struct connection_delegate_factory; -} /* impl */ +} // namespace impl + /* impl */ template struct unsupported_tag; @@ -33,8 +34,11 @@ struct delegate_factory >::type> { typedef impl::connection_delegate_factory type; }; -} /* http */ -} /* network */ -} /* boost */ +} // namespace http + /* http */ +} // namespace network + /* network */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_TRAITS_DELEGATE_FACTORY_HPP_20110819 */ diff --git a/boost/network/protocol/http/traits/impl/chunk_cache.ipp b/boost/network/protocol/http/traits/impl/chunk_cache.ipp index c7ac9c885..f528c6bbf 100644 --- a/boost/network/protocol/http/traits/impl/chunk_cache.ipp +++ b/boost/network/protocol/http/traits/impl/chunk_cache.ipp @@ -19,7 +19,7 @@ namespace http { template struct chunk_cache { - // TODO define the allocator using an allocator_traits? + // TODO(dberris): define the allocator using an allocator_traits? typedef std::list::type> > type; }; diff --git a/boost/network/protocol/http/traits/impl/headers_container.ipp b/boost/network/protocol/http/traits/impl/headers_container.ipp index d06585ef8..8e5bfc80d 100644 --- a/boost/network/protocol/http/traits/impl/headers_container.ipp +++ b/boost/network/protocol/http/traits/impl/headers_container.ipp @@ -8,10 +8,10 @@ #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_HEADERS_CONTAINER_IPP #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_HEADERS_CONTAINER_IPP -#include -#include -#include #include +#include +#include +#include #include #include @@ -26,7 +26,7 @@ namespace impl { // returns true if str1 < str2 (ignoring case) struct is_less_ignore_case_impl { inline bool operator()( - string::type const& str1, + string::type /*unused*/const& str1, string::type const& str2) const { return to_lower_copy(str1) < to_lower_copy(str2); diff --git a/boost/network/protocol/http/traits/impl/response_code.ipp b/boost/network/protocol/http/traits/impl/response_code.ipp index db32bcf94..8317b7ad0 100644 --- a/boost/network/protocol/http/traits/impl/response_code.ipp +++ b/boost/network/protocol/http/traits/impl/response_code.ipp @@ -7,8 +7,8 @@ #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_RESPONSE_CODE_IPP #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_TRAITS_RESPONSE_CODE_IPP -#include #include +#include namespace boost { namespace network { diff --git a/boost/network/protocol/http/traits/resolver.hpp b/boost/network/protocol/http/traits/resolver.hpp index 45048fd8f..8077d6b12 100644 --- a/boost/network/protocol/http/traits/resolver.hpp +++ b/boost/network/protocol/http/traits/resolver.hpp @@ -6,11 +6,11 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include #include +#include #include -#include #include +#include #include #include #include diff --git a/boost/network/protocol/http/traits/resolver_policy.hpp b/boost/network/protocol/http/traits/resolver_policy.hpp index 5c279dd3f..3c4ea0fe8 100644 --- a/boost/network/protocol/http/traits/resolver_policy.hpp +++ b/boost/network/protocol/http/traits/resolver_policy.hpp @@ -6,13 +6,13 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include #include +#include #include +#include +#include #include #include -#include -#include namespace boost { namespace network { diff --git a/boost/network/protocol/http/traits/vector.hpp b/boost/network/protocol/http/traits/vector.hpp index bc343de73..0e756f354 100644 --- a/boost/network/protocol/http/traits/vector.hpp +++ b/boost/network/protocol/http/traits/vector.hpp @@ -30,8 +30,10 @@ struct vector { }; }; -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_TRAITS_VECTOR_HPP_20101019 */ diff --git a/boost/network/support/is_async.hpp b/boost/network/support/is_async.hpp index 74fbab3b2..c4b59c44c 100644 --- a/boost/network/support/is_async.hpp +++ b/boost/network/support/is_async.hpp @@ -7,10 +7,8 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include -#include - -namespace boost { +#include s_sync.hpp> +#include espace boost { namespace network { template diff --git a/boost/network/support/is_default_wstring.hpp b/boost/network/support/is_default_wstring.hpp index 02f4db871..6058b26c7 100644 --- a/boost/network/support/is_default_wstring.hpp +++ b/boost/network/support/is_default_wstring.hpp @@ -7,7 +7,7 @@ #define BOOST_NETWORK_SUPPORT_WSTRING_CHECK_20100808 #include -#include +#include stream.hpp> namespace boost { namespace network { diff --git a/boost/network/support/is_pod.hpp b/boost/network/support/is_pod.hpp index 1778f112b..a2f63f70a 100644 --- a/boost/network/support/is_pod.hpp +++ b/boost/network/support/is_pod.hpp @@ -19,8 +19,12 @@ template struct is_pod::type> : mpl::true_ {}; -} /* network */ +} // namespace network + // namespace network + /* network */ -} /* boost */ +} // namespace boost + // namespace boost + /* boost */ #endif /* BOOST_NETWORK_SUPPORT_IS_POD_HPP_20101120 */ diff --git a/boost/network/support/is_tcp.hpp b/boost/network/support/is_tcp.hpp index 3bbc672e7..7244c87b1 100644 --- a/boost/network/support/is_tcp.hpp +++ b/boost/network/support/is_tcp.hpp @@ -6,10 +6,10 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include -#include #include +#include #include +#include namespace boost { namespace network { diff --git a/boost/network/support/is_udp.hpp b/boost/network/support/is_udp.hpp index 555b9bf8f..78bdc8afe 100644 --- a/boost/network/support/is_udp.hpp +++ b/boost/network/support/is_udp.hpp @@ -6,11 +6,11 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include -#include -#include #include +#include +#include #include +#include namespace boost { namespace network { diff --git a/boost/network/support/pod_or_normal.hpp b/boost/network/support/pod_or_normal.hpp index 2d54bbd01..739505d4f 100644 --- a/boost/network/support/pod_or_normal.hpp +++ b/boost/network/support/pod_or_normal.hpp @@ -8,7 +8,7 @@ #include #include -#include +#include s.hpp> namespace boost { namespace network { @@ -22,8 +22,12 @@ template struct pod_or_normal< Tag, typename enable_if::type> : tags::pod {}; -} /* network */ +} // namespace network + // namespace network + /* network */ -} /* boost */ +} // namespace boost + // namespace boost + /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_SUPPORT_POD_OR_NORMAL_HPP_20101128 */ diff --git a/boost/network/support/sync_only.hpp b/boost/network/support/sync_only.hpp index 719737e4e..e68f9ba2b 100644 --- a/boost/network/support/sync_only.hpp +++ b/boost/network/support/sync_only.hpp @@ -7,10 +7,10 @@ // http://www.boost.org/LICENSE_1_0.txt) #include -#include #include -#include #include +#include +#include namespace boost { namespace network { @@ -23,8 +23,10 @@ struct sync_only tags::sync>::type, mpl::inherit > {}; -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_SUPPORT_SYNC_ONLY_HPP_20100927 */ diff --git a/boost/network/traits/headers_container.hpp b/boost/network/traits/headers_container.hpp index 46f633272..9d995e483 100644 --- a/boost/network/traits/headers_container.hpp +++ b/boost/network/traits/headers_container.hpp @@ -8,12 +8,9 @@ #ifndef BOOST_NETWORK_TRAITS_HEADERS_CONTAINER_INC #define BOOST_NETWORK_TRAITS_HEADERS_CONTAINER_INC -#include -#include -#include - -namespace boost { -namespace network { +#include t/network/tags.hpp> +#include ring.hpp> +#include e network { namespace impl { template diff --git a/boost/network/traits/istream.hpp b/boost/network/traits/istream.hpp index 4a8a0a861..a4320ddf2 100644 --- a/boost/network/traits/istream.hpp +++ b/boost/network/traits/istream.hpp @@ -33,8 +33,10 @@ struct istream >::type> { typedef std::wistream type; }; -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_TRAITS_ISTREAM_HPP_20100924 */ diff --git a/boost/network/traits/istringstream.hpp b/boost/network/traits/istringstream.hpp index 0f5273a30..efb0d501b 100644 --- a/boost/network/traits/istringstream.hpp +++ b/boost/network/traits/istringstream.hpp @@ -7,10 +7,10 @@ #ifndef BOOST_NETWORK_TRAITS_ISTRINGSTREAM_INC #define BOOST_NETWORK_TRAITS_ISTRINGSTREAM_INC -#include -#include #include #include +#include +#include namespace boost { namespace network { diff --git a/boost/network/traits/ostream_iterator.hpp b/boost/network/traits/ostream_iterator.hpp index 9099247d1..b767394aa 100644 --- a/boost/network/traits/ostream_iterator.hpp +++ b/boost/network/traits/ostream_iterator.hpp @@ -6,9 +6,9 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include #include #include -#include #include namespace boost { diff --git a/boost/network/traits/ostringstream.hpp b/boost/network/traits/ostringstream.hpp index f6925b2a1..d20b75257 100644 --- a/boost/network/traits/ostringstream.hpp +++ b/boost/network/traits/ostringstream.hpp @@ -7,14 +7,10 @@ #ifndef BOOST_NETWORK_TRAITS_OSTRINGSTREAM_INC #define BOOST_NETWORK_TRAITS_OSTRINGSTREAM_INC -#include -#include -#include -#include -#include - -namespace boost { -namespace network { +#include l/if.hpp> +#include s_default_string.hpp> +#include port/is_default_wstring.hpp> +#include { template struct unsupported_tag; diff --git a/boost/network/traits/string.hpp b/boost/network/traits/string.hpp index 6d9a1a039..aaf324672 100644 --- a/boost/network/traits/string.hpp +++ b/boost/network/traits/string.hpp @@ -7,9 +7,9 @@ #ifndef BOOST_NETWORK_TRAITS_STRING_INC #define BOOST_NETWORK_TRAITS_STRING_INC +#include etwork/tags.hpp> +#include #include -#include -#include #include #ifndef BOOST_NETWORK_DEFAULT_STRING diff --git a/boost/network/uri/accessors.hpp b/boost/network/uri/accessors.hpp index 5248b34d6..24ce274cc 100644 --- a/boost/network/uri/accessors.hpp +++ b/boost/network/uri/accessors.hpp @@ -6,8 +6,8 @@ #ifndef __BOOST_NETWORK_URI_URI_ACCESSORS_INC__ #define __BOOST_NETWORK_URI_URI_ACCESSORS_INC__ -#include #include +#include #include #include #include @@ -22,13 +22,7 @@ struct key_value_sequence : spirit::qi::grammar { typedef typename Map::mapped_type mapped_type; typedef std::pair pair_type; - key_value_sequence() : key_value_sequence::base_type(query) { - query = pair >> *((spirit::qi::lit(';') | '&') >> pair); - pair = key >> -('=' >> value); - key = - spirit::qi::char_("a-zA-Z_") >> *spirit::qi::char_("-+.~a-zA-Z_0-9/%"); - value = *spirit::qi::char_("-+.~a-zA-Z_0-9/%"); - } + key_value_sequence() : key_value_sequence::base_type(query) = default; spirit::qi::rule query; spirit::qi::rule pair; diff --git a/boost/network/uri/builder.hpp b/boost/network/uri/builder.hpp index 878a3c56b..c6ec56a52 100644 --- a/boost/network/uri/builder.hpp +++ b/boost/network/uri/builder.hpp @@ -6,8 +6,8 @@ #ifndef __BOOST_NETWORK_URI_BUILDER_INC__ #define __BOOST_NETWORK_URI_BUILDER_INC__ -#include #include +#include namespace boost { namespace network { @@ -17,7 +17,7 @@ class builder { typedef uri::string_type string_type; public: - builder(uri &uri_) : uri_(uri_) {} + explicit builder(uri &uri_) : uri_(uri_) {} builder &set_scheme(const string_type &scheme) { uri_.uri_.append(scheme); diff --git a/boost/network/uri/decode.hpp b/boost/network/uri/decode.hpp index 7503d5665..609171fbf 100644 --- a/boost/network/uri/decode.hpp +++ b/boost/network/uri/decode.hpp @@ -81,7 +81,7 @@ inline OutputIterator decode(const SinglePassRange &range, return decode(boost::begin(range), boost::end(range), out); } -inline std::string decoded(const std::string &input) { +inline std::string decoded(const std::string & /*input*/) { std::string decoded; decode(input, std::back_inserter(decoded)); return decoded; diff --git a/boost/network/uri/detail/uri_parts.hpp b/boost/network/uri/detail/uri_parts.hpp index 2564f43a0..1252c3f39 100644 --- a/boost/network/uri/detail/uri_parts.hpp +++ b/boost/network/uri/detail/uri_parts.hpp @@ -7,8 +7,8 @@ #ifndef BOOST_NETWORK_URL_DETAIL_URL_PARTS_HPP_ #define BOOST_NETWORK_URL_DETAIL_URL_PARTS_HPP_ -#include #include +#include namespace boost { namespace network { diff --git a/boost/network/uri/directives/authority.hpp b/boost/network/uri/directives/authority.hpp index 2f0bbaefe..fec926078 100644 --- a/boost/network/uri/directives/authority.hpp +++ b/boost/network/uri/directives/authority.hpp @@ -11,7 +11,7 @@ namespace network { namespace uri { struct authority_directive { - explicit authority_directive(const std::string &authority) + explicit authority_directive(const std::string & /*authority*/) : authority(authority) {} template diff --git a/boost/network/uri/directives/fragment.hpp b/boost/network/uri/directives/fragment.hpp index 6f3291d95..d74bd770d 100644 --- a/boost/network/uri/directives/fragment.hpp +++ b/boost/network/uri/directives/fragment.hpp @@ -15,7 +15,7 @@ namespace network { namespace uri { struct fragment_directive { - explicit fragment_directive(const std::string &fragment) + explicit fragment_directive(const std::string & /*fragment*/) : fragment(fragment) {} template diff --git a/boost/network/uri/directives/host.hpp b/boost/network/uri/directives/host.hpp index ac1d2ab5f..59b76d4b8 100644 --- a/boost/network/uri/directives/host.hpp +++ b/boost/network/uri/directives/host.hpp @@ -14,7 +14,7 @@ namespace network { namespace uri { struct host_directive { - explicit host_directive(const std::string &host) : host(host) {} + explicit host_directive(const std::string & /*host*/) : host(host) {} template void operator()(Uri &uri) const { diff --git a/boost/network/uri/directives/path.hpp b/boost/network/uri/directives/path.hpp index 21af8ca2b..96b546bc6 100644 --- a/boost/network/uri/directives/path.hpp +++ b/boost/network/uri/directives/path.hpp @@ -14,7 +14,7 @@ namespace network { namespace uri { struct path_directive { - explicit path_directive(const std::string &path) : path(path) {} + explicit path_directive(const std::string & /*path*/) : path(path) {} template void operator()(Uri &uri) const { @@ -26,7 +26,7 @@ struct path_directive { struct encoded_path_directive { - explicit encoded_path_directive(const std::string &path) : path(path) {} + explicit encoded_path_directive(const std::string & /*path*/) : path(path) {} void operator()(uri &uri_) const { std::string encoded_path; @@ -41,7 +41,7 @@ inline path_directive path(const std::string &path) { return path_directive(path); } -inline encoded_path_directive encoded_path(const std::string &path) { +inline encoded_path_directive encoded_path(const std::string & /*path*/) { return encoded_path_directive(path); } } // namespace uri diff --git a/boost/network/uri/directives/port.hpp b/boost/network/uri/directives/port.hpp index 181bf6b84..bc589d3dd 100644 --- a/boost/network/uri/directives/port.hpp +++ b/boost/network/uri/directives/port.hpp @@ -16,9 +16,9 @@ namespace network { namespace uri { struct port_directive { - explicit port_directive(const std::string &port) : port(port) {} + explicit port_directive(const std::string & /*port*/) : port(port) {} - explicit port_directive(boost::uint16_t port) + explicit port_directive(boost::uint16_t /*port*/) : port(boost::lexical_cast(port)) {} template diff --git a/boost/network/uri/directives/query.hpp b/boost/network/uri/directives/query.hpp index 07987867e..a8cf3f3d7 100644 --- a/boost/network/uri/directives/query.hpp +++ b/boost/network/uri/directives/query.hpp @@ -15,7 +15,7 @@ namespace network { namespace uri { struct query_directive { - explicit query_directive(const std::string &query) : query(query) {} + explicit query_directive(const std::string & /*query*/) : query(query) {} template void operator()(Uri &uri) const { @@ -32,7 +32,7 @@ inline query_directive query(const std::string &query) { struct query_key_query_directive { - query_key_query_directive(const std::string &key, const std::string &query) + query_key_query_directive(const std::string & /*key*/, const std::string & /*query*/) : key(key), query(query) {} template diff --git a/boost/network/uri/directives/scheme.hpp b/boost/network/uri/directives/scheme.hpp index 7787d3509..a96323855 100644 --- a/boost/network/uri/directives/scheme.hpp +++ b/boost/network/uri/directives/scheme.hpp @@ -6,16 +6,16 @@ #ifndef __BOOST_NETWORK_URI_DIRECTIVES_SCHEME_INC__ #define __BOOST_NETWORK_URI_DIRECTIVES_SCHEME_INC__ +#include #include #include -#include namespace boost { namespace network { namespace uri { struct scheme_directive { - explicit scheme_directive(const std::string &scheme) : scheme(scheme) {} + explicit scheme_directive(const std::string & /*scheme*/) : scheme(scheme) {} template void operator()(Uri &uri) const { diff --git a/boost/network/uri/directives/user_info.hpp b/boost/network/uri/directives/user_info.hpp index 003469aef..77eb6f341 100644 --- a/boost/network/uri/directives/user_info.hpp +++ b/boost/network/uri/directives/user_info.hpp @@ -14,7 +14,7 @@ namespace network { namespace uri { struct user_info_directive { - explicit user_info_directive(const std::string &user_info) + explicit user_info_directive(const std::string & /*user_info*/) : user_info(user_info) {} template diff --git a/boost/network/uri/encode.hpp b/boost/network/uri/encode.hpp index bf6b07689..cbd077646 100644 --- a/boost/network/uri/encode.hpp +++ b/boost/network/uri/encode.hpp @@ -141,7 +141,7 @@ inline OutputIterator encode(const SinglePassRange &range, return encode(boost::begin(range), boost::end(range), out); } -inline std::string encoded(const std::string &input) { +inline std::string encoded(const std::string & /*input*/) { std::string encoded; encode(input, std::back_inserter(encoded)); return encoded; diff --git a/boost/network/uri/uri.hpp b/boost/network/uri/uri.hpp index a40771bfb..54db9d82f 100644 --- a/boost/network/uri/uri.hpp +++ b/boost/network/uri/uri.hpp @@ -12,9 +12,9 @@ #include #include #include -#include -#include #include +#include +#include #include #include #include @@ -46,7 +46,7 @@ class BOOST_URI_DECL uri { // parse(); //} - uri(const string_type &uri) : uri_(uri), is_valid_(false) { parse(); } + explicit uri(const string_type &uri) : uri_(uri), is_valid_(false) { parse(); } template uri(const FwdIter &first, const FwdIter &last) @@ -66,7 +66,7 @@ class BOOST_URI_DECL uri { return *this; } - ~uri() {} + ~uri() = default; void swap(uri &other) { boost::swap(uri_, other.uri_); diff --git a/boost/network/utils/thread_pool.hpp b/boost/network/utils/thread_pool.hpp index 3f33cf6f9..34e06fefb 100644 --- a/boost/network/utils/thread_pool.hpp +++ b/boost/network/utils/thread_pool.hpp @@ -6,11 +6,11 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include #include +#include #include -#include #include +#include #include #include @@ -24,9 +24,9 @@ typedef boost::shared_ptr sentinel_ptr; template struct basic_thread_pool { - basic_thread_pool(std::size_t threads = 1, - io_service_ptr io_service = io_service_ptr(), - worker_threads_ptr worker_threads = worker_threads_ptr()) + explicit basic_thread_pool(std::size_t /*threads*/, + io_service_ptr /*io_service*/ io_service_ptr(), + worker_threads_ptr /*worker_threads*/ worker_threads_ptr()) : threads_(threads), io_service_(io_service), worker_threads_(worker_threads), @@ -67,7 +67,7 @@ struct basic_thread_pool { std::size_t thread_count() const { return threads_; } - void post(boost::function f) { io_service_->post(f); } + void post(boost::function /*f*/) { io_service_->post(f); } ~basic_thread_pool() throw() { sentinel_.reset(); @@ -101,10 +101,13 @@ struct basic_thread_pool { typedef basic_thread_pool thread_pool; -} /* utils */ +} // namespace utils + /* utils */ -} /* network */ +} // namespace network + /* network */ -} /* boost */ +} // namespace boost + /* boost */ #endif /* BOOST_NETWORK_UTILS_THREAD_POOL_HPP_20101020 */ diff --git a/boost/network/version.hpp b/boost/network/version.hpp index 14d6770ff..1bf416c15 100644 --- a/boost/network/version.hpp +++ b/boost/network/version.hpp @@ -7,7 +7,7 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include +#include #define BOOST_NETLIB_VERSION_MAJOR 0 #define BOOST_NETLIB_VERSION_MINOR 11 From 44bd36b4243494c99ed98f09c93faf772a42ca77 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Thu, 29 Oct 2015 02:59:22 +1100 Subject: [PATCH 014/123] Manual changes to update style and fix breakages --- .ycm_extra_conf.py | 2 +- boost/network/detail/directive_base.hpp | 11 ++-- boost/network/detail/wrapper_base.hpp | 6 +- boost/network/message.hpp | 2 +- .../directives/detail/string_directive.hpp | 18 +++--- boost/network/message/directives/header.hpp | 20 ++++--- .../message/directives/remove_header.hpp | 6 +- boost/network/message/message_concept.hpp | 6 +- .../network/message/modifiers/add_header.hpp | 10 ++-- .../message/modifiers/clear_headers.hpp | 10 ++-- .../message/modifiers/remove_header.hpp | 9 +-- boost/network/message/traits/body.hpp | 16 ++--- boost/network/message/traits/destination.hpp | 16 ++--- boost/network/message/traits/headers.hpp | 20 +++---- boost/network/message/traits/source.hpp | 17 ++---- .../message/transformers/selectors.hpp | 28 +++++---- .../network/message/transformers/to_lower.hpp | 27 +++++---- .../network/message/transformers/to_upper.hpp | 26 ++++---- boost/network/message/wrappers/body.hpp | 14 +++-- boost/network/message/wrappers/headers.hpp | 15 ++--- boost/network/message_fwd.hpp | 8 ++- .../client/connection/connection_delegate.hpp | 18 +++--- .../client/connection/normal_delegate.hpp | 25 +++----- .../client/connection/normal_delegate.ipp | 12 ++-- .../http/client/connection/ssl_delegate.hpp | 35 +++++------ .../http/message/modifiers/destination.hpp | 1 + boost/network/protocol/http/tags.hpp | 59 ++++++++++--------- boost/network/support/is_async.hpp | 8 ++- boost/network/support/is_default_wstring.hpp | 4 +- boost/network/support/pod_or_normal.hpp | 7 +-- boost/network/traits/headers_container.hpp | 9 ++- boost/network/traits/ostringstream.hpp | 12 ++-- boost/network/traits/string.hpp | 6 +- boost/network/uri/accessors.hpp | 8 +-- boost/network/uri/decode.hpp | 8 ++- boost/network/uri/directives/authority.hpp | 17 +++--- boost/network/uri/directives/fragment.hpp | 15 ++--- boost/network/uri/directives/host.hpp | 13 ++-- boost/network/uri/directives/path.hpp | 17 +++--- boost/network/uri/directives/port.hpp | 17 +++--- boost/network/uri/directives/query.hpp | 26 ++++---- boost/network/uri/directives/scheme.hpp | 3 +- boost/network/uri/directives/user_info.hpp | 15 ++--- boost/network/uri/encode.hpp | 5 +- boost/network/utils/thread_pool.hpp | 48 ++++++++------- 45 files changed, 347 insertions(+), 328 deletions(-) diff --git a/.ycm_extra_conf.py b/.ycm_extra_conf.py index 85cf36ad9..2fca4f841 100644 --- a/.ycm_extra_conf.py +++ b/.ycm_extra_conf.py @@ -17,7 +17,7 @@ '-Wall', '-Wextra', '-Werror', - '-std=c++03', + '-std=c++11', '-isystem', '.', '-isystem', diff --git a/boost/network/detail/directive_base.hpp b/boost/network/detail/directive_base.hpp index 7fdef9fb6..84472f775 100644 --- a/boost/network/detail/directive_base.hpp +++ b/boost/network/detail/directive_base.hpp @@ -7,6 +7,8 @@ #ifndef __NETWORK_DETAIL_DIRECTIVE_BASE_HPP__ #define __NETWORK_DETAIL_DIRECTIVE_BASE_HPP__ +#include + /** Defines the base type from which all directives inherit * to allow friend access to message and other types' internals. */ @@ -17,12 +19,13 @@ namespace detail { template struct directive_base { typedef Tag tag; - // explicit directive_base(basic_message & message_) - // : _message(message_) + explicit directive_base(basic_message & message) + : message_(message) {} + protected: - ~directive_base() = default;default;; // can only be extended + ~directive_base() = default; // can only be extended - // mutable basic_message & _message; + basic_message & message_; }; } // namespace detail diff --git a/boost/network/detail/wrapper_base.hpp b/boost/network/detail/wrapper_base.hpp index 609b03456..bbd2e9589 100644 --- a/boost/network/detail/wrapper_base.hpp +++ b/boost/network/detail/wrapper_base.hpp @@ -17,8 +17,7 @@ struct wrapper_base { explicit wrapper_base(Message& message_) : _message(message_) {}; protected: - ~wrapper_base() = default;default;; // for extending only - + ~wrapper_base() = default; // for extending only Message& _message; }; @@ -27,8 +26,7 @@ struct wrapper_base_const { explicit wrapper_base_const(Message const& message_) : _message(message_) {} protected: - ~wrapper_base_const() = default;default;; // for extending only - + ~wrapper_base_const() = default; // for extending only Message const& _message; }; diff --git a/boost/network/message.hpp b/boost/network/message.hpp index 6e639c6fd..fba81d9cd 100644 --- a/boost/network/message.hpp +++ b/boost/network/message.hpp @@ -8,7 +8,7 @@ #include #include -#include boost/network/traits/headers_container.hpp> +#include #include #include #include diff --git a/boost/network/message/directives/detail/string_directive.hpp b/boost/network/message/directives/detail/string_directive.hpp index 15eedf5f6..db07eceb4 100644 --- a/boost/network/message/directives/detail/string_directive.hpp +++ b/boost/network/message/directives/detail/string_directive.hpp @@ -6,12 +6,14 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include +#include +#include #include +#include +#include +#include #include -#include > -#include #include -#include -#include ble_if.hpp> /** * @@ -32,7 +34,7 @@ #define BOOST_NETWORK_STRING_DIRECTIVE(name, value, body, pod_body) \ template \ struct name##_directive { \ - ValueType const& ((value)); \ + ValueType const&((value)); \ explicit name##_directive(ValueType const& value_) : value(value_) {} \ name##_directive(name##_directive const& other) : value(other.value) {} \ template class Message> \ @@ -51,7 +53,5 @@ inline name##_directive name(T const& input) { \ return name##_directive(input); \ } -#endif /* BOOST_NETWORK_STRING_DIRECTIVE */ - -#endif /* BOOST_NETWORK_MESSAGE_DIRECTIVES_DETAIL_STRING_DIRECTIVE_HPP_20100915 \ - */ +#endif // BOOST_NETWORK_STRING_DIRECTIVE +#endif // BOOST_NETWORK_MESSAGE_DIRECTIVES_DETAIL_STRING_DIRECTIVE_HPP_20100915 diff --git a/boost/network/message/directives/header.hpp b/boost/network/message/directives/header.hpp index 17e464782..9619b05f1 100644 --- a/boost/network/message/directives/header.hpp +++ b/boost/network/message/directives/header.hpp @@ -4,16 +4,20 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef __NETWORK_MESSAGE_DIRECTIVES_HEADER_HPP__ -#define __NETWORK_MESSAGE_DIRECTIVES_HEADER_HPP__ +#ifndef BOOST_NETWORK_MESSAGE_DIRECTIVES_HEADER_HPP__ +#define BOOST_NETWORK_MESSAGE_DIRECTIVES_HEADER_HPP__ -#include pp> -#include nclude ude +#include +#include +#include +#include #include #include -#include r.hpp> -#include > -#include pace boost { +#include +#include +#include + +namespace boost { namespace network { namespace impl { @@ -69,4 +73,4 @@ inline impl::header_directive header(T1 const& header_name, } // namespace network } // namespace boost -#endif // __NETWORK_MESSAGE_DIRECTIVES_HEADER_HPP__ +#endif // BOOST_NETWORK_MESSAGE_DIRECTIVES_HEADER_HPP__ diff --git a/boost/network/message/directives/remove_header.hpp b/boost/network/message/directives/remove_header.hpp index c2f373822..cc04bf17b 100644 --- a/boost/network/message/directives/remove_header.hpp +++ b/boost/network/message/directives/remove_header.hpp @@ -8,6 +8,7 @@ #define NETWORK_MESSAGE_DIRECTIVES_REMOVE_HEADER_HPP #include +#include namespace boost { namespace network { @@ -34,14 +35,15 @@ struct remove_header_directive { } // namespace impl inline impl::remove_header_directive remove_header( - std::string /*header_name*/ame*/) { + const std::string& header_name) { return impl::remove_header_directive(header_name); } inline impl::remove_header_directive remove_header( - std::wstring header_name) { + const std::wstring& header_name) { return impl::remove_header_directive(header_name); } + } // namespace network } // namespace boost diff --git a/boost/network/message/message_concept.hpp b/boost/network/message/message_concept.hpp index ddff3f0f2..e2a1a1275 100644 --- a/boost/network/message/message_concept.hpp +++ b/boost/network/message/message_concept.hpp @@ -14,7 +14,11 @@ #include #include #include -#include de oost { +#include +#include +#include + +namespace boost { namespace network { template diff --git a/boost/network/message/modifiers/add_header.hpp b/boost/network/message/modifiers/add_header.hpp index 7049c22ee..1280004ad 100644 --- a/boost/network/message/modifiers/add_header.hpp +++ b/boost/network/message/modifiers/add_header.hpp @@ -7,9 +7,11 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include nc.hpp> -#include ort/is_pod.hpp> -#include le_if.hpp> +#include +#include +#include +#include +#include namespace boost { namespace network { @@ -36,7 +38,7 @@ inline typename enable_if, void>::type add_header( typename Message::header_type header = {key, value}; message.headers.insert(message.headers.end(), header); } -} // namespace impl // namespace impl +} // namespace impl template class Message, class KeyType, class ValueType> diff --git a/boost/network/message/modifiers/clear_headers.hpp b/boost/network/message/modifiers/clear_headers.hpp index f33435020..ef758073f 100644 --- a/boost/network/message/modifiers/clear_headers.hpp +++ b/boost/network/message/modifiers/clear_headers.hpp @@ -6,10 +6,12 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include _async.hpp> -#include .hpp> -#include e.hpp> -#include le_if.hpp> +#include +#include +#include +#include +#include +#include namespace boost { namespace network { diff --git a/boost/network/message/modifiers/remove_header.hpp b/boost/network/message/modifiers/remove_header.hpp index b2b812b53..efd793194 100644 --- a/boost/network/message/modifiers/remove_header.hpp +++ b/boost/network/message/modifiers/remove_header.hpp @@ -7,11 +7,12 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include #include #include -#include _if.hpp> -#include e -#include +#include +#include +#include namespace boost { namespace network { @@ -38,7 +39,7 @@ struct iequals_pred { iequals_pred(KeyType const& key) : key(key) {} template bool operator()(Header& other) const { - return boost::iequals(key, name(other)); + return boost::algorithm::iequals(key, name(other)); } }; diff --git a/boost/network/message/traits/body.hpp b/boost/network/message/traits/body.hpp index 57d62fef6..8f37bf6f1 100644 --- a/boost/network/message/traits/body.hpp +++ b/boost/network/message/traits/body.hpp @@ -7,10 +7,12 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include .hpp> -#include _sync.hpp> -#include re.hpp> -#include /is_same.hpp> +#include +#include +#include +#include +#include +#include namespace boost { namespace network { @@ -33,13 +35,7 @@ struct body unsupported_tag >::type> {}; } // namespace traits - } // namespace network - // namespace network - /* network */ - } // namespace boost - // namespace boost - /* boost */ #endif // BOOST_NETWORK_MESSAGE_TRAITS_BODY_HPP_20100903 diff --git a/boost/network/message/traits/destination.hpp b/boost/network/message/traits/destination.hpp index fc55d7a9c..9baf36ddd 100644 --- a/boost/network/message/traits/destination.hpp +++ b/boost/network/message/traits/destination.hpp @@ -7,10 +7,12 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include > -#include hpp> +#include +#include +#include +#include #include -#include /is_same.hpp> +#include namespace boost { namespace network { @@ -33,13 +35,7 @@ struct destination unsupported_tag >::type> {}; } // namespace traits - -} // namespace network - // namespace network - /* network */ - +} // namespace network } // namespace boost - // namespace boost - /* boost */ #endif // BOOST_NETWORK_MESSAGE_TRAITS_DESTINATION_HPP_20100903 diff --git a/boost/network/message/traits/headers.hpp b/boost/network/message/traits/headers.hpp index 2f44d6a6e..0140aa782 100644 --- a/boost/network/message/traits/headers.hpp +++ b/boost/network/message/traits/headers.hpp @@ -7,11 +7,13 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include ude p> -#include .hpp> -#include appers.hpp> -#include port/is_async.hpp> -#include port/is_sync.hpp> +#include +#include +#include +#include +#include +#include +#include namespace boost { namespace network { @@ -46,13 +48,7 @@ struct header_value unsupported_tag >::type> {}; } // namespace traits - -} // namespace network - // namespace network - /* network */ - +} // namespace network } // namespace boost - // namespace boost - /* boost */ #endif // BOOST_NETWORK_MESSAGE_TRAITS_HEADERS_HPP_20100903 diff --git a/boost/network/message/traits/source.hpp b/boost/network/message/traits/source.hpp index 95b806e55..1400a1e18 100644 --- a/boost/network/message/traits/source.hpp +++ b/boost/network/message/traits/source.hpp @@ -6,14 +6,15 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include > -#include hpp> +#include +#include +#include +#include #include -#include /is_same.hpp> +#include namespace boost { namespace network { - namespace traits { template @@ -32,13 +33,7 @@ struct source unsupported_tag >::type> {}; } // namespace traits - } // namespace network - // namespace network - /* network */ - -} // namespace boost - // namespace boost - /* boost */ +} // namespace boost #endif // BOOST_NETWORK_MESSAGE_TRAITS_SOURCE_HPP_20100903 diff --git a/boost/network/message/transformers/selectors.hpp b/boost/network/message/transformers/selectors.hpp index eefb0f36c..d04acbd25 100644 --- a/boost/network/message/transformers/selectors.hpp +++ b/boost/network/message/transformers/selectors.hpp @@ -4,8 +4,8 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef __NETWORK_MESSAGE_TRANSFORMERS_SELECTORS_HPP__ -#define __NETWORK_MESSAGE_TRANSFORMERS_SELECTORS_HPP__ +#ifndef BOOST_NETWORK_MESSAGE_TRANSFORMERS_SELECTORS_HPP__ +#define BOOST_NETWORK_MESSAGE_TRANSFORMERS_SELECTORS_HPP__ namespace boost { namespace network { @@ -14,23 +14,24 @@ struct source_selector; struct destination_selector; } // namespace selectors -selectors::source_selector source_(selectors::source_selector /*unused*/ /*unused*/); -selectors::destination_selector destination_(selectors::destination_selector /*unused*/ /*unused*/); +selectors::source_selector source_(selectors::source_selector /*unused*/); +selectors::destination_selector destination_( + selectors::destination_selector /*unused*/); namespace selectors { struct source_selector { private: - source_selector() = default;default;; - source_selector(source_selector const & /*unused*/ /*unused*/) {}; - friend source_selector boost::network::source_(source_selector /*unused*/ /*unused*/); + source_selector() = default; + source_selector(source_selector const& /*unused*/) {}; + friend source_selector boost::network::source_(source_selector /*unused*/); }; struct destination_selector { private: - destination_selector() = default;default;; - destination_selector(destination_selector const & /*unused*/ /*unused*/) {}; + destination_selector() = default; + destination_selector(destination_selector const& /*unused*/) {}; friend destination_selector boost::network::destination_( - destination_selector /*unused*/ /*unused*/); + destination_selector /*unused*/); }; } // namespace selectors @@ -39,12 +40,13 @@ typedef selectors::source_selector (*source_selector_t)( typedef selectors::destination_selector (*destination_selector_t)( selectors::destination_selector); -inline selectors::source_selector source_(selectors::source_selector /*unused*/ /*unused*/) { +inline selectors::source_selector source_( + selectors::source_selector /*unused*/) { return selectors::source_selector(); } inline selectors::destination_selector destination_( - selectors::destination_selector /*unused*/ /*unused*/) { + selectors::destination_selector /*unused*/) { return selectors::destination_selector(); } @@ -52,4 +54,4 @@ inline selectors::destination_selector destination_( } // namespace boost -#endif // __NETWORK_MESSAGE_TRANSFORMERS_SELECTORS_HPP__ +#endif // BOOST_NETWORK_MESSAGE_TRANSFORMERS_SELECTORS_HPP__ diff --git a/boost/network/message/transformers/to_lower.hpp b/boost/network/message/transformers/to_lower.hpp index a53886c27..a5f9abdda 100644 --- a/boost/network/message/transformers/to_lower.hpp +++ b/boost/network/message/transformers/to_lower.hpp @@ -4,10 +4,12 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef __NETWORK_MESSAGE_TRANSFORMERS_TO_LOWER_HPP__ -#define __NETWORK_MESSAGE_TRANSFORMERS_TO_LOWER_HPP__ +#ifndef BOOST_NETWORK_MESSAGE_TRANSFORMERS_TO_LOWER_HPP__ +#define BOOST_NETWORK_MESSAGE_TRANSFORMERS_TO_LOWER_HPP__ #include +#include +#include /** to_lower.hpp * @@ -34,7 +36,7 @@ struct to_lower_transformer { } protected: - ~to_lower_transformer() = default;default; + ~to_lower_transformer() = default; }; template <> @@ -45,17 +47,17 @@ struct to_lower_transformer { } protected: - ~to_lower_transformer() = default;default;; + ~to_lower_transformer() = default; }; } // namespace impl namespace detail { struct to_lower_placeholder_helper; -} // namespace detail // namespace detail +} // namespace detail detail::to_lower_placeholder_helper to_lower_( - detail::to_lower_placeholder_helper /*unused*/ /*unused*/); + detail::to_lower_placeholder_helper /*unused*/); namespace detail { @@ -64,23 +66,22 @@ struct to_lower_placeholder_helper { struct type : public impl::to_lower_transformer {}; private: - to_lower_placeholder_helper() = default;default; - to_lower_placeholder_helper(to_lower_placeholder_helper const & /*unused*/ /*unused*/) {} + to_lower_placeholder_helper() = default; + to_lower_placeholder_helper(to_lower_placeholder_helper const & /*unused*/) {} friend to_lower_placeholder_helper boost::network::to_lower_( - to_lower_placeholder_helper /*unused*/ /*unused*/); + to_lower_placeholder_helper /*unused*/); }; -} // namespace detail // namespace detail +} // namespace detail typedef detail::to_lower_placeholder_helper (*to_lower_placeholder)( detail::to_lower_placeholder_helper); inline detail::to_lower_placeholder_helper to_lower_( - detail::to_lower_placeholder_helper /*unused*/ /*unused*/) { + detail::to_lower_placeholder_helper /*unused*/) { return detail::to_lower_placeholder_helper(); } } // namespace network - } // namespace boost -#endif // __NETWORK_MESSAGE_TRANSFORMERS_TO_LOWER_HPP__ +#endif // BOOST_NETWORK_MESSAGE_TRANSFORMERS_TO_LOWER_HPP__ diff --git a/boost/network/message/transformers/to_upper.hpp b/boost/network/message/transformers/to_upper.hpp index 111bba940..21850caa9 100644 --- a/boost/network/message/transformers/to_upper.hpp +++ b/boost/network/message/transformers/to_upper.hpp @@ -4,10 +4,12 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef __NETWORK_MESSAGE_TRANSFORMERS_TO_UPPER_HPP__ -#define __NETWORK_MESSAGE_TRANSFORMERS_TO_UPPER_HPP__ +#ifndef BOOST_NETWORK_MESSAGE_TRANSFORMERS_TO_UPPER_HPP__ +#define BOOST_NETWORK_MESSAGE_TRANSFORMERS_TO_UPPER_HPP__ #include +#include +#include /** to_upper.hpp * @@ -34,7 +36,7 @@ struct to_upper_transformer { } protected: - ~to_upper_transformer() = default;default;; + ~to_upper_transformer() = default; }; template <> @@ -45,17 +47,17 @@ struct to_upper_transformer { } protected: - ~to_upper_transformer() = default;default;; + ~to_upper_transformer() = default; }; } // namespace impl namespace detail { struct to_upper_placeholder_helper; -} // namespace detail // namespace detail +} // namespace detail detail::to_upper_placeholder_helper to_upper_( - detail::to_upper_placeholder_helper /*unused*/ /*unused*/); + detail::to_upper_placeholder_helper /*unused*/); namespace detail { @@ -64,18 +66,18 @@ struct to_upper_placeholder_helper { struct type : public impl::to_upper_transformer {}; private: - to_upper_placeholder_helper() = default;default; - to_upper_placeholder_helper(to_upper_placeholder_helper const & /*unused*/ /*unused*/) {} + to_upper_placeholder_helper() = default; + to_upper_placeholder_helper(to_upper_placeholder_helper const & /*unused*/) {} friend to_upper_placeholder_helper boost::network::to_upper_( - to_upper_placeholder_helper /*unused*/ /*unused*/); + to_upper_placeholder_helper /*unused*/); }; -} // namespace detail // namespace detail +} // namespace detail typedef detail::to_upper_placeholder_helper (*to_upper_placeholder)( detail::to_upper_placeholder_helper); inline detail::to_upper_placeholder_helper to_upper_( - detail::to_upper_placeholder_helper /*unused*/ /*unused*/) { + detail::to_upper_placeholder_helper /*unused*/) { return detail::to_upper_placeholder_helper(); } @@ -83,4 +85,4 @@ inline detail::to_upper_placeholder_helper to_upper_( } // namespace boost -#endif // __NETWORK_MESSAGE_TRANSFORMERS_TO_UPPER_HPP__ +#endif // BOOST_NETWORK_MESSAGE_TRANSFORMERS_TO_UPPER_HPP__ diff --git a/boost/network/message/wrappers/body.hpp b/boost/network/message/wrappers/body.hpp index dd128889f..71c706b31 100644 --- a/boost/network/message/wrappers/body.hpp +++ b/boost/network/message/wrappers/body.hpp @@ -4,11 +4,13 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef __NETWORK_MESSAGE_WRAPPERS_BODY_HPP__ -#define __NETWORK_MESSAGE_WRAPPERS_BODY_HPP__ +#ifndef BOOST_NETWORK_MESSAGE_WRAPPERS_BODY_HPP__ +#define BOOST_NETWORK_MESSAGE_WRAPPERS_BODY_HPP__ -#include e.hpp> -#include ude +#include +#include +#include +#include namespace boost { namespace network { @@ -71,7 +73,7 @@ struct body_wrapper_const }; template -inline std::ostream& operator<<(std::ostream& /*os*/*os*/, +inline std::ostream& operator<<(std::ostream& os, body_wrapper const& body) { os << static_cast::string_type>(body); return os; @@ -101,4 +103,4 @@ inline impl::body_wrapper_const const body( } // namespace boost -#endif // __NETWORK_MESSAGE_WRAPPERS_BODY_HPP__ +#endif // BOOST_NETWORK_MESSAGE_WRAPPERS_BODY_HPP__ diff --git a/boost/network/message/wrappers/headers.hpp b/boost/network/message/wrappers/headers.hpp index d47f21253..a8ae77bfb 100644 --- a/boost/network/message/wrappers/headers.hpp +++ b/boost/network/message/wrappers/headers.hpp @@ -4,13 +4,14 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef __NETWORK_MESSAGE_WRAPPERS_HEADERS_HPP__ -#define __NETWORK_MESSAGE_WRAPPERS_HEADERS_HPP__ +#ifndef BOOST_NETWORK_MESSAGE_WRAPPERS_HEADERS_HPP__ +#define BOOST_NETWORK_MESSAGE_WRAPPERS_HEADERS_HPP__ -#include tainer.hpp> -#include boost/range/iterator_range.hpp> +#include +#include #include #include +#include namespace boost { namespace network { @@ -59,12 +60,12 @@ struct headers_wrapper explicit headers_wrapper(basic_message const& message_) : wrapper_base(message_) {}; - range_type operator[](string_type /*unused*/ /*unused*/const& key) const { + range_type operator[](string_type const& key) const { return headers_wrapper::_message.headers().equal_range(key); }; typename message_type::headers_container_type::size_type count( - string_type /*unused*/ /*unused*/const& key) const { + string_type const& key) const { return headers_wrapper::_message.headers().count(key); }; @@ -97,4 +98,4 @@ inline impl::headers_wrapper headers(basic_message const& message_) { } // namespace boost -#endif // __NETWORK_MESSAGE_WRAPPERS_HEADERS_HPP__ +#endif // BOOST_NETWORK_MESSAGE_WRAPPERS_HEADERS_HPP__ diff --git a/boost/network/message_fwd.hpp b/boost/network/message_fwd.hpp index e2c0e4fd4..713d8f1fc 100644 --- a/boost/network/message_fwd.hpp +++ b/boost/network/message_fwd.hpp @@ -3,8 +3,8 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef __2008817MESSAGE_FWD_INC__ -#define __2008817MESSAGE_FWD_INC__ +#ifndef BOST_NETWORK_MESSAGE_FWD_HPP +#define BOST_NETWORK_MESSAGE_FWD_HPP namespace boost { namespace network { @@ -13,4 +13,6 @@ template struct basic_message; } // namespace networkk -} // namespace boostendif // __2008817MESSAGE_FWD_INC__ +} // namespace boost + +#endif // BOST_NETWORK_MESSAGE_FWD_HPP diff --git a/boost/network/protocol/http/client/connection/connection_delegate.hpp b/boost/network/protocol/http/client/connection/connection_delegate.hpp index 2dd573ed4..c03698867 100644 --- a/boost/network/protocol/http/client/connection/connection_delegate.hpp +++ b/boost/network/protocol/http/client/connection/connection_delegate.hpp @@ -7,13 +7,18 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include +#include +#include + namespace boost { namespace network { namespace http { namespace impl { struct connection_delegate { - virtual void connect(asio::ip::tcp::endpoint &endpoint, std::string host, boost::uint16_t source_port, + virtual void connect(asio::ip::tcp::endpoint &endpoint, std::string host, + boost::uint16_t source_port, function handler) = 0; virtual void write( asio::streambuf &command_streambuf, @@ -26,16 +31,9 @@ struct connection_delegate { }; } // namespace impl - /* impl */ - } // namespace http - /* http */ - -} // namespace network - /* network */ - -} // namespace boost - /* boost */ +} // namespace network +} // namespace boost #endif /* BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_CONNECTION_DELEGATE_HPP_ \ */ diff --git a/boost/network/protocol/http/client/connection/normal_delegate.hpp b/boost/network/protocol/http/client/connection/normal_delegate.hpp index f744c0fab..d4cea1786 100644 --- a/boost/network/protocol/http/client/connection/normal_delegate.hpp +++ b/boost/network/protocol/http/client/connection/normal_delegate.hpp @@ -7,9 +7,12 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include #include +#include #include -#include +#include +#include namespace boost { namespace network { @@ -19,8 +22,8 @@ namespace impl { struct normal_delegate : connection_delegate { explicit normal_delegate(asio::io_service &service); - virtual void connect(asio::ip::tcp::endpoint &endpoint, std::string host, boost::uint16_t source_port, - function handler); + void connect(asio::ip::tcp::endpoint &endpoint, std::string host, boost::uint16_t source_port, + function handler) override; void write( asio::streambuf &command_streambuf, function handler) override; @@ -32,27 +35,15 @@ struct normal_delegate : connection_delegate { private: asio::io_service &service_; - scoped_ptr socket_; + std::unique_ptr socket_; normal_delegate(normal_delegate const &); // = delete normal_delegate &operator=(normal_delegate); // = delete }; } // namespace impl - /* impl */ - } // namespace http - /* http */ - } // namespace network - /* network */ - } // namespace boost - /* boost */ - -#ifdef BOOST_NETWORK_NO_LIB -#include -#endif /* BOOST_NETWORK_NO_LIB */ -#endif /* BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_NORMAL_DELEGATE_20110819 \ - */ +#endif // BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_NORMAL_DELEGATE_20110819 diff --git a/boost/network/protocol/http/client/connection/normal_delegate.ipp b/boost/network/protocol/http/client/connection/normal_delegate.ipp index ae52fd870..bec14c68b 100644 --- a/boost/network/protocol/http/client/connection/normal_delegate.ipp +++ b/boost/network/protocol/http/client/connection/normal_delegate.ipp @@ -19,13 +19,16 @@ boost::network::http::impl::normal_delegate::normal_delegate( : service_(service) {} void boost::network::http::impl::normal_delegate::connect( - asio::ip::tcp::endpoint &endpoint, std::string host, boost::uint16_t source_port, + asio::ip::tcp::endpoint &endpoint, std::string host, + boost::uint16_t source_port, function handler) { // TODO(dberris): review parameter necessity. (void)host; - - socket_.reset(new asio::ip::tcp::socket(service_, asio::ip::tcp::endpoint(asio::ip::tcp::v4(), source_port))); + + socket_.reset(new asio::ip::tcp::socket( + service_, + asio::ip::tcp::endpoint(asio::ip::address(), source_port))); socket_->async_connect(endpoint, handler); } @@ -53,5 +56,4 @@ void boost::network::http::impl::normal_delegate::disconnect() { boost::network::http::impl::normal_delegate::~normal_delegate() {} -#endif /* BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_NORMAL_DELEGATE_IPP_20110819 \ - */ +#endif // BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_NORMAL_DELEGATE_IPP_20110819 diff --git a/boost/network/protocol/http/client/connection/ssl_delegate.hpp b/boost/network/protocol/http/client/connection/ssl_delegate.hpp index 942837797..d084befb5 100644 --- a/boost/network/protocol/http/client/connection/ssl_delegate.hpp +++ b/boost/network/protocol/http/client/connection/ssl_delegate.hpp @@ -14,6 +14,7 @@ #include #include #include +#include namespace boost { namespace network { @@ -29,14 +30,15 @@ struct ssl_delegate : connection_delegate, optional private_key_file, optional ciphers, long ssl_options); - virtual void connect(asio::ip::tcp::endpoint &endpoint, std::string host, boost::uint16_t source_port, - function handler); - void write( - asio::streambuf &command_streambuf, - function handler) override; - void read_some( - asio::mutable_buffers_1 const &read_buffer, - function handler) override; + void connect(asio::ip::tcp::endpoint &endpoint, std::string host, + boost::uint16_t source_port, + function handler) override; + void write(asio::streambuf &command_streambuf, + function handler) + override; + void read_some(asio::mutable_buffers_1 const &read_buffer, + function handler) + override; void disconnect() override; ~ssl_delegate() override; @@ -48,9 +50,9 @@ struct ssl_delegate : connection_delegate, optional private_key_file_; optional ciphers_; long ssl_options_; - scoped_ptr context_; - scoped_ptr tcp_socket_; - scoped_ptr > socket_; + std::unique_ptr context_; + std::unique_ptr tcp_socket_; + std::unique_ptr > socket_; bool always_verify_peer_; ssl_delegate(ssl_delegate const &); // = delete @@ -61,16 +63,9 @@ struct ssl_delegate : connection_delegate, }; } // namespace impl - /* impl */ - -} // namespace http - /* http */ - -} // namespace network - /* network */ - +} // namespace http +} // namespace network } // namespace boost - /* boost */ #ifdef BOOST_NETWORK_NO_LIB #include diff --git a/boost/network/protocol/http/message/modifiers/destination.hpp b/boost/network/protocol/http/message/modifiers/destination.hpp index 50fd9128f..10d7a6b24 100644 --- a/boost/network/protocol/http/message/modifiers/destination.hpp +++ b/boost/network/protocol/http/message/modifiers/destination.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include namespace boost { diff --git a/boost/network/protocol/http/tags.hpp b/boost/network/protocol/http/tags.hpp index fcf67a1ae..2517f262c 100644 --- a/boost/network/protocol/http/tags.hpp +++ b/boost/network/protocol/http/tags.hpp @@ -6,7 +6,11 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include space boost { +#include +#include +#include + +namespace boost { namespace network { namespace http { namespace tags { @@ -27,27 +31,37 @@ struct client { typedef mpl::true_::type is_client; }; -using namespace boost::network::tags; - template struct components; -typedef mpl::vector - http_default_8bit_tcp_resolve_tags; -typedef mpl::vector - http_default_8bit_udp_resolve_tags; -typedef mpl::vector +typedef mpl::vector< + http, client, simple, boost::network::tags::sync, boost::network::tags::tcp, + boost::network::tags::default_string> http_default_8bit_tcp_resolve_tags; +typedef mpl::vector< + http, client, simple, boost::network::tags::sync, boost::network::tags::udp, + boost::network::tags::default_string> http_default_8bit_udp_resolve_tags; +typedef mpl::vector http_keepalive_8bit_tcp_resolve_tags; -typedef mpl::vector +typedef mpl::vector http_keepalive_8bit_udp_resolve_tags; -typedef mpl::vector +typedef mpl::vector http_async_8bit_udp_resolve_tags; -typedef mpl::vector +typedef mpl::vector http_async_8bit_tcp_resolve_tags; -typedef mpl::vector - http_server_tags; -typedef mpl::vector - http_async_server_tags; +typedef mpl::vector< + http, simple, boost::network::tags::sync, boost::network::tags::pod, + boost::network::tags::default_string, server> http_server_tags; +typedef mpl::vector< + http, simple, boost::network::tags::async, boost::network::tags::pod, + boost::network::tags::default_string, server> http_async_server_tags; BOOST_NETWORK_DEFINE_TAG(http_default_8bit_tcp_resolve); BOOST_NETWORK_DEFINE_TAG(http_default_8bit_udp_resolve); @@ -59,19 +73,8 @@ BOOST_NETWORK_DEFINE_TAG(http_server); BOOST_NETWORK_DEFINE_TAG(http_async_server); } // namespace tags - // namespace tags - /* tags */ - } // namespace http - // namespace http - /* http */ - -} // namespace network - // namespace network - /* network */ - +} // namespace network } // namespace boost - // namespace boost - /* boost */ -#endif /* BOOST_NETWORK_PROTOCOL_HTTP_TAGS_HPP_20101019 */ +#endif // BOOST_NETWORK_PROTOCOL_HTTP_TAGS_HPP_20101019 diff --git a/boost/network/support/is_async.hpp b/boost/network/support/is_async.hpp index c4b59c44c..316af5533 100644 --- a/boost/network/support/is_async.hpp +++ b/boost/network/support/is_async.hpp @@ -7,8 +7,11 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include s_sync.hpp> -#include espace boost { +#include +#include +#include + +namespace boost { namespace network { template @@ -19,7 +22,6 @@ struct is_async< Tag, typename enable_if::type> : mpl::true_ {}; } // namespace network - } // namespace boost #endif // BOOST_NETWORK_SUPPORT_IS_ASYNC_HPP_2010608 diff --git a/boost/network/support/is_default_wstring.hpp b/boost/network/support/is_default_wstring.hpp index 6058b26c7..d6d0ee8d4 100644 --- a/boost/network/support/is_default_wstring.hpp +++ b/boost/network/support/is_default_wstring.hpp @@ -7,7 +7,6 @@ #define BOOST_NETWORK_SUPPORT_WSTRING_CHECK_20100808 #include -#include stream.hpp> namespace boost { namespace network { @@ -21,7 +20,6 @@ struct is_default_wstring< typename enable_if::type> : mpl::true_ {}; } // namespace network - } // namespace boost -#endif // BOOST_NETWORK_SUPPORT_STRING_CHECK_20100808 +#endif // BOOST_NETWORK_SUPPORT_WSTRING_CHECK_20100808 diff --git a/boost/network/support/pod_or_normal.hpp b/boost/network/support/pod_or_normal.hpp index 739505d4f..3be2833a3 100644 --- a/boost/network/support/pod_or_normal.hpp +++ b/boost/network/support/pod_or_normal.hpp @@ -8,7 +8,7 @@ #include #include -#include s.hpp> +#include namespace boost { namespace network { @@ -23,11 +23,6 @@ struct pod_or_normal< Tag, typename enable_if::type> : tags::pod {}; } // namespace network - // namespace network - /* network */ - } // namespace boost - // namespace boost - /* boost */ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_SUPPORT_POD_OR_NORMAL_HPP_20101128 */ diff --git a/boost/network/traits/headers_container.hpp b/boost/network/traits/headers_container.hpp index 9d995e483..3a0e7c231 100644 --- a/boost/network/traits/headers_container.hpp +++ b/boost/network/traits/headers_container.hpp @@ -8,9 +8,12 @@ #ifndef BOOST_NETWORK_TRAITS_HEADERS_CONTAINER_INC #define BOOST_NETWORK_TRAITS_HEADERS_CONTAINER_INC -#include t/network/tags.hpp> -#include ring.hpp> -#include e network { +#include +#include +#include + +namespace boost { +namespace network { namespace impl { template diff --git a/boost/network/traits/ostringstream.hpp b/boost/network/traits/ostringstream.hpp index d20b75257..b4a0c10b9 100644 --- a/boost/network/traits/ostringstream.hpp +++ b/boost/network/traits/ostringstream.hpp @@ -7,10 +7,13 @@ #ifndef BOOST_NETWORK_TRAITS_OSTRINGSTREAM_INC #define BOOST_NETWORK_TRAITS_OSTRINGSTREAM_INC -#include l/if.hpp> -#include s_default_string.hpp> -#include port/is_default_wstring.hpp> -#include { +#include +#include +#include +#include + +namespace boost { +namespace network { template struct unsupported_tag; @@ -31,7 +34,6 @@ struct ostringstream >::type> { }; } // namespace network - } // namespace boost #endif // BOOST_NETWORK_TRAITS_OSTRINGSTREAM_INC diff --git a/boost/network/traits/string.hpp b/boost/network/traits/string.hpp index aaf324672..178ffb9bb 100644 --- a/boost/network/traits/string.hpp +++ b/boost/network/traits/string.hpp @@ -7,10 +7,9 @@ #ifndef BOOST_NETWORK_TRAITS_STRING_INC #define BOOST_NETWORK_TRAITS_STRING_INC -#include etwork/tags.hpp> -#include -#include +#include #include +#include #ifndef BOOST_NETWORK_DEFAULT_STRING #define BOOST_NETWORK_DEFAULT_STRING std::string @@ -42,7 +41,6 @@ struct string >::type> { }; } // namespace network - } // namespace boost #endif // BOOST_NETWORK_TRAITS_STRING_INC diff --git a/boost/network/uri/accessors.hpp b/boost/network/uri/accessors.hpp index 24ce274cc..32148b5f8 100644 --- a/boost/network/uri/accessors.hpp +++ b/boost/network/uri/accessors.hpp @@ -3,8 +3,8 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef __BOOST_NETWORK_URI_URI_ACCESSORS_INC__ -#define __BOOST_NETWORK_URI_URI_ACCESSORS_INC__ +#ifndef BOOST_NETWORK_URI_URI_ACCESSORS_INC__ +#define BOOST_NETWORK_URI_URI_ACCESSORS_INC__ #include #include @@ -22,7 +22,7 @@ struct key_value_sequence : spirit::qi::grammar { typedef typename Map::mapped_type mapped_type; typedef std::pair pair_type; - key_value_sequence() : key_value_sequence::base_type(query) = default; + key_value_sequence() : key_value_sequence::base_type(query) {}; spirit::qi::rule query; spirit::qi::rule pair; @@ -86,4 +86,4 @@ inline uri::string_type decoded_fragment(const uri &uri_) { } // namespace network } // namespace boost -#endif // __BOOST_NETWORK_URI_URI_ACCESSORS_INC__ +#endif // BOOST_NETWORK_URI_URI_ACCESSORS_INC__ diff --git a/boost/network/uri/decode.hpp b/boost/network/uri/decode.hpp index 609171fbf..909e7d7d9 100644 --- a/boost/network/uri/decode.hpp +++ b/boost/network/uri/decode.hpp @@ -11,6 +11,7 @@ #include #include #include +#include namespace boost { namespace network { @@ -59,9 +60,9 @@ OutputIterator decode(const InputIterator &in_begin, OutputIterator out = out_begin; while (it != in_end) { if (*it == '%') { - if (++it == in_end) throw std::out_of_range("unexpected end of stream"); + if (++it == in_end) throw std::out_of_range("unexpected end of stream"); value_type v0 = detail::letter_to_hex(*it); - if (++it == in_end) throw std::out_of_range("unexpected end of stream"); + if (++it == in_end) throw std::out_of_range("unexpected end of stream"); value_type v1 = detail::letter_to_hex(*it); ++it; *out++ = 0x10 * v0 + v1; @@ -81,11 +82,12 @@ inline OutputIterator decode(const SinglePassRange &range, return decode(boost::begin(range), boost::end(range), out); } -inline std::string decoded(const std::string & /*input*/) { +inline std::string decoded(const std::string &input) { std::string decoded; decode(input, std::back_inserter(decoded)); return decoded; } + } // namespace uri } // namespace network } // namespace boost diff --git a/boost/network/uri/directives/authority.hpp b/boost/network/uri/directives/authority.hpp index fec926078..85f6e04ee 100644 --- a/boost/network/uri/directives/authority.hpp +++ b/boost/network/uri/directives/authority.hpp @@ -3,23 +3,26 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef __BOOST_NETWORK_URI_DIRECTIVES_AUTHORITY_INC__ -#define __BOOST_NETWORK_URI_DIRECTIVES_AUTHORITY_INC__ +#ifndef BOOST_NETWORK_URI_DIRECTIVES_AUTHORITY_INC__ +#define BOOST_NETWORK_URI_DIRECTIVES_AUTHORITY_INC__ + +#include namespace boost { namespace network { namespace uri { + struct authority_directive { - explicit authority_directive(const std::string & /*authority*/) - : authority(authority) {} + explicit authority_directive(const std::string &authority) + : authority_(authority) {} template void operator()(Uri &uri) const { - uri.append(authority); + uri.append(authority_); } - std::string authority; + std::string authority_; }; inline authority_directive authority(const std::string &authority) { @@ -29,4 +32,4 @@ inline authority_directive authority(const std::string &authority) { } // namespace network } // namespace boost -#endif // __BOOST_NETWORK_URI_DIRECTIVES_AUTHORITY_INC__ +#endif // BOOST_NETWORK_URI_DIRECTIVES_AUTHORITY_INC__ diff --git a/boost/network/uri/directives/fragment.hpp b/boost/network/uri/directives/fragment.hpp index d74bd770d..24f35580d 100644 --- a/boost/network/uri/directives/fragment.hpp +++ b/boost/network/uri/directives/fragment.hpp @@ -3,28 +3,29 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef __BOOST_NETWORK_URI_DIRECTIVES_FRAGMENT_INC__ -#define __BOOST_NETWORK_URI_DIRECTIVES_FRAGMENT_INC__ +#ifndef BOOST_NETWORK_URI_DIRECTIVES_FRAGMENT_INC__ +#define BOOST_NETWORK_URI_DIRECTIVES_FRAGMENT_INC__ #include #include #include +#include namespace boost { namespace network { namespace uri { struct fragment_directive { - explicit fragment_directive(const std::string & /*fragment*/) - : fragment(fragment) {} + explicit fragment_directive(const std::string &fragment) + : fragment_(fragment) {} template void operator()(Uri &uri) const { uri.append("#"); - uri.append(fragment); + uri.append(fragment_); } - std::string fragment; + std::string fragment_; }; inline fragment_directive fragment(const std::string &fragment) { @@ -34,4 +35,4 @@ inline fragment_directive fragment(const std::string &fragment) { } // namespace network } // namespace boost -#endif // __BOOST_NETWORK_URI_DIRECTIVES_FRAGMENT_INC__ +#endif // BOOST_NETWORK_URI_DIRECTIVES_FRAGMENT_INC__ diff --git a/boost/network/uri/directives/host.hpp b/boost/network/uri/directives/host.hpp index 59b76d4b8..b9696c2a5 100644 --- a/boost/network/uri/directives/host.hpp +++ b/boost/network/uri/directives/host.hpp @@ -3,25 +3,26 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef __BOOST_NETWORK_URI_DIRECTIVES_HOST_INC__ -#define __BOOST_NETWORK_URI_DIRECTIVES_HOST_INC__ +#ifndef BOOST_NETWORK_URI_DIRECTIVES_HOST_INC__ +#define BOOST_NETWORK_URI_DIRECTIVES_HOST_INC__ #include #include +#include namespace boost { namespace network { namespace uri { struct host_directive { - explicit host_directive(const std::string & /*host*/) : host(host) {} + explicit host_directive(const std::string & host) : host_(host) {} template void operator()(Uri &uri) const { - uri.append(host); + uri.append(host_); } - std::string host; + std::string host_; }; inline host_directive host(const std::string &host) { @@ -31,4 +32,4 @@ inline host_directive host(const std::string &host) { } // namespace network } // namespace boost -#endif // __BOOST_NETWORK_URI_DIRECTIVES_HOST_INC__ +#endif // BOOST_NETWORK_URI_DIRECTIVES_HOST_INC__ diff --git a/boost/network/uri/directives/path.hpp b/boost/network/uri/directives/path.hpp index 96b546bc6..dc99a849c 100644 --- a/boost/network/uri/directives/path.hpp +++ b/boost/network/uri/directives/path.hpp @@ -6,44 +6,47 @@ #ifndef __BOOST_NETWORK_URI_DIRECTIVES_PATH_INC__ #define __BOOST_NETWORK_URI_DIRECTIVES_PATH_INC__ +#include #include #include +#include namespace boost { namespace network { namespace uri { struct path_directive { - explicit path_directive(const std::string & /*path*/) : path(path) {} + explicit path_directive(const std::string &path) : path_(path) {} template void operator()(Uri &uri) const { - uri.append(path); + uri.append(path_); } - std::string path; + std::string path_; }; struct encoded_path_directive { - explicit encoded_path_directive(const std::string & /*path*/) : path(path) {} + explicit encoded_path_directive(const std::string & path) : path_(path) {} void operator()(uri &uri_) const { std::string encoded_path; - encode(path, std::back_inserter(encoded_path)); + encode(path_, std::back_inserter(encoded_path)); uri_.append(encoded_path); } - std::string path; + std::string path_; }; inline path_directive path(const std::string &path) { return path_directive(path); } -inline encoded_path_directive encoded_path(const std::string & /*path*/) { +inline encoded_path_directive encoded_path(const std::string &path) { return encoded_path_directive(path); } + } // namespace uri } // namespace network } // namespace boost diff --git a/boost/network/uri/directives/port.hpp b/boost/network/uri/directives/port.hpp index bc589d3dd..62627aa84 100644 --- a/boost/network/uri/directives/port.hpp +++ b/boost/network/uri/directives/port.hpp @@ -3,8 +3,8 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef __BOOST_NETWORK_URI_DIRECTIVES_PORT_INC__ -#define __BOOST_NETWORK_URI_DIRECTIVES_PORT_INC__ +#ifndef BOOST_NETWORK_URI_DIRECTIVES_PORT_INC__ +#define BOOST_NETWORK_URI_DIRECTIVES_PORT_INC__ #include #include @@ -16,18 +16,18 @@ namespace network { namespace uri { struct port_directive { - explicit port_directive(const std::string & /*port*/) : port(port) {} + explicit port_directive(const std::string &port) : port_(port) {} - explicit port_directive(boost::uint16_t /*port*/) - : port(boost::lexical_cast(port)) {} + explicit port_directive(boost::uint16_t port) + : port_(boost::lexical_cast(port)) {} template void operator()(Uri &uri) const { uri.append(":"); - uri.append(port); + uri.append(port_); } - std::string port; + std::string port_; }; inline port_directive port(const std::string &port) { @@ -37,8 +37,9 @@ inline port_directive port(const std::string &port) { inline port_directive port(boost::uint16_t port) { return port_directive(port); } + } // namespace uri } // namespace network } // namespace boost -#endif // __BOOST_NETWORK_URI_DIRECTIVES_PORT_INC__ +#endif // BOOST_NETWORK_URI_DIRECTIVES_PORT_INC__ diff --git a/boost/network/uri/directives/query.hpp b/boost/network/uri/directives/query.hpp index a8cf3f3d7..02dbfb825 100644 --- a/boost/network/uri/directives/query.hpp +++ b/boost/network/uri/directives/query.hpp @@ -3,27 +3,29 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef __BOOST_NETWORK_URI_DIRECTIVES_QUERY_INC__ -#define __BOOST_NETWORK_URI_DIRECTIVES_QUERY_INC__ +#ifndef BOOST_NETWORK_URI_DIRECTIVES_QUERY_INC__ +#define BOOST_NETWORK_URI_DIRECTIVES_QUERY_INC__ #include #include #include +#include +#include namespace boost { namespace network { namespace uri { struct query_directive { - explicit query_directive(const std::string & /*query*/) : query(query) {} + explicit query_directive(const std::string & query) : query_(query) {} template void operator()(Uri &uri) const { uri.append("?"); - uri.append(query); + uri.append(query_); } - std::string query; + std::string query_; }; inline query_directive query(const std::string &query) { @@ -32,8 +34,8 @@ inline query_directive query(const std::string &query) { struct query_key_query_directive { - query_key_query_directive(const std::string & /*key*/, const std::string & /*query*/) - : key(key), query(query) {} + query_key_query_directive(const std::string & key, const std::string & query) + : key_(key), query_(query) {} template void operator()(Uri &uri) const { @@ -43,13 +45,13 @@ struct query_key_query_directive { } else { uri.append("&"); } - uri.append(key); + uri.append(key_); uri.append("="); - uri.append(query); + uri.append(query_); } - std::string key; - std::string query; + std::string key_; + std::string query_; }; inline query_key_query_directive query(const std::string &key, @@ -60,4 +62,4 @@ inline query_key_query_directive query(const std::string &key, } // namespace network } // namespace boost -#endif // __BOOST_NETWORK_URI_DIRECTIVES_QUERY_INC__ +#endif // BOOST_NETWORK_URI_DIRECTIVES_QUERY_INC__ diff --git a/boost/network/uri/directives/scheme.hpp b/boost/network/uri/directives/scheme.hpp index a96323855..d62c1a9e6 100644 --- a/boost/network/uri/directives/scheme.hpp +++ b/boost/network/uri/directives/scheme.hpp @@ -9,13 +9,14 @@ #include #include #include +#include namespace boost { namespace network { namespace uri { struct scheme_directive { - explicit scheme_directive(const std::string & /*scheme*/) : scheme(scheme) {} + explicit scheme_directive(const std::string &scheme) : scheme(scheme) {} template void operator()(Uri &uri) const { diff --git a/boost/network/uri/directives/user_info.hpp b/boost/network/uri/directives/user_info.hpp index 77eb6f341..771890763 100644 --- a/boost/network/uri/directives/user_info.hpp +++ b/boost/network/uri/directives/user_info.hpp @@ -3,27 +3,28 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef __BOOST_NETWORK_URI_DIRECTIVES_USER_INFO_INC__ -#define __BOOST_NETWORK_URI_DIRECTIVES_USER_INFO_INC__ +#ifndef BOOST_NETWORK_URI_DIRECTIVES_USER_INFO_INC__ +#define BOOST_NETWORK_URI_DIRECTIVES_USER_INFO_INC__ #include #include +#include namespace boost { namespace network { namespace uri { struct user_info_directive { - explicit user_info_directive(const std::string & /*user_info*/) - : user_info(user_info) {} + explicit user_info_directive(const std::string &user_info) + : user_info_(user_info) {} template void operator()(Uri &uri) const { - uri.append(user_info); + uri.append(user_info_); uri.append("@"); } - std::string user_info; + std::string user_info_; }; inline user_info_directive user_info(const std::string &user_info) { @@ -33,4 +34,4 @@ inline user_info_directive user_info(const std::string &user_info) { } // namespace network } // namespace boost -#endif // __BOOST_NETWORK_URI_DIRECTIVES_USER_INFO_INC__ +#endif // BOOST_NETWORK_URI_DIRECTIVES_USER_INFO_INC__ diff --git a/boost/network/uri/encode.hpp b/boost/network/uri/encode.hpp index cbd077646..baf91841c 100644 --- a/boost/network/uri/encode.hpp +++ b/boost/network/uri/encode.hpp @@ -11,11 +11,13 @@ #include #include #include +#include namespace boost { namespace network { namespace uri { namespace detail { + template inline CharT hex_to_letter(CharT in) { switch (in) { @@ -141,11 +143,12 @@ inline OutputIterator encode(const SinglePassRange &range, return encode(boost::begin(range), boost::end(range), out); } -inline std::string encoded(const std::string & /*input*/) { +inline std::string encoded(const std::string &input) { std::string encoded; encode(input, std::back_inserter(encoded)); return encoded; } + } // namespace uri } // namespace network } // namespace boost diff --git a/boost/network/utils/thread_pool.hpp b/boost/network/utils/thread_pool.hpp index 34e06fefb..2b0202352 100644 --- a/boost/network/utils/thread_pool.hpp +++ b/boost/network/utils/thread_pool.hpp @@ -6,13 +6,13 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include -#include -#include -#include -#include #include +#include +#include #include +#include +#include +#include namespace boost { namespace network { @@ -24,9 +24,16 @@ typedef boost::shared_ptr sentinel_ptr; template struct basic_thread_pool { - explicit basic_thread_pool(std::size_t /*threads*/, - io_service_ptr /*io_service*/ io_service_ptr(), - worker_threads_ptr /*worker_threads*/ worker_threads_ptr()) + basic_thread_pool(basic_thread_pool const &) = delete; + basic_thread_pool &operator=(basic_thread_pool) = delete; + basic_thread_pool(basic_thread_pool&&) noexcept = default; + basic_thread_pool &operator=(basic_thread_pool&&) = default; + + basic_thread_pool() : basic_thread_pool(1) {} + + explicit basic_thread_pool(std::size_t threads, + io_service_ptr io_service = io_service_ptr(), + worker_threads_ptr worker_threads = worker_threads_ptr()) : threads_(threads), io_service_(io_service), worker_threads_(worker_threads), @@ -67,7 +74,7 @@ struct basic_thread_pool { std::size_t thread_count() const { return threads_; } - void post(boost::function /*f*/) { io_service_->post(f); } + void post(boost::function f) { io_service_->post(f); } ~basic_thread_pool() throw() { sentinel_.reset(); @@ -81,10 +88,11 @@ struct basic_thread_pool { } void swap(basic_thread_pool &other) { - std::swap(other.threads_, threads_); - std::swap(other.io_service_, io_service_); - std::swap(other.worker_threads_, worker_threads_); - std::swap(other.sentinel_, sentinel_); + using std::swap; + swap(other.threads_, threads_); + swap(other.io_service_, io_service_); + swap(other.worker_threads_, worker_threads_); + swap(other.sentinel_, sentinel_); } protected: @@ -93,21 +101,17 @@ struct basic_thread_pool { worker_threads_ptr worker_threads_; sentinel_ptr sentinel_; - private: - basic_thread_pool(basic_thread_pool const &); // no copies please - basic_thread_pool &operator=(basic_thread_pool); // no assignment - // please }; +template +void swap(basic_thread_pool &a, basic_thread_pool &b) { + a.swap(b); +} + typedef basic_thread_pool thread_pool; } // namespace utils - /* utils */ - } // namespace network - /* network */ - } // namespace boost - /* boost */ #endif /* BOOST_NETWORK_UTILS_THREAD_POOL_HPP_20101020 */ From 5f6e9ee6b8d6eae143a6664da21b06e2c6f65c2c Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Sun, 1 Nov 2015 01:13:32 +1100 Subject: [PATCH 015/123] Changes to make things build --- boost/network.hpp | 6 +- boost/network/detail/debug.hpp | 2 +- .../protocol/http/algorithms/linearize.hpp | 383 +++++++++--------- .../protocol/http/client/async_impl.hpp | 12 +- .../http/client/connection/async_base.hpp | 11 +- .../http/client/connection/async_normal.hpp | 183 ++++----- .../connection/async_protocol_handler.hpp | 39 +- .../connection_delegate_factory.hpp | 9 +- boost/network/protocol/http/client/facade.hpp | 15 +- .../network/protocol/http/client/options.hpp | 29 +- boost/network/protocol/http/client/pimpl.hpp | 14 +- .../protocol/http/client/sync_impl.hpp | 25 +- boost/network/protocol/http/impl/request.hpp | 20 +- boost/network/protocol/http/impl/response.ipp | 4 +- .../http/message/modifiers/clear_headers.hpp | 15 +- .../http/message/modifiers/destination.hpp | 12 +- .../http/message/traits/status_message.hpp | 6 +- .../http/message/wrappers/destination.hpp | 5 +- .../protocol/http/message/wrappers/helper.hpp | 6 +- .../http/message/wrappers/status_message.hpp | 5 +- .../protocol/http/policies/async_resolver.hpp | 13 +- .../http/policies/simple_connection.hpp | 1 - .../protocol/http/support/sync_only.hpp | 11 +- boost/network/protocol/http/traits/vector.hpp | 39 -- boost/network/support/is_default_string.hpp | 1 - boost/network/uri/uri.hpp | 8 +- 26 files changed, 414 insertions(+), 460 deletions(-) delete mode 100644 boost/network/protocol/http/traits/vector.hpp diff --git a/boost/network.hpp b/boost/network.hpp index 793998941..552cbdc82 100644 --- a/boost/network.hpp +++ b/boost/network.hpp @@ -4,8 +4,8 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef __NETWORK_HPP__ -#define __NETWORK_HPP__ +#ifndef BOOST_NETWORK_HPP__ +#define BOOST_NETWORK_HPP__ // Include all headers in network/ // Author: Dean Michael Berris @@ -14,4 +14,4 @@ #include // message type implementation #include // protocols implementation -#endif // __NETWORK_HPP__ +#endif // BOOST_NETWORK_HPP__ diff --git a/boost/network/detail/debug.hpp b/boost/network/detail/debug.hpp index df77a7625..093ca551c 100644 --- a/boost/network/detail/debug.hpp +++ b/boost/network/detail/debug.hpp @@ -15,7 +15,7 @@ #include #ifndef BOOST_NETWORK_MESSAGE #define BOOST_NETWORK_MESSAGE(msg) \ - std::cerr << "[DEBUG " << __FILE__ << ':' << __LINE__ << "]: " << (msg) \ + std::cerr << "[DEBUG " << __FILE__ << ':' << __LINE__ << "]: " << msg \ << std::endl; #endif #else diff --git a/boost/network/protocol/http/algorithms/linearize.hpp b/boost/network/protocol/http/algorithms/linearize.hpp index c37e221bf..aae25aa05 100644 --- a/boost/network/protocol/http/algorithms/linearize.hpp +++ b/boost/network/protocol/http/algorithms/linearize.hpp @@ -1,196 +1,193 @@ -#ifndef BOOST_NETWORK_PROTOCOL_HTTP_ALGORITHMS_LINEARIZE_HPP_20101028 -#define BOOST_NETWORK_PROTOCOL_HTTP_ALGORITHMS_LINEARIZE_HPP_20101028 - -// Copyright 2010 Dean Michael Berris. -// Copyright 2014 Jussi Lyytinen -// 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) - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace boost { -namespace network { -namespace http { - -template -struct linearize_header { - typedef typename string::type string_type; - - template - struct result; - - template - struct result { - typedef string_type type; - }; - - template - BOOST_CONCEPT_REQUIRES(((Header::type>)), - (string_type)) - operator()(ValueType& header) { - typedef typename ostringstream::type output_stream; - typedef constants consts; - output_stream header_line; - header_line << name(header) << consts::colon() << consts::space() - << value(header) << consts::crlf(); - return header_line.str(); - } -}; - -template -BOOST_CONCEPT_REQUIRES(((ClientRequest)), (OutputIterator)) - linearize(Request const& request, - typename Request::string_type const& method, - unsigned version_major, unsigned version_minor, - OutputIterator oi) { - typedef typename Request::tag Tag; - typedef constants consts; - typedef typename string::type string_type; - static string_type http_slash = consts::http_slash(), - accept = consts::accept(), - accept_mime = consts::default_accept_mime(), - accept_encoding = consts::accept_encoding(), - default_accept_encoding = - consts::default_accept_encoding(), - crlf = consts::crlf(), host = consts::host(), - connection = consts::connection(), close = consts::close(); - boost::copy(method, oi); - *oi = consts::space_char(); - if (request.path().empty() || request.path()[0] != consts::slash_char()) { +#ifndef BOOST_NETWORK_PROTOCOL_HTTP_ALGORITHMS_LINEARIZE_HPP_20101028 +#define BOOST_NETWORK_PROTOCOL_HTTP_ALGORITHMS_LINEARIZE_HPP_20101028 + +// Copyright 2010 Dean Michael Berris. +// Copyright 2014 Jussi Lyytinen +// 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) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace network { +namespace http { + +template +struct linearize_header { + typedef typename string::type string_type; + + template + struct result; + + template + struct result { + typedef string_type type; + }; + + template + BOOST_CONCEPT_REQUIRES(((Header::type>)), + (string_type)) + operator()(ValueType& header) { + typedef typename ostringstream::type output_stream; + typedef constants consts; + output_stream header_line; + header_line << name(header) << consts::colon() << consts::space() + << value(header) << consts::crlf(); + return header_line.str(); + } +}; + +template +BOOST_CONCEPT_REQUIRES(((ClientRequest)), (OutputIterator)) + linearize(Request const& request, + typename Request::string_type const& method, + unsigned version_major, unsigned version_minor, + OutputIterator oi) { + typedef typename Request::tag Tag; + typedef constants consts; + typedef typename string::type string_type; + static string_type http_slash = consts::http_slash(), + accept = consts::accept(), + accept_mime = consts::default_accept_mime(), + accept_encoding = consts::accept_encoding(), + default_accept_encoding = + consts::default_accept_encoding(), + crlf = consts::crlf(), host = consts::host(), + connection = consts::connection(), close = consts::close(); + boost::copy(method, oi); + *oi = consts::space_char(); + if (request.path().empty() || request.path()[0] != consts::slash_char()) { *oi = consts::slash_char(); -} - boost::copy(request.path(), oi); - if (!request.query().empty()) { - *oi = consts::question_mark_char(); - boost::copy(request.query(), oi); - } - if (!request.anchor().empty()) { - *oi = consts::hash_char(); - boost::copy(request.anchor(), oi); - } - *oi = consts::space_char(); - boost::copy(http_slash, oi); - string_type version_major_str = - boost::lexical_cast(version_major), - version_minor_str = - boost::lexical_cast(version_minor); - boost::copy(version_major_str, oi); - *oi = consts::dot_char(); - boost::copy(version_minor_str, oi); - boost::copy(crlf, oi); - - // We need to determine whether we've seen any of the following headers - // before setting the defaults. We use a bitset to keep track of the - // defaulted headers. - enum { - ACCEPT, - ACCEPT_ENCODING, - HOST, - CONNECTION, - MAX - }; - std::bitset found_headers; - static char const* defaulted_headers[][2] = { - {consts::accept(), consts::accept() + std::strlen(consts::accept())}, - {consts::accept_encoding(), - consts::accept_encoding() + std::strlen(consts::accept_encoding())}, - {consts::host(), consts::host() + std::strlen(consts::host())}, - {consts::connection(), - consts::connection() + std::strlen(consts::connection())}}; - - typedef typename headers_range::type headers_range; - typedef typename range_value::type headers_value; - BOOST_FOREACH(const headers_value & header, headers(request)) { - string_type header_name = name(header), header_value = value(header); - // Here we check that we have not seen an override to the defaulted - // headers. - for (int header_index = 0; header_index < MAX; ++header_index) - if (std::distance(header_name.begin(), header_name.end()) == - std::distance(defaulted_headers[header_index][0], - defaulted_headers[header_index][1]) && - std::equal(header_name.begin(), header_name.end(), - defaulted_headers[header_index][0], - algorithm::is_iequal())) - found_headers.set(header_index, true); - - // We ignore empty headers. - if (header_value.empty()) continue; - boost::copy(header_name, oi); - *oi = consts::colon_char(); - *oi = consts::space_char(); - boost::copy(header_value, oi); - boost::copy(crlf, oi); - } - - if (!found_headers[HOST]) { - boost::copy(host, oi); - *oi = consts::colon_char(); - *oi = consts::space_char(); - boost::copy(request.host(), oi); - boost::optional port_ = -#if (_MSC_VER >= 1600 && BOOST_VERSION > 105500) - port(request).as_optional(); -#else - port(request); -#endif - if (port_) { - string_type port_str = boost::lexical_cast(*port_); - *oi = consts::colon_char(); - boost::copy(port_str, oi); - } - boost::copy(crlf, oi); - } - - if (!found_headers[ACCEPT]) { - boost::copy(accept, oi); - *oi = consts::colon_char(); - *oi = consts::space_char(); - boost::copy(accept_mime, oi); - boost::copy(crlf, oi); - } - - if (version_major == 1u && version_minor == 1u && - !found_headers[ACCEPT_ENCODING]) { - boost::copy(accept_encoding, oi); - *oi = consts::colon_char(); - *oi = consts::space_char(); - boost::copy(default_accept_encoding, oi); - boost::copy(crlf, oi); - } - - if (!connection_keepalive::value && !found_headers[CONNECTION]) { - boost::copy(connection, oi); - *oi = consts::colon_char(); - *oi = consts::space_char(); - boost::copy(close, oi); - boost::copy(crlf, oi); - } - - boost::copy(crlf, oi); - typename body_range::type body_data = body(request).range(); - return boost::copy(body_data, oi); -} - -} // namespace http - /* http */ - + } + boost::copy(request.path(), oi); + if (!request.query().empty()) { + *oi = consts::question_mark_char(); + boost::copy(request.query(), oi); + } + if (!request.anchor().empty()) { + *oi = consts::hash_char(); + boost::copy(request.anchor(), oi); + } + *oi = consts::space_char(); + boost::copy(http_slash, oi); + string_type version_major_str = + boost::lexical_cast(version_major), + version_minor_str = + boost::lexical_cast(version_minor); + boost::copy(version_major_str, oi); + *oi = consts::dot_char(); + boost::copy(version_minor_str, oi); + boost::copy(crlf, oi); + + // We need to determine whether we've seen any of the following headers + // before setting the defaults. We use a bitset to keep track of the + // defaulted headers. + enum { + ACCEPT, + ACCEPT_ENCODING, + HOST, + CONNECTION, + MAX + }; + std::bitset found_headers; + static char const* defaulted_headers[][2] = { + {consts::accept(), consts::accept() + std::strlen(consts::accept())}, + {consts::accept_encoding(), + consts::accept_encoding() + std::strlen(consts::accept_encoding())}, + {consts::host(), consts::host() + std::strlen(consts::host())}, + {consts::connection(), + consts::connection() + std::strlen(consts::connection())}}; + + typedef typename headers_range::type headers_range; + typedef typename range_value::type headers_value; + for (const headers_value& header : headers(request)) { + string_type header_name = name(header), header_value = value(header); + // Here we check that we have not seen an override to the defaulted + // headers. + for (int header_index = 0; header_index < MAX; ++header_index) + if (std::distance(header_name.begin(), header_name.end()) == + std::distance(defaulted_headers[header_index][0], + defaulted_headers[header_index][1]) && + std::equal(header_name.begin(), header_name.end(), + defaulted_headers[header_index][0], + algorithm::is_iequal())) + found_headers.set(header_index, true); + + // We ignore empty headers. + if (header_value.empty()) continue; + boost::copy(header_name, oi); + *oi = consts::colon_char(); + *oi = consts::space_char(); + boost::copy(header_value, oi); + boost::copy(crlf, oi); + } + + if (!found_headers[HOST]) { + boost::copy(host, oi); + *oi = consts::colon_char(); + *oi = consts::space_char(); + boost::copy(request.host(), oi); + boost::optional port_ = +#if (_MSC_VER >= 1600 && BOOST_VERSION > 105500) + port(request).as_optional(); +#else + port(request); +#endif + if (port_) { + string_type port_str = boost::lexical_cast(*port_); + *oi = consts::colon_char(); + boost::copy(port_str, oi); + } + boost::copy(crlf, oi); + } + + if (!found_headers[ACCEPT]) { + boost::copy(accept, oi); + *oi = consts::colon_char(); + *oi = consts::space_char(); + boost::copy(accept_mime, oi); + boost::copy(crlf, oi); + } + + if (version_major == 1u && version_minor == 1u && + !found_headers[ACCEPT_ENCODING]) { + boost::copy(accept_encoding, oi); + *oi = consts::colon_char(); + *oi = consts::space_char(); + boost::copy(default_accept_encoding, oi); + boost::copy(crlf, oi); + } + + if (!connection_keepalive::value && !found_headers[CONNECTION]) { + boost::copy(connection, oi); + *oi = consts::colon_char(); + *oi = consts::space_char(); + boost::copy(close, oi); + boost::copy(crlf, oi); + } + + boost::copy(crlf, oi); + typename body_range::type body_data = body(request).range(); + return boost::copy(body_data, oi); +} + +} // namespace http } // namespace network - /* net */ - } // namespace boost - /* boost */ - -#endif /* BOOST_NETWORK_PROTOCOL_HTTP_ALGORITHMS_LINEARIZE_HPP_20101028 */ + +#endif /* BOOST_NETWORK_PROTOCOL_HTTP_ALGORITHMS_LINEARIZE_HPP_20101028 */ diff --git a/boost/network/protocol/http/client/async_impl.hpp b/boost/network/protocol/http/client/async_impl.hpp index a88f42c09..b692c5f85 100644 --- a/boost/network/protocol/http/client/async_impl.hpp +++ b/boost/network/protocol/http/client/async_impl.hpp @@ -10,10 +10,11 @@ #include #include -#include +#include #include +#include #include -#include +#include namespace boost { namespace network { @@ -38,7 +39,7 @@ struct async_client async_client(bool cache_resolved, bool follow_redirect, bool always_verify_peer, int timeout, - boost::shared_ptr /*service*/, + boost::shared_ptr service, optional const& certificate_filename, optional const& verify_path, optional const& certificate_file, @@ -77,8 +78,8 @@ struct async_client basic_response const request_skeleton( basic_request const& request_, string_type const& method, - bool get_body, body_callback_function_type /*callback*/, - body_generator_function_type /*generator*/) { + bool get_body, body_callback_function_type callback, + body_generator_function_type generator) { typename connection_base::connection_ptr connection_; connection_ = connection_base::get_connection( resolver_, request_, always_verify_peer_, certificate_filename_, @@ -101,6 +102,7 @@ struct async_client long ssl_options_; bool always_verify_peer_; }; + } // namespace impl } // namespace http } // namespace network diff --git a/boost/network/protocol/http/client/connection/async_base.hpp b/boost/network/protocol/http/client/connection/async_base.hpp index f769302d6..a3fe481d1 100644 --- a/boost/network/protocol/http/client/connection/async_base.hpp +++ b/boost/network/protocol/http/client/connection/async_base.hpp @@ -12,6 +12,7 @@ #include #include #include +#include namespace boost { namespace network { @@ -34,14 +35,13 @@ struct async_connection_base { typedef shared_ptr connection_ptr; // This is the factory function which constructs the appropriate async - // connection implementation with the correct delegate chosen based on - // the + // connection implementation with the correct delegate chosen based on the // tag. static connection_ptr new_connection( resolve_function resolve, resolver_type &resolver, bool follow_redirect, bool always_verify_peer, bool https, int timeout, - optional /*certificate_filename*/ optional(), - optional /*unused*/const &verify_path = optional(), + optional certificate_filename = optional(), + optional const &verify_path = optional(), optional certificate_file = optional(), optional private_key_file = optional(), optional ciphers = optional(), @@ -70,11 +70,8 @@ struct async_connection_base { }; } // namespace impl - } // namespace http - } // namespace network - } // namespace boost #endif // BOOST_NETWORK_PROTOCOL_HTTP_IMPL_ASYNC_CONNECTION_BASE_20100529 diff --git a/boost/network/protocol/http/client/connection/async_normal.hpp b/boost/network/protocol/http/client/connection/async_normal.hpp index 8c194f0b5..14ad776b8 100644 --- a/boost/network/protocol/http/client/connection/async_normal.hpp +++ b/boost/network/protocol/http/client/connection/async_normal.hpp @@ -9,28 +9,31 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include #include -#include #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include - namespace boost { namespace network { namespace http { @@ -94,14 +97,14 @@ struct http_async_connection &command_streambuf)); this->method = method; boost::uint16_t port_ = port(request); - string_type host_ = host(request); - boost::uint16_t source_port = request.source_port(); + string_type host_ = host(request); + boost::uint16_t source_port = request.source_port(); resolve_(resolver_, host_, port_, request_strand_.wrap(boost::bind( &this_type::handle_resolved, this_type::shared_from_this(), - host_, port_, source_port, get_body, callback, - generator, boost::arg<1>(), boost::arg<2>()))); + host_, port_, source_port, get_body, callback, generator, + boost::arg<1>(), boost::arg<2>()))); if (timeout_ > 0) { timer_.expires_from_now(boost::posix_time::seconds(timeout_)); timer_.async_wait(request_strand_.wrap( @@ -131,14 +134,14 @@ struct http_async_connection is_timedout_ = true; } - void handle_resolved(string_type host, boost::uint16_t port, boost::uint16_t source_port, bool get_body, + void handle_resolved(string_type host, boost::uint16_t port, + boost::uint16_t source_port, bool get_body, body_callback_function_type callback, body_generator_function_type generator, boost::system::error_code const& ec, resolver_iterator_pair endpoint_range) { if (!ec && !boost::empty(endpoint_range)) { - // Here we deal with the case that there was an error encountered - // and + // Here we deal with the case that there was an error encountered and // that there's still more endpoints to try connecting to. resolver_iterator iter = boost::begin(endpoint_range); asio::ip::tcp::endpoint endpoint(iter->endpoint().address(), port); @@ -156,7 +159,8 @@ struct http_async_connection } } - void handle_connected(string_type host, boost::uint16_t port, boost::uint16_t source_port, bool get_body, + void handle_connected(string_type host, boost::uint16_t port, + boost::uint16_t source_port, bool get_body, body_callback_function_type callback, body_generator_function_type generator, resolver_iterator_pair endpoint_range, @@ -201,19 +205,14 @@ struct http_async_connection void handle_sent_request(bool get_body, body_callback_function_type callback, body_generator_function_type generator, boost::system::error_code const& ec, - std::size_t /*bytes_transferred*/) { - // TODO(dberris): review parameter necessity. - (void)bytes_transferred; - + std::size_t bytes_transferred) { if (!is_timedout_ && !ec) { if (generator) { - // Here we write some more data that the generator provides, - // before - // we wait for data from the server. + // Here we write some more data that the generator provides, before we + // wait for data from the server. string_type chunk; if (generator(chunk)) { - // At this point this means we have more data to write, so we - // write + // At this point this means we have more data to write, so we write // it out. std::copy(chunk.begin(), chunk.end(), std::ostreambuf_iterator::type>( @@ -242,7 +241,7 @@ struct http_async_connection void handle_received_data(state_t state, bool get_body, body_callback_function_type callback, boost::system::error_code const& ec, - std::size_t /*bytes_transferred*/) { + std::size_t bytes_transferred) { static const long short_read_error = 335544539; bool is_ssl_short_read_error = #ifdef BOOST_NETWORK_ENABLE_HTTPS @@ -265,8 +264,9 @@ struct http_async_connection this_type::shared_from_this(), version, get_body, callback, placeholders::error, placeholders::bytes_transferred)), bytes_transferred); - if (!parsed_ok || indeterminate(parsed_ok) != nullptr) { return; -} + if (!parsed_ok || indeterminate(parsed_ok)) { + return; + } case status: if (ec == boost::asio::error::eof) return; parsed_ok = this->parse_status( @@ -276,8 +276,9 @@ struct http_async_connection this_type::shared_from_this(), status, get_body, callback, placeholders::error, placeholders::bytes_transferred)), bytes_transferred); - if (!parsed_ok || indeterminate(parsed_ok) != nullptr) { return; -} + if (!parsed_ok || indeterminate(parsed_ok)) { + return; + } case status_message: if (ec == boost::asio::error::eof) return; parsed_ok = this->parse_status_message( @@ -287,16 +288,15 @@ struct http_async_connection get_body, callback, placeholders::error, placeholders::bytes_transferred)), bytes_transferred); - if (!parsed_ok || indeterminate(parsed_ok) != nullptr) { return; -} + if (!parsed_ok || indeterminate(parsed_ok)) { + return; + } case headers: if (ec == boost::asio::error::eof) return; - // In the following, remainder is the number of bytes that - // remain - // in the buffer. We need this in the body processing to make - // sure - // that the data remaining in the buffer is dealt with before - // another call to get more data for the body is scheduled. + // In the following, remainder is the number of bytes that remain in + // the buffer. We need this in the body processing to make sure that + // the data remaining in the buffer is dealt with before another call + // to get more data for the body is scheduled. fusion::tie(parsed_ok, remainder) = this->parse_headers( delegate_, request_strand_.wrap(boost::bind( @@ -305,13 +305,13 @@ struct http_async_connection placeholders::error, placeholders::bytes_transferred)), bytes_transferred); - if (!parsed_ok || indeterminate(parsed_ok) != nullptr) { return; -} + if (!parsed_ok || indeterminate(parsed_ok)) { + return; + } if (!get_body) { - // We short-circuit here because the user does not - // want to get the body (in the case of a HEAD - // request). + // We short-circuit here because the user does not want to get the + // body (in the case of a HEAD request). this->body_promise.set_value(""); this->destination_promise.set_value(""); this->source_promise.set_value(""); @@ -321,26 +321,23 @@ struct http_async_connection } if (callback) { - // Here we deal with the spill-over data from the - // headers processing. This means the headers data - // has already been parsed appropriately and we're - // looking to treat everything that remains in the - // buffer. + // Here we deal with the spill-over data from the headers + // processing. This means the headers data has already been parsed + // appropriately and we're looking to treat everything that remains + // in the buffer. typename protocol_base::buffer_type::const_iterator begin = this->part_begin; typename protocol_base::buffer_type::const_iterator end = begin; std::advance(end, remainder); - // We're setting the body promise here to an empty string - // because - // this can be used as a signaling mechanism for the user to - // determine that the body is now ready for processing, even - // though the callback is already provided. + // We're setting the body promise here to an empty string because + // this can be used as a signaling mechanism for the user to + // determine that the body is now ready for processing, even though + // the callback is already provided. this->body_promise.set_value(""); - // The invocation of the callback is synchronous to allow us - // to - // wait before scheduling another read. + // The invocation of the callback is synchronous to allow us to + // wait before scheduling another read. callback(make_iterator_range(begin, end), ec); delegate_->read_some( @@ -351,8 +348,8 @@ struct http_async_connection this_type::shared_from_this(), body, get_body, callback, placeholders::error, placeholders::bytes_transferred))); } else { - // Here we handle the body data ourself and append to an - // ever-growing string buffer. + // Here we handle the body data ourself and append to an + // ever-growing string buffer. this->parse_body( delegate_, request_strand_.wrap(boost::bind( @@ -364,23 +361,19 @@ struct http_async_connection return; case body: if (ec == boost::asio::error::eof || is_ssl_short_read_error) { - // Here we're handling the case when the connection has been - // closed from the server side, or at least that the end of - // file - // has been reached while reading the socket. This signals - // the end - // of the body processing chain. + // Here we're handling the case when the connection has been closed + // from the server side, or at least that the end of file has been + // reached while reading the socket. This signals the end of the + // body processing chain. if (callback) { typename protocol_base::buffer_type::const_iterator begin = this->part.begin(), end = begin; std::advance(end, bytes_transferred); - // We call the callback function synchronously passing the - // error - // condition (in this case, end of file) so that it can - // handle - // it appropriately. + // We call the callback function synchronously passing the error + // condition (in this case, end of file) so that it can handle it + // appropriately. callback(make_iterator_range(begin, end), ec); } else { string_type body_string; @@ -390,7 +383,7 @@ struct http_async_connection this->body_promise.set_value(parse_chunk_encoding(body_string)); } else { this->body_promise.set_value(body_string); -} + } } // TODO(dberris): set the destination value somewhere! this->destination_promise.set_value(""); @@ -399,15 +392,12 @@ struct http_async_connection this->response_parser_.reset(); this->timer_.cancel(); } else { - // This means the connection has not been closed yet and we - // want - // to get more - // data. + // This means the connection has not been closed yet and we want to + // get more data. if (callback) { - // Here we have a body_handler callback. Let's invoke the - // callback from here and make sure we're getting more - // data - // right after. + // Here we have a body_handler callback. Let's invoke the + // callback from here and make sure we're getting more data right + // after. typename protocol_base::buffer_type::const_iterator begin = this->part.begin(); typename protocol_base::buffer_type::const_iterator end = begin; @@ -421,10 +411,9 @@ struct http_async_connection this_type::shared_from_this(), body, get_body, callback, placeholders::error, placeholders::bytes_transferred))); } else { - // Here we don't have a body callback. Let's - // make sure that we deal with the remainder - // from the headers part in case we do have data - // that's still in the buffer. + // Here we don't have a body callback. Let's make sure that we + // deal with the remainder from the headers part in case we do + // have data that's still in the buffer. this->parse_body( delegate_, request_strand_.wrap(boost::bind( @@ -455,9 +444,9 @@ struct http_async_connection this->headers_promise.set_exception(boost::copy_exception(error)); case body: if (!callback) { - // N.B. if callback is non-null, then body_promise has - // already been set to value "" to indicate body is - // handled by streaming handler so no exception should be set + // N.B. if callback is non-null, then body_promise has already been + // set to value "" to indicate body is handled by streaming handler + // so no exception should be set this->body_promise.set_exception(boost::copy_exception(error)); } break; @@ -478,14 +467,16 @@ struct http_async_connection iter = std::search(begin, body_string.end(), crlf.begin(), crlf.end())) { string_type line(begin, iter); - if (line.empty()) { break; -} + if (line.empty()) { + break; + } std::stringstream stream(line); int len; stream >> std::hex >> len; std::advance(iter, 2); - if (len == 0) { break; -} + if (len == 0) { + break; + } if (len <= body_string.end() - iter) { body.insert(body.end(), iter, iter + len); std::advance(iter, len + 2); diff --git a/boost/network/protocol/http/client/connection/async_protocol_handler.hpp b/boost/network/protocol/http/client/connection/async_protocol_handler.hpp index 7db22d560..42b99eb4b 100644 --- a/boost/network/protocol/http/client/connection/async_protocol_handler.hpp +++ b/boost/network/protocol/http/client/connection/async_protocol_handler.hpp @@ -8,8 +8,14 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include +#include +#include #include #include +#include +#include +#include namespace boost { namespace network { @@ -23,22 +29,23 @@ struct http_async_protocol_handler { #ifdef BOOST_NETWORK_DEBUG struct debug_escaper { - string_type& string; - explicit debug_escaper(string_type& /*string_*/) : string(string_) {} - debug_escaper(debug_escaper const& other) : string(other.string) {} - void operator()(typename string_type:: /*value_type*/ input) { + string_type& string_; + explicit debug_escaper(string_type& string) : string_(string) {} + debug_escaper(debug_escaper const&) = default; + debug_escaper(debug_escaper&&) noexcept = default; + void operator()(typename string_type::value_type input) { if (!algorithm::is_print()(input)) { typename ostringstream::type escaped_stream; if (input == '\r') { - string.append("\\r"); + string_.append("\\r"); } else if (input == '\n') { - string.append("\\n"); + string_.append("\\n"); } else { escaped_stream << "\\x" << static_cast(input); - string.append(escaped_stream.str()); + string_.append(escaped_stream.str()); } } else { - string.push_back(input); + string_.push_back(input); } } }; @@ -228,7 +235,7 @@ struct http_async_protocol_handler { return parsed_ok; } - void parse_headers_real(string_type& /*headers_part*/) { + void parse_headers_real(string_type& headers_part) { typename boost::iterator_range input_range = boost::make_iterator_range(headers_part), result_range; @@ -345,16 +352,8 @@ struct http_async_protocol_handler { }; } // namespace impl - /* impl */ - -} // namespace http - /* http */ - -} // namespace network - /* network */ - +} // namespace http +} // namespace network } // namespace boost - /* boost */ -#endif /* BOOST_NETWORK_PROTOCOL_HTTP_IMPL_HTTP_ASYNC_PROTOCOL_HANDLER_HPP_20101015 \ - */ +#endif // BOOST_NETWORK_PROTOCOL_HTTP_IMPL_HTTP_ASYNC_PROTOCOL_HANDLER_HPP_20101015 diff --git a/boost/network/protocol/http/client/connection/connection_delegate_factory.hpp b/boost/network/protocol/http/client/connection/connection_delegate_factory.hpp index 042d45f01..35f05bcfe 100644 --- a/boost/network/protocol/http/client/connection/connection_delegate_factory.hpp +++ b/boost/network/protocol/http/client/connection/connection_delegate_factory.hpp @@ -9,7 +9,10 @@ #include #include +#include +#include #include + #ifdef BOOST_NETWORK_ENABLE_HTTPS #include #endif /* BOOST_NETWORK_ENABLE_HTTPS */ @@ -33,9 +36,9 @@ struct connection_delegate_factory { // TODO(dberris): Support passing in proxy settings when crafting connections. static connection_delegate_ptr new_connection_delegate( asio::io_service& service, bool https, bool always_verify_peer, - optional /*certificate_filename*/, - optional /*verify_path*/, optional /*certificate_file*/, - optional /*private_key_file*/, optional /*ciphers*/, + optional certificate_filename, + optional verify_path, optional certificate_file, + optional private_key_file, optional ciphers, long ssl_options) { connection_delegate_ptr delegate; if (https) { diff --git a/boost/network/protocol/http/client/facade.hpp b/boost/network/protocol/http/client/facade.hpp index 0f1e46504..d59815d6d 100644 --- a/boost/network/protocol/http/client/facade.hpp +++ b/boost/network/protocol/http/client/facade.hpp @@ -11,6 +11,7 @@ #include #include #include +#include namespace boost { namespace network { @@ -46,13 +47,13 @@ struct basic_client_facade { } response get(request const& request, - body_callback_function_type /*body_handler*/ + body_callback_function_type body_handler = body_callback_function_type()) { return pimpl->request_skeleton(request, "GET", true, body_handler, body_generator_function_type()); } - response post(request request, string_type /*unused*/const& body = string_type(), + response post(request request, string_type const& body = string_type(), string_type const& content_type = string_type(), body_callback_function_type body_handler = body_callback_function_type(), @@ -83,13 +84,13 @@ struct basic_client_facade { response post(request const& request, body_generator_function_type body_generator, - body_callback_function_type /*callback*/ = + body_callback_function_type callback = body_generator_function_type()) { return pimpl->request_skeleton(request, "POST", true, callback, body_generator); } - response post(request const& request, body_callback_function_type /*callback*/, + response post(request const& request, body_callback_function_type callback, body_generator_function_type body_generator = body_generator_function_type()) { return post(request, string_type(), string_type(), callback, @@ -103,7 +104,7 @@ struct basic_client_facade { return post(request, body, string_type(), callback, body_generator); } - response put(request request, string_type /*unused*/const& body = string_type(), + response put(request request, string_type const& body = string_type(), string_type const& content_type = string_type(), body_callback_function_type body_handler = body_callback_function_type(), @@ -132,7 +133,7 @@ struct basic_client_facade { body_generator); } - response put(request const& request, body_callback_function_type /*callback*/, + response put(request const& request, body_callback_function_type callback, body_generator_function_type body_generator = body_generator_function_type()) { return put(request, string_type(), string_type(), callback, body_generator); @@ -146,7 +147,7 @@ struct basic_client_facade { } response delete_(request const& request, - body_callback_function_type /*body_handler*/ + body_callback_function_type body_handler = body_callback_function_type()) { return pimpl->request_skeleton(request, "DELETE", true, body_handler, body_generator_function_type()); diff --git a/boost/network/protocol/http/client/options.hpp b/boost/network/protocol/http/client/options.hpp index b4676b5c7..c83bc32d7 100644 --- a/boost/network/protocol/http/client/options.hpp +++ b/boost/network/protocol/http/client/options.hpp @@ -1,17 +1,17 @@ #ifndef BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_OPTIONS_HPP_20130128 #define BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_OPTIONS_HPP_20130128 -#include -#include -#include -#include - // Copyright 2013 Google, Inc. // Copyright 2013 Dean Michael Berris // 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) +#include +#include +#include +#include + namespace boost { namespace network { namespace http { @@ -76,27 +76,27 @@ struct client_options { return *this; } - client_options& openssl_certificate(string_type /*unused*/const& v) { + client_options& openssl_certificate(string_type const& v) { openssl_certificate_ = v; return *this; } - client_options& openssl_verify_path(string_type /*unused*/const& v) { + client_options& openssl_verify_path(string_type const& v) { openssl_verify_path_ = v; return *this; } - client_options& openssl_certificate_file(string_type /*unused*/const& v) { + client_options& openssl_certificate_file(string_type const& v) { openssl_certificate_file_ = v; return *this; } - client_options& openssl_private_key_file(string_type /*unused*/const& v) { + client_options& openssl_private_key_file(string_type const& v) { openssl_private_key_file_ = v; return *this; } - client_options& openssl_ciphers(string_type /*unused*/const& v) { + client_options& openssl_ciphers(string_type const& v) { openssl_ciphers_ = v; return *this; } @@ -106,7 +106,7 @@ struct client_options { return *this; } - client_options& io_service(boost::shared_ptr /*v*/) { + client_options& io_service(boost::shared_ptr v) { io_service_ = v; return *this; } @@ -174,11 +174,8 @@ inline void swap(client_options& a, client_options& b) { a.swap(b); } -} // namespace http - /* http */ +} // namespace http } // namespace network - /* network */ } // namespace boost - /* boost */ -#endif /* BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_OPTIONS_HPP_20130128 */ +#endif // BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_OPTIONS_HPP_20130128 diff --git a/boost/network/protocol/http/client/pimpl.hpp b/boost/network/protocol/http/client/pimpl.hpp index 7cca7d3d8..2ae7ff6a8 100644 --- a/boost/network/protocol/http/client/pimpl.hpp +++ b/boost/network/protocol/http/client/pimpl.hpp @@ -6,17 +6,19 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include #include #include #include +#include +#include +#include #include #include +#include +#include #include -#include -#include -#include - namespace boost { namespace network { namespace http { @@ -72,7 +74,7 @@ struct basic_client_impl optional const& certificate_file, optional const& private_key_file, optional const& ciphers, long ssl_options, - boost::shared_ptr /*service*/, + boost::shared_ptr service, int timeout) : base_type(cache_resolved, follow_redirect, always_verify_peer, timeout, service, certificate_filename, verify_path, certificate_file, @@ -82,9 +84,7 @@ struct basic_client_impl }; } // namespace http - } // namespace network - } // namespace boost #endif // BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_PIMPL_HPP_20100623 diff --git a/boost/network/protocol/http/client/sync_impl.hpp b/boost/network/protocol/http/client/sync_impl.hpp index 32163b48a..0eec18bc5 100644 --- a/boost/network/protocol/http/client/sync_impl.hpp +++ b/boost/network/protocol/http/client/sync_impl.hpp @@ -1,21 +1,22 @@ #ifndef BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_SYNC_IMPL_HPP_20100623 #define BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_SYNC_IMPL_HPP_20100623 -#include +// Copyright 2013 Google, Inc. +// Copyright 2010 Dean Michael Berris +// 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) + #include +#include #include #include #include #include -#include #include #include - -// Copyright 2013 Google, Inc. -// Copyright 2010 Dean Michael Berris -// 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) +#include +#include namespace boost { namespace network { @@ -50,8 +51,8 @@ struct sync_client sync_client( bool cache_resolved, bool follow_redirect, bool always_verify_peer, - int timeout, boost::shared_ptr /*service*/, - optional /*unused*/const& certificate_filename = + int timeout, boost::shared_ptr service, + optional const& certificate_filename = optional(), optional const& verify_path = optional(), optional const& certificate_file = optional(), @@ -76,8 +77,8 @@ struct sync_client void wait_complete() {} basic_response request_skeleton(basic_request const& request_, - string_type /*method*/, bool get_body, - body_callback_function_type /*callback*/, + string_type method, bool get_body, + body_callback_function_type callback, body_generator_function_type generator) { typename connection_base::connection_ptr connection_; connection_ = connection_base::get_connection( diff --git a/boost/network/protocol/http/impl/request.hpp b/boost/network/protocol/http/impl/request.hpp index f3979ccf1..bd817e7fc 100644 --- a/boost/network/protocol/http/impl/request.hpp +++ b/boost/network/protocol/http/impl/request.hpp @@ -5,25 +5,21 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef __NETWORK_PROTOCOL_HTTP_REQUEST_IMPL_20070908_1_HPP__ -#define __NETWORK_PROTOCOL_HTTP_REQUEST_IMPL_20070908_1_HPP__ - -#include -#include +#ifndef BOOST_NETWORK_PROTOCOL_HTTP_REQUEST_IMPL_20070908_1_HPP__ +#define BOOST_NETWORK_PROTOCOL_HTTP_REQUEST_IMPL_20070908_1_HPP__ +#include #include #include #include - #include -#include -#include - +#include #include +#include #include #include - -#include +#include +#include namespace boost { namespace network { @@ -228,4 +224,4 @@ struct body_wrapper > { } // namespace boost -#endif // __NETWORK_PROTOCOL_HTTP_REQUEST_IMPL_20070908_1_HPP__ +#endif // BOOST_NETWORK_PROTOCOL_HTTP_REQUEST_IMPL_20070908_1_HPP__ diff --git a/boost/network/protocol/http/impl/response.ipp b/boost/network/protocol/http/impl/response.ipp index fe15fa6d3..84cf8f7d7 100644 --- a/boost/network/protocol/http/impl/response.ipp +++ b/boost/network/protocol/http/impl/response.ipp @@ -18,10 +18,10 @@ #include #include +#include +#include #include -#include #include -#include namespace boost { namespace network { diff --git a/boost/network/protocol/http/message/modifiers/clear_headers.hpp b/boost/network/protocol/http/message/modifiers/clear_headers.hpp index bd6720ec1..67b34d3b3 100644 --- a/boost/network/protocol/http/message/modifiers/clear_headers.hpp +++ b/boost/network/protocol/http/message/modifiers/clear_headers.hpp @@ -6,7 +6,9 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include #include +#include #include #include #include @@ -16,13 +18,13 @@ namespace network { namespace http { template -inline void clear_headers_impl(basic_request& request, tags::pod /*unused*/) { +inline void clear_headers_impl(basic_request& request, boost::network::tags::pod /*unused*/) { typedef typename basic_request::headers_container_type headers_container; headers_container().swap(request.headers); } template -inline void clear_headers_impl(basic_request& request, tags::normal /*unused*/) { +inline void clear_headers_impl(basic_request& request, boost::network::tags::normal /*unused*/) { request.headers(typename basic_request::headers_container_type()); } @@ -43,13 +45,8 @@ inline void clear_headers(basic_request& request) { } } // namespace http - /* http */ - -} // namespace network - /* network */ +} // namespace network } // namespace boost - /* boost */ -#endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_CLEAR_HEADER_HPP_20101128 \ - */ +#endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_CLEAR_HEADER_HPP_20101128 diff --git a/boost/network/protocol/http/message/modifiers/destination.hpp b/boost/network/protocol/http/message/modifiers/destination.hpp index 10d7a6b24..1c29c1b0f 100644 --- a/boost/network/protocol/http/message/modifiers/destination.hpp +++ b/boost/network/protocol/http/message/modifiers/destination.hpp @@ -10,7 +10,8 @@ #include #include #include -#include +#include +#include #include namespace boost { @@ -54,13 +55,13 @@ inline void destination_impl(basic_request &request, T const &value, template inline void destination_impl(basic_request &request, T const &value, - tags::pod /*unused*/) { + boost::network::tags::pod /*unused*/) { request.destination = value; } template inline void destination_impl(basic_request &request, T const &value, - tags::normal /*unused*/) { + boost::network::tags::normal /*unused*/) { request.destination(value); } @@ -85,11 +86,8 @@ inline void destination(Message const &message, ValueType const &destination_, message.destination = destination_; } -} // namespace impl - /* impl */ - +} // namespace impl } // namespace network - } // namespace boost #include diff --git a/boost/network/protocol/http/message/traits/status_message.hpp b/boost/network/protocol/http/message/traits/status_message.hpp index 280348f9e..61b89ec02 100644 --- a/boost/network/protocol/http/message/traits/status_message.hpp +++ b/boost/network/protocol/http/message/traits/status_message.hpp @@ -6,9 +6,11 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include #include #include #include +#include namespace boost { namespace network { @@ -26,8 +28,8 @@ struct status_message boost::shared_future::type>, typename mpl::if_< mpl::or_, - is_same, - is_same >, + is_same, + is_same >, typename string::type, unsupported_tag >::type> {}; diff --git a/boost/network/protocol/http/message/wrappers/destination.hpp b/boost/network/protocol/http/message/wrappers/destination.hpp index 8210ab39a..940f8bbc7 100644 --- a/boost/network/protocol/http/message/wrappers/destination.hpp +++ b/boost/network/protocol/http/message/wrappers/destination.hpp @@ -3,10 +3,11 @@ // Copyright 2010 (c) Dean Michael Berris. // 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) +// (See accompanying file LICENSE_1_a.txt or copy at +// http://www.boost.org/LICENSE_1_-1.txt) #include +#include namespace boost { namespace network { diff --git a/boost/network/protocol/http/message/wrappers/helper.hpp b/boost/network/protocol/http/message/wrappers/helper.hpp index 2f463414a..deb369884 100644 --- a/boost/network/protocol/http/message/wrappers/helper.hpp +++ b/boost/network/protocol/http/message/wrappers/helper.hpp @@ -7,6 +7,8 @@ // http://www.boost.org/LICENSE_1_0.txt) #include +#include +#include #ifndef BOOST_NETWORK_DEFINE_HTTP_WRAPPER #define BOOST_NETWORK_DEFINE_HTTP_WRAPPER(name, accessor, pod_field) \ @@ -29,8 +31,8 @@ \ template \ struct name##_wrapper_impl \ - : mpl::if_, name##_pod_accessor, \ - name##_member_accessor> {}; \ + : mpl::if_, \ + name##_pod_accessor, name##_member_accessor> {}; \ \ template \ struct name##_wrapper : name##_wrapper_impl::type { \ diff --git a/boost/network/protocol/http/message/wrappers/status_message.hpp b/boost/network/protocol/http/message/wrappers/status_message.hpp index a08421acb..90bc24268 100644 --- a/boost/network/protocol/http/message/wrappers/status_message.hpp +++ b/boost/network/protocol/http/message/wrappers/status_message.hpp @@ -9,6 +9,7 @@ // http://www.boost.org/LICENSE_1_0.txt) #include +#include namespace boost { namespace network { @@ -36,8 +37,8 @@ struct status_message_wrapper { }; template -inline std::ostream& operator<<(std::ostream& /*os*/, - const status_message_wrapper& /*wrapper*/) { +inline std::ostream& operator<<(std::ostream& os, + const status_message_wrapper& wrapper) { return os << static_cast::type>(wrapper); } diff --git a/boost/network/protocol/http/policies/async_resolver.hpp b/boost/network/protocol/http/policies/async_resolver.hpp index 641f4c969..dcc3bcc50 100644 --- a/boost/network/protocol/http/policies/async_resolver.hpp +++ b/boost/network/protocol/http/policies/async_resolver.hpp @@ -9,6 +9,14 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include namespace boost { namespace network { @@ -40,7 +48,7 @@ struct async_resolver : boost::enable_shared_from_this > { explicit async_resolver(bool cache_resolved) : cache_resolved_(cache_resolved), endpoint_cache_() {} - void resolve(resolver_type &resolver_, string_type /*unused*/const &host, + void resolve(resolver_type &resolver_, string_type const &host, boost::uint16_t port, resolve_completion_function once_resolved) { if (cache_resolved_) { @@ -81,11 +89,8 @@ struct async_resolver : boost::enable_shared_from_this > { }; } // namespace policies - } // namespace http - } // namespace network - } // namespace boost #endif // BOOST_NETWORK_PROTOCOL_HTTP_POLICIES_ASYNC_RESOLVER_20100622 diff --git a/boost/network/protocol/http/policies/simple_connection.hpp b/boost/network/protocol/http/policies/simple_connection.hpp index 92cff2dea..b209e5d1d 100644 --- a/boost/network/protocol/http/policies/simple_connection.hpp +++ b/boost/network/protocol/http/policies/simple_connection.hpp @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include diff --git a/boost/network/protocol/http/support/sync_only.hpp b/boost/network/protocol/http/support/sync_only.hpp index 3700df235..c762cf2f1 100644 --- a/boost/network/protocol/http/support/sync_only.hpp +++ b/boost/network/protocol/http/support/sync_only.hpp @@ -6,8 +6,12 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include +#include #include #include +#include +#include namespace boost { namespace network { @@ -16,9 +20,10 @@ namespace http { template struct sync_only : mpl::inherit_linearly< - typename mpl::replace_if::type, - is_same, - tags::sync>::type, + typename mpl::replace_if< + typename tags::components::type, + is_same, + boost::network::tags::sync>::type, mpl::inherit > {}; } // namespace http diff --git a/boost/network/protocol/http/traits/vector.hpp b/boost/network/protocol/http/traits/vector.hpp deleted file mode 100644 index 0e756f354..000000000 --- a/boost/network/protocol/http/traits/vector.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef BOOST_NETWORK_PROTOCOL_HTTP_TRAITS_VECTOR_HPP_20101019 -#define BOOST_NETWORK_PROTOCOL_HTTP_TRAITS_VECTOR_HPP_20101019 - -// Copyright (c) Dean Michael Berris 2010. -// 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) - -#include -#include - -namespace boost { -namespace network { - -template <> -struct vector { - - template - struct apply { - typedef std::vector type; - }; -}; - -template <> -struct vector { - - template - struct apply { - typedef std::vector type; - }; -}; - -} // namespace network - /* network */ - -} // namespace boost - /* boost */ - -#endif /* BOOST_NETWORK_PROTOCOL_HTTP_TRAITS_VECTOR_HPP_20101019 */ diff --git a/boost/network/support/is_default_string.hpp b/boost/network/support/is_default_string.hpp index 78e2a16fe..5c9c42ef2 100644 --- a/boost/network/support/is_default_string.hpp +++ b/boost/network/support/is_default_string.hpp @@ -21,7 +21,6 @@ struct is_default_string< typename enable_if::type> : mpl::true_ {}; } // namespace network - } // namespace boost #endif // BOOST_NETWORK_SUPPORT_STRING_CHECK_20100808 diff --git a/boost/network/uri/uri.hpp b/boost/network/uri/uri.hpp index 54db9d82f..7e5aadb90 100644 --- a/boost/network/uri/uri.hpp +++ b/boost/network/uri/uri.hpp @@ -4,8 +4,8 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef __BOOST_NETWORK_URI_INC__ -#define __BOOST_NETWORK_URI_INC__ +#ifndef BOOST_NETWORK_URI_INC__ +#define BOOST_NETWORK_URI_INC__ #pragma once @@ -46,7 +46,7 @@ class BOOST_URI_DECL uri { // parse(); //} - explicit uri(const string_type &uri) : uri_(uri), is_valid_(false) { parse(); } + uri(const string_type &uri) : uri_(uri), is_valid_(false) { parse(); } template uri(const FwdIter &first, const FwdIter &last) @@ -384,4 +384,4 @@ inline uri from_file(const filesystem::path &path_) { } // namespace network } // namespace boost -#endif // __BOOST_NETWORK_URI_INC__ +#endif // BOOST_NETWORK_URI_INC__ From 7b88a41e5eeb17c88ce48c94b2396c7b8935b2cb Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Sun, 1 Nov 2015 01:39:00 +1100 Subject: [PATCH 016/123] Reintroduce missing code for parsing query maps --- boost/network/uri/accessors.hpp | 8 +++++++- boost/network/uri/uri.hpp | 13 +++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/boost/network/uri/accessors.hpp b/boost/network/uri/accessors.hpp index 32148b5f8..b7c766c3c 100644 --- a/boost/network/uri/accessors.hpp +++ b/boost/network/uri/accessors.hpp @@ -22,7 +22,13 @@ struct key_value_sequence : spirit::qi::grammar { typedef typename Map::mapped_type mapped_type; typedef std::pair pair_type; - key_value_sequence() : key_value_sequence::base_type(query) {}; + key_value_sequence() : key_value_sequence::base_type(query) { + query = pair >> *((spirit::qi::lit(';') | '&') >> pair); + pair = key >> -('=' >> value); + key = + spirit::qi::char_("a-zA-Z_") >> *spirit::qi::char_("-+.~a-zA-Z_0-9/%"); + value = *spirit::qi::char_("-+.~a-zA-Z_0-9/%"); + }; spirit::qi::rule query; spirit::qi::rule pair; diff --git a/boost/network/uri/uri.hpp b/boost/network/uri/uri.hpp index 7e5aadb90..cd972dd30 100644 --- a/boost/network/uri/uri.hpp +++ b/boost/network/uri/uri.hpp @@ -46,7 +46,7 @@ class BOOST_URI_DECL uri { // parse(); //} - uri(const string_type &uri) : uri_(uri), is_valid_(false) { parse(); } + uri(const string_type &str) : uri_(str), is_valid_(false) { parse(); } template uri(const FwdIter &first, const FwdIter &last) @@ -109,8 +109,9 @@ class BOOST_URI_DECL uri { } // hackfix by Simon Haegler, Esri R&D Zurich -// this workaround is needed to avoid running into the "incompatible string iterator" assertion -// triggered by the default-constructed string iterators employed by cpp-netlib (see uri.ipp qi::rule declarations) +// this workaround is needed to avoid running into the "incompatible string +// iterator" assertion triggered by the default-constructed string iterators +// employed by cpp-netlib (see uri.ipp qi::rule declarations) #if defined(_MSC_VER) && defined(_DEBUG) # define CATCH_EMPTY_ITERATOR_RANGE if (range.begin()._Getcont() == 0 || range.end()._Getcont() == 0) { return string_type(); } #else @@ -120,7 +121,7 @@ class BOOST_URI_DECL uri { string_type scheme() const { const_range_type range = scheme_range(); CATCH_EMPTY_ITERATOR_RANGE - return range ? string_type(boost::begin(range), boost::end(range)) + return range ? string_type(boost::begin(range), boost::end(range)) : string_type(); } @@ -166,6 +167,10 @@ class BOOST_URI_DECL uri { : string_type(); } +#ifdef CATCH_EMPTY_ITERATOR_RANGE +#undef CATCH_EMPTY_ITERATOR_RANGE +#endif + string_type string() const { return uri_; } bool is_valid() const { return is_valid_; } From 6349c11994c7a136bbea54b4693df642364376d9 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Mon, 2 Nov 2015 22:09:04 +1100 Subject: [PATCH 017/123] clang-tidy modernize-.* all the things --- .../message/directives/remove_header.hpp | 2 +- .../protocol/http/client/async_impl.hpp | 20 +++++------ .../http/client/connection/async_normal.hpp | 4 +-- .../client/connection/normal_delegate.hpp | 33 ++++++++++--------- .../client/connection/normal_delegate.ipp | 2 -- .../http/client/connection/ssl_delegate.ipp | 10 +++--- .../http/client/connection/sync_normal.hpp | 2 +- .../http/client/connection/sync_ssl.hpp | 2 +- .../protocol/http/client/sync_impl.hpp | 20 +++++------ boost/network/protocol/http/impl/response.ipp | 3 +- .../http/policies/pooled_connection.hpp | 2 +- .../protocol/http/server/async_connection.hpp | 2 +- .../protocol/http/server/sync_connection.hpp | 2 +- boost/network/protocol/stream_handler.hpp | 29 ++++++++-------- boost/network/uri/directives/authority.hpp | 4 +-- boost/network/uri/directives/fragment.hpp | 4 +-- boost/network/uri/directives/host.hpp | 2 +- boost/network/uri/directives/path.hpp | 4 +-- boost/network/uri/directives/port.hpp | 2 +- boost/network/uri/directives/query.hpp | 6 ++-- boost/network/uri/directives/scheme.hpp | 2 +- boost/network/uri/directives/user_info.hpp | 4 +-- boost/network/uri/uri.hpp | 2 +- boost/network/utils/thread_pool.hpp | 4 +-- libs/mime/test/mime-roundtrip.cpp | 2 +- libs/network/example/http/fileserver.cpp | 6 ++-- ...llo_world_async_server_with_work_queue.cpp | 4 +-- 27 files changed, 89 insertions(+), 90 deletions(-) diff --git a/boost/network/message/directives/remove_header.hpp b/boost/network/message/directives/remove_header.hpp index cc04bf17b..52eb1be81 100644 --- a/boost/network/message/directives/remove_header.hpp +++ b/boost/network/message/directives/remove_header.hpp @@ -21,7 +21,7 @@ template struct remove_header_directive { explicit remove_header_directive(T header_name) - : header_name_(header_name) {}; + : header_name_(std::move(header_name)) {}; template void operator()(basic_message& msg) const { diff --git a/boost/network/protocol/http/client/async_impl.hpp b/boost/network/protocol/http/client/async_impl.hpp index b692c5f85..ca2805e3d 100644 --- a/boost/network/protocol/http/client/async_impl.hpp +++ b/boost/network/protocol/http/client/async_impl.hpp @@ -40,11 +40,11 @@ struct async_client async_client(bool cache_resolved, bool follow_redirect, bool always_verify_peer, int timeout, boost::shared_ptr service, - optional const& certificate_filename, - optional const& verify_path, - optional const& certificate_file, - optional const& private_key_file, - optional const& ciphers, long ssl_options) + optional certificate_filename, + optional verify_path, + optional certificate_file, + optional private_key_file, + optional ciphers, long ssl_options) : connection_base(cache_resolved, follow_redirect, timeout), service_ptr(service.get() ? service @@ -52,11 +52,11 @@ struct async_client service_(*service_ptr), resolver_(service_), sentinel_(new boost::asio::io_service::work(service_)), - certificate_filename_(certificate_filename), - verify_path_(verify_path), - certificate_file_(certificate_file), - private_key_file_(private_key_file), - ciphers_(ciphers), + certificate_filename_(std::move(certificate_filename)), + verify_path_(std::move(verify_path)), + certificate_file_(std::move(certificate_file)), + private_key_file_(std::move(private_key_file)), + ciphers_(std::move(ciphers)), ssl_options_(ssl_options), always_verify_peer_(always_verify_peer) { connection_base::resolver_strand_.reset( diff --git a/boost/network/protocol/http/client/connection/async_normal.hpp b/boost/network/protocol/http/client/connection/async_normal.hpp index 14ad776b8..b5002344c 100644 --- a/boost/network/protocol/http/client/connection/async_normal.hpp +++ b/boost/network/protocol/http/client/connection/async_normal.hpp @@ -78,9 +78,9 @@ struct http_async_connection is_timedout_(false), follow_redirect_(follow_redirect), resolver_(resolver), - resolve_(resolve), + resolve_(std::move(resolve)), request_strand_(resolver.get_io_service()), - delegate_(delegate) {} + delegate_(std::move(delegate)) {} // This is the main entry point for the connection/request pipeline. // We're diff --git a/boost/network/protocol/http/client/connection/normal_delegate.hpp b/boost/network/protocol/http/client/connection/normal_delegate.hpp index d4cea1786..48c2cd9fd 100644 --- a/boost/network/protocol/http/client/connection/normal_delegate.hpp +++ b/boost/network/protocol/http/client/connection/normal_delegate.hpp @@ -22,28 +22,29 @@ namespace impl { struct normal_delegate : connection_delegate { explicit normal_delegate(asio::io_service &service); - void connect(asio::ip::tcp::endpoint &endpoint, std::string host, boost::uint16_t source_port, - function handler) override; - void write( - asio::streambuf &command_streambuf, - function handler) override; - void read_some( - asio::mutable_buffers_1 const &read_buffer, - function handler) override; + void connect(asio::ip::tcp::endpoint &endpoint, std::string host, + boost::uint16_t source_port, + function handler) override; + void write(asio::streambuf &command_streambuf, + function handler) + override; + void read_some(asio::mutable_buffers_1 const &read_buffer, + function handler) + override; void disconnect() override; - ~normal_delegate() override; + ~normal_delegate() override = default; + + normal_delegate(normal_delegate const &) = delete; + normal_delegate &operator=(normal_delegate) = delete; private: asio::io_service &service_; std::unique_ptr socket_; - - normal_delegate(normal_delegate const &); // = delete - normal_delegate &operator=(normal_delegate); // = delete }; -} // namespace impl -} // namespace http +} // namespace impl +} // namespace http } // namespace network -} // namespace boost +} // namespace boost -#endif // BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_NORMAL_DELEGATE_20110819 +#endif // BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_NORMAL_DELEGATE_20110819 diff --git a/boost/network/protocol/http/client/connection/normal_delegate.ipp b/boost/network/protocol/http/client/connection/normal_delegate.ipp index bec14c68b..103b059b7 100644 --- a/boost/network/protocol/http/client/connection/normal_delegate.ipp +++ b/boost/network/protocol/http/client/connection/normal_delegate.ipp @@ -54,6 +54,4 @@ void boost::network::http::impl::normal_delegate::disconnect() { } } -boost::network::http::impl::normal_delegate::~normal_delegate() {} - #endif // BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_NORMAL_DELEGATE_IPP_20110819 diff --git a/boost/network/protocol/http/client/connection/ssl_delegate.ipp b/boost/network/protocol/http/client/connection/ssl_delegate.ipp index 71161ba46..7c4672097 100644 --- a/boost/network/protocol/http/client/connection/ssl_delegate.ipp +++ b/boost/network/protocol/http/client/connection/ssl_delegate.ipp @@ -20,11 +20,11 @@ boost::network::http::impl::ssl_delegate::ssl_delegate( optional ciphers, long ssl_options) : service_(service), - certificate_filename_(certificate_filename), - verify_path_(verify_path), - certificate_file_(certificate_file), - private_key_file_(private_key_file), - ciphers_(ciphers), + certificate_filename_(std::move(certificate_filename)), + verify_path_(std::move(verify_path)), + certificate_file_(std::move(certificate_file)), + private_key_file_(std::move(private_key_file)), + ciphers_(std::move(ciphers)), ssl_options_(ssl_options), always_verify_peer_(always_verify_peer) {} diff --git a/boost/network/protocol/http/client/connection/sync_normal.hpp b/boost/network/protocol/http/client/connection/sync_normal.hpp index a21da75ce..e02c75f57 100644 --- a/boost/network/protocol/http/client/connection/sync_normal.hpp +++ b/boost/network/protocol/http/client/connection/sync_normal.hpp @@ -47,7 +47,7 @@ struct http_sync_connection timeout_(timeout), timer_(resolver.get_io_service()), resolver_(resolver), - resolve_(resolve), + resolve_(std::move(resolve)), socket_(resolver.get_io_service()) {} void init_socket(string_type /*unused*/const& hostname, string_type const& port) { diff --git a/boost/network/protocol/http/client/connection/sync_ssl.hpp b/boost/network/protocol/http/client/connection/sync_ssl.hpp index b57930a0e..44dd0eee3 100644 --- a/boost/network/protocol/http/client/connection/sync_ssl.hpp +++ b/boost/network/protocol/http/client/connection/sync_ssl.hpp @@ -63,7 +63,7 @@ struct https_sync_connection timeout_(timeout), timer_(resolver.get_io_service()), resolver_(resolver), - resolve_(resolve), + resolve_(std::move(resolve)), context_(resolver.get_io_service(), boost::asio::ssl::context::sslv23_client), socket_(resolver.get_io_service(), context_) { diff --git a/boost/network/protocol/http/client/sync_impl.hpp b/boost/network/protocol/http/client/sync_impl.hpp index 0eec18bc5..39e90bc1a 100644 --- a/boost/network/protocol/http/client/sync_impl.hpp +++ b/boost/network/protocol/http/client/sync_impl.hpp @@ -52,23 +52,23 @@ struct sync_client sync_client( bool cache_resolved, bool follow_redirect, bool always_verify_peer, int timeout, boost::shared_ptr service, - optional const& certificate_filename = + optional certificate_filename = optional(), - optional const& verify_path = optional(), - optional const& certificate_file = optional(), - optional const& private_key_file = optional(), - optional const& ciphers = optional(), + optional verify_path = optional(), + optional certificate_file = optional(), + optional private_key_file = optional(), + optional ciphers = optional(), long ssl_options = 0) : connection_base(cache_resolved, follow_redirect, timeout), service_ptr(service.get() ? service : make_shared()), service_(*service_ptr), resolver_(service_), - certificate_filename_(certificate_filename), - verify_path_(verify_path), - certificate_file_(certificate_file), - private_key_file_(private_key_file), - ciphers_(ciphers), + certificate_filename_(std::move(certificate_filename)), + verify_path_(std::move(verify_path)), + certificate_file_(std::move(certificate_file)), + private_key_file_(std::move(private_key_file)), + ciphers_(std::move(ciphers)), ssl_options_(ssl_options), always_verify_peer_(always_verify_peer) {} diff --git a/boost/network/protocol/http/impl/response.ipp b/boost/network/protocol/http/impl/response.ipp index 84cf8f7d7..b43a187a1 100644 --- a/boost/network/protocol/http/impl/response.ipp +++ b/boost/network/protocol/http/impl/response.ipp @@ -108,8 +108,7 @@ struct basic_response { static const char crlf[] = {'\r', '\n'}; std::vector buffers; buffers.push_back(to_buffer(status)); - for (std::size_t i = 0; i < headers.size(); ++i) { - header_type &h = headers[i]; + for (auto & h : headers) { buffers.push_back(buffer(h.name)); buffers.push_back(buffer(name_value_separator)); buffers.push_back(buffer(h.value)); diff --git a/boost/network/protocol/http/policies/pooled_connection.hpp b/boost/network/protocol/http/policies/pooled_connection.hpp index 664bb633d..411641a7b 100644 --- a/boost/network/protocol/http/policies/pooled_connection.hpp +++ b/boost/network/protocol/http/policies/pooled_connection.hpp @@ -65,7 +65,7 @@ struct pooled_connection_policy : resolver_policy::type { ssl_options)), resolver_(resolver), connection_follow_redirect_(follow_redirect), - get_connection_(get_connection), + get_connection_(std::move(get_connection)), certificate_filename_(certificate_filename), verify_path_(verify_path), certificate_file_(certificate_file), diff --git a/boost/network/protocol/http/server/async_connection.hpp b/boost/network/protocol/http/server/async_connection.hpp index e8f566d22..835d6f5d9 100644 --- a/boost/network/protocol/http/server/async_connection.hpp +++ b/boost/network/protocol/http/server/async_connection.hpp @@ -559,7 +559,7 @@ struct async_connection headers_buffer.consume(headers_buffer.size()); headers_already_sent = true; thread_pool().post(callback); - pending_actions_list::iterator start = pending_actions.begin(), + auto start = pending_actions.begin(), end = pending_actions.end(); while (start != end) { thread_pool().post(*start++); diff --git a/boost/network/protocol/http/server/sync_connection.hpp b/boost/network/protocol/http/server/sync_connection.hpp index bfe749699..8b97ed2f1 100644 --- a/boost/network/protocol/http/server/sync_connection.hpp +++ b/boost/network/protocol/http/server/sync_connection.hpp @@ -84,7 +84,7 @@ struct sync_connection if (done) { if (request_.method[0] == 'P') { // look for the content-length header - typename std::vector::type>::iterator + auto it = std::find_if(request_.headers.begin(), request_.headers.end(), is_content_length()); if (it == request_.headers.end()) { diff --git a/boost/network/protocol/stream_handler.hpp b/boost/network/protocol/stream_handler.hpp index 615d85485..8237c2996 100644 --- a/boost/network/protocol/stream_handler.hpp +++ b/boost/network/protocol/stream_handler.hpp @@ -10,22 +10,23 @@ #pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include -#include -#include #include -#ifdef BOOST_NETWORK_ENABLE_HTTPS -#include -#endif -#include +#include +#include +#include +#include #include #include +#include +#include +#include #include -#include #include -#include -#include -#include +#include + +#ifdef BOOST_NETWORK_ENABLE_HTTPS +#include +#endif namespace boost { namespace network { @@ -43,12 +44,12 @@ typedef boost::asio::ssl::context ssl_context; struct stream_handler { public: stream_handler(boost::shared_ptr socket) - : tcp_sock_(socket), ssl_enabled(false) {} + : tcp_sock_(std::move(socket)), ssl_enabled(false) {} - ~stream_handler() {} + ~stream_handler() = default; stream_handler(boost::shared_ptr socket) - : ssl_sock_(socket), ssl_enabled(true) {} + : ssl_sock_(std::move(socket)), ssl_enabled(true) {} stream_handler(boost::asio::io_service& io, boost::shared_ptr ctx = diff --git a/boost/network/uri/directives/authority.hpp b/boost/network/uri/directives/authority.hpp index 85f6e04ee..3206b3916 100644 --- a/boost/network/uri/directives/authority.hpp +++ b/boost/network/uri/directives/authority.hpp @@ -14,8 +14,8 @@ namespace uri { struct authority_directive { - explicit authority_directive(const std::string &authority) - : authority_(authority) {} + explicit authority_directive(std::string authority) + : authority_(std::move(authority)) {} template void operator()(Uri &uri) const { diff --git a/boost/network/uri/directives/fragment.hpp b/boost/network/uri/directives/fragment.hpp index 24f35580d..90b9e0ea4 100644 --- a/boost/network/uri/directives/fragment.hpp +++ b/boost/network/uri/directives/fragment.hpp @@ -16,8 +16,8 @@ namespace network { namespace uri { struct fragment_directive { - explicit fragment_directive(const std::string &fragment) - : fragment_(fragment) {} + explicit fragment_directive(std::string fragment) + : fragment_(std::move(fragment)) {} template void operator()(Uri &uri) const { diff --git a/boost/network/uri/directives/host.hpp b/boost/network/uri/directives/host.hpp index b9696c2a5..0ffead99e 100644 --- a/boost/network/uri/directives/host.hpp +++ b/boost/network/uri/directives/host.hpp @@ -15,7 +15,7 @@ namespace network { namespace uri { struct host_directive { - explicit host_directive(const std::string & host) : host_(host) {} + explicit host_directive(std::string host) : host_(std::move(host)) {} template void operator()(Uri &uri) const { diff --git a/boost/network/uri/directives/path.hpp b/boost/network/uri/directives/path.hpp index dc99a849c..336912a17 100644 --- a/boost/network/uri/directives/path.hpp +++ b/boost/network/uri/directives/path.hpp @@ -16,7 +16,7 @@ namespace network { namespace uri { struct path_directive { - explicit path_directive(const std::string &path) : path_(path) {} + explicit path_directive(std::string path) : path_(std::move(path)) {} template void operator()(Uri &uri) const { @@ -28,7 +28,7 @@ struct path_directive { struct encoded_path_directive { - explicit encoded_path_directive(const std::string & path) : path_(path) {} + explicit encoded_path_directive(std::string path) : path_(std::move(path)) {} void operator()(uri &uri_) const { std::string encoded_path; diff --git a/boost/network/uri/directives/port.hpp b/boost/network/uri/directives/port.hpp index 62627aa84..76dca2eed 100644 --- a/boost/network/uri/directives/port.hpp +++ b/boost/network/uri/directives/port.hpp @@ -16,7 +16,7 @@ namespace network { namespace uri { struct port_directive { - explicit port_directive(const std::string &port) : port_(port) {} + explicit port_directive(std::string port) : port_(std::move(port)) {} explicit port_directive(boost::uint16_t port) : port_(boost::lexical_cast(port)) {} diff --git a/boost/network/uri/directives/query.hpp b/boost/network/uri/directives/query.hpp index 02dbfb825..94309273f 100644 --- a/boost/network/uri/directives/query.hpp +++ b/boost/network/uri/directives/query.hpp @@ -17,7 +17,7 @@ namespace network { namespace uri { struct query_directive { - explicit query_directive(const std::string & query) : query_(query) {} + explicit query_directive(std::string query) : query_(std::move(query)) {} template void operator()(Uri &uri) const { @@ -34,8 +34,8 @@ inline query_directive query(const std::string &query) { struct query_key_query_directive { - query_key_query_directive(const std::string & key, const std::string & query) - : key_(key), query_(query) {} + query_key_query_directive(std::string key, std::string query) + : key_(std::move(key)), query_(std::move(query)) {} template void operator()(Uri &uri) const { diff --git a/boost/network/uri/directives/scheme.hpp b/boost/network/uri/directives/scheme.hpp index d62c1a9e6..8e79d85be 100644 --- a/boost/network/uri/directives/scheme.hpp +++ b/boost/network/uri/directives/scheme.hpp @@ -16,7 +16,7 @@ namespace network { namespace uri { struct scheme_directive { - explicit scheme_directive(const std::string &scheme) : scheme(scheme) {} + explicit scheme_directive(std::string scheme) : scheme(std::move(scheme)) {} template void operator()(Uri &uri) const { diff --git a/boost/network/uri/directives/user_info.hpp b/boost/network/uri/directives/user_info.hpp index 771890763..ccc92fd2a 100644 --- a/boost/network/uri/directives/user_info.hpp +++ b/boost/network/uri/directives/user_info.hpp @@ -15,8 +15,8 @@ namespace network { namespace uri { struct user_info_directive { - explicit user_info_directive(const std::string &user_info) - : user_info_(user_info) {} + explicit user_info_directive(std::string user_info) + : user_info_(std::move(user_info)) {} template void operator()(Uri &uri) const { diff --git a/boost/network/uri/uri.hpp b/boost/network/uri/uri.hpp index cd972dd30..1ffaeca59 100644 --- a/boost/network/uri/uri.hpp +++ b/boost/network/uri/uri.hpp @@ -46,7 +46,7 @@ class BOOST_URI_DECL uri { // parse(); //} - uri(const string_type &str) : uri_(str), is_valid_(false) { parse(); } + uri(string_type str) : uri_(std::move(str)), is_valid_(false) { parse(); } template uri(const FwdIter &first, const FwdIter &last) diff --git a/boost/network/utils/thread_pool.hpp b/boost/network/utils/thread_pool.hpp index 2b0202352..e50d19282 100644 --- a/boost/network/utils/thread_pool.hpp +++ b/boost/network/utils/thread_pool.hpp @@ -35,8 +35,8 @@ struct basic_thread_pool { io_service_ptr io_service = io_service_ptr(), worker_threads_ptr worker_threads = worker_threads_ptr()) : threads_(threads), - io_service_(io_service), - worker_threads_(worker_threads), + io_service_(std::move(io_service)), + worker_threads_(std::move(worker_threads)), sentinel_() { bool commit = false; BOOST_SCOPE_EXIT_TPL( diff --git a/libs/mime/test/mime-roundtrip.cpp b/libs/mime/test/mime-roundtrip.cpp index f5bca8acb..f51641187 100644 --- a/libs/mime/test/mime-roundtrip.cpp +++ b/libs/mime/test/mime-roundtrip.cpp @@ -107,7 +107,7 @@ test_suite *init_unit_test_suite(int, char **) #ifdef BOOST_TEST_DYN_LINK true; #else - 0; + nullptr; #endif } diff --git a/libs/network/example/http/fileserver.cpp b/libs/network/example/http/fileserver.cpp index 9951d6957..557d71b01 100644 --- a/libs/network/example/http/fileserver.cpp +++ b/libs/network/example/http/fileserver.cpp @@ -30,7 +30,7 @@ struct file_cache { meta_map file_headers; boost::shared_mutex cache_mutex; - explicit file_cache(std::string const &doc_root) : doc_root_(doc_root) {} + explicit file_cache(std::string doc_root) : doc_root_(std::move(doc_root)) {} ~file_cache() throw() { BOOST_FOREACH(region_map::value_type const & region, regions) { @@ -85,9 +85,9 @@ struct file_cache { std::string const &path) { boost::shared_lock lock(cache_mutex); static std::vector empty_vector; - meta_map::iterator headers = file_headers.find(doc_root_ + path); + auto headers = file_headers.find(doc_root_ + path); if (headers != file_headers.end()) { - std::vector::iterator begin = headers->second + auto begin = headers->second .begin(), end = headers->second.end(); diff --git a/libs/network/example/http/hello_world_async_server_with_work_queue.cpp b/libs/network/example/http/hello_world_async_server_with_work_queue.cpp index dc3c0224b..3607317f1 100644 --- a/libs/network/example/http/hello_world_async_server_with_work_queue.cpp +++ b/libs/network/example/http/hello_world_async_server_with_work_queue.cpp @@ -35,8 +35,8 @@ struct request_data { typedef boost::shared_ptr pointer; - request_data(server::request const& req, const server::connection_ptr& conn) - : req(req), conn(conn) {} + request_data(server::request req, server::connection_ptr conn) + : req(std::move(req)), conn(std::move(conn)) {} }; /** From 6d8879c497cbc18cf94cbddd1cc1f6c3bf8e0dac Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Mon, 2 Nov 2015 23:37:03 +1100 Subject: [PATCH 018/123] Upgrade travis config --- .travis.yml | 86 +++++++++++++++++++++++++++--------------------- build.sh | 15 +++++++++ install-boost.sh | 13 ++++++++ 3 files changed, 77 insertions(+), 37 deletions(-) create mode 100644 build.sh create mode 100644 install-boost.sh diff --git a/.travis.yml b/.travis.yml index 3a6796d00..2082de386 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,55 +1,67 @@ -language: - - cpp +sudo: false +language: cpp compiler: - - gcc + - g++ - clang env: - - BOOST_VER=1.54.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" - - BOOST_VER=1.54.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" - - BOOST_VER=1.54.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" - - BOOST_VER=1.54.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" - - BOOST_VER=1.55.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" - - BOOST_VER=1.55.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" - - BOOST_VER=1.55.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" - - BOOST_VER=1.55.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" - - BOOST_VER=1.54.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" - - BOOST_VER=1.54.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" - - BOOST_VER=1.54.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" - - BOOST_VER=1.54.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" - BOOST_VER=1.55.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" - BOOST_VER=1.55.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" - BOOST_VER=1.55.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" - - BOOST_VER=1.55.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" - -before_install: - - if [ "${CXX}" == "g++" ] || [ ${BUILD_SHARED_LIBS} = "OFF" ]; then - sudo add-apt-repository ppa:boost-latest/ppa --yes; - sudo apt-get update; - fi - - if [ "${CXX}" == "clang++" ] && [ ${BUILD_SHARED_LIBS} = "ON" ]; then - svn export http://svn.boost.org/svn/boost/tags/release/Boost_${BOOST_VER//./_} ../boost_${BOOST_VER//./_}; - export BOOST_ROOT=$TRAVIS_BUILD_DIR/../boost_${BOOST_VER//./_}; - fi + - BOOST_VER=1.56.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" + - BOOST_VER=1.56.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" + - BOOST_VER=1.56.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" + - BOOST_VER=1.56.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" + - BOOST_VER=1.57.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" + - BOOST_VER=1.57.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" + - BOOST_VER=1.57.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" + - BOOST_VER=1.57.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" + - BOOST_VER=1.57.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" + - BOOST_VER=1.58.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" + - BOOST_VER=1.58.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" + - BOOST_VER=1.58.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" + - BOOST_VER=1.58.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" + - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" + - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" + - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" + - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" install: + - mkdir -p ${HOME}/bin - if [ "${CXX}" == "g++" ] || [ ${BUILD_SHARED_LIBS} = "OFF" ]; then - sudo apt-get install libboost${BOOST_VER/%.0/}-all-dev; + export TOOLSET="gcc"; + ln -s `which g++-4.8` ${HOME}/bin/g++; + ln -s `which gcc-4.8` ${HOME}/bin/gcc; fi - - if [ "${CXX}" == "clang++" ] && [ ${BUILD_SHARED_LIBS} = "ON" ]; then - cd $BOOST_ROOT; - ./bootstrap.sh --with-toolset=$CC; - ./b2 -j4 --stagedir=.; - cd -; + - if [ "${CXX}" == "clang" ]; then + export TOOLSET="clang"; + ln -s `which clang-3.6` ${HOME}/bin/g++; + ln -s `which clang++-3.6` ${HOME}/bin/clang++; fi + - export BOOST_VERSION=${BOOST_VER//./_} + - export PATH=${HOME}/bin:${PATH} + - sh -x ./install-boost.sh + - export BOOST_ROOT=${HOME}/${CC}-boost_${BOOST_VER//./_} + - ${CXX} --version + +cache: + directories: + - ${HOME}/${CC}-boost_${BOOST_VER//./_} script: - - cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} - -DCPP-NETLIB_ENABLE_HTTPS=${ENABLE_HTTPS} - - make - - make test + - pwd + - sh -x build.sh after_failure: - cat Testing/Temporary/LastTest.log + +addons: + apt: + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-precise-3.6 + packages: + - gcc-4.8 + - g++-4.8 + - clang-3.6 diff --git a/build.sh b/build.sh new file mode 100644 index 000000000..7d776f907 --- /dev/null +++ b/build.sh @@ -0,0 +1,15 @@ +#!/bin/sh +set -e + +mkdir -p build +cd build +cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \ + -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \ + -DCPP-NETLIB_ENABLE_HTTPS=$ENABLE_HTTPS \ + -DBOOST_INCLUDEDIR="${HOME}/${CC}-boost_${BOOST_VERSION}/include" \ + -DBOOST_LIBRARYDIR="${HOME}/${CC}-boost_${BOOST_VERSION}/lib" \ + -DCMAKE_CXX_FLAGS='-std=c++11' \ + .. +make -j2 +make test +cd .. diff --git a/install-boost.sh b/install-boost.sh new file mode 100644 index 000000000..17d446e89 --- /dev/null +++ b/install-boost.sh @@ -0,0 +1,13 @@ +#!/bin/sh +set -e + +if [ ! -d "${HOME}/${CC}-boost_${BOOST_VERSION}/include" ]; then + wget -O boost_${BOOST_VERSION}.tar.bz2 http:/sourceforge.get/projects/boost/files/boost/${BOOST_VER}/boost_${BOOST_VERSION}.tar.bz2/download + tar jxf boost_${BOOST_VERSION}.tar.bz2 + cd boost_${BOOST_VERSION} + ./bootstrap.sh --with-toolset=$TOOLSET --prefix=${HOME}/${CC}-boost_${BOOST_VERSION} + ./b2 --stagedir=. -j2 --build-type=complete --layout=tagged cxxflags='-std=c++11' install 2>boost-error.log + cd .. + rm -rf boost_${BOOST_VERSION} + rm -rf boost_${BOOST_VERSION}.tar.bz2 +fi From 65a0e6ec05dd8dff14f7fa15b637c77309f3912a Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Tue, 3 Nov 2015 00:01:32 +1100 Subject: [PATCH 019/123] Fix typo in URL --- install-boost.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-boost.sh b/install-boost.sh index 17d446e89..594fb4cbe 100644 --- a/install-boost.sh +++ b/install-boost.sh @@ -2,7 +2,7 @@ set -e if [ ! -d "${HOME}/${CC}-boost_${BOOST_VERSION}/include" ]; then - wget -O boost_${BOOST_VERSION}.tar.bz2 http:/sourceforge.get/projects/boost/files/boost/${BOOST_VER}/boost_${BOOST_VERSION}.tar.bz2/download + wget -O boost_${BOOST_VERSION}.tar.bz2 http://sourceforge.get/projects/boost/files/boost/${BOOST_VER}/boost_${BOOST_VERSION}.tar.bz2/download tar jxf boost_${BOOST_VERSION}.tar.bz2 cd boost_${BOOST_VERSION} ./bootstrap.sh --with-toolset=$TOOLSET --prefix=${HOME}/${CC}-boost_${BOOST_VERSION} From feec209a366e1b112d35a82f0828340984ef62ee Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Tue, 3 Nov 2015 00:06:53 +1100 Subject: [PATCH 020/123] Fix another typo on the URL. --- install-boost.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-boost.sh b/install-boost.sh index 594fb4cbe..67e790deb 100644 --- a/install-boost.sh +++ b/install-boost.sh @@ -2,7 +2,7 @@ set -e if [ ! -d "${HOME}/${CC}-boost_${BOOST_VERSION}/include" ]; then - wget -O boost_${BOOST_VERSION}.tar.bz2 http://sourceforge.get/projects/boost/files/boost/${BOOST_VER}/boost_${BOOST_VERSION}.tar.bz2/download + wget -O boost_${BOOST_VERSION}.tar.bz2 http://sourceforge.net/projects/boost/files/boost/${BOOST_VER}/boost_${BOOST_VERSION}.tar.bz2/download tar jxf boost_${BOOST_VERSION}.tar.bz2 cd boost_${BOOST_VERSION} ./bootstrap.sh --with-toolset=$TOOLSET --prefix=${HOME}/${CC}-boost_${BOOST_VERSION} From 484786572503d0d145dbf9e4d67ed56ec5edf25b Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Tue, 3 Nov 2015 00:28:30 +1100 Subject: [PATCH 021/123] Make travis wait for a Boost build to finish --- install-boost.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-boost.sh b/install-boost.sh index 67e790deb..e8b55e517 100644 --- a/install-boost.sh +++ b/install-boost.sh @@ -6,7 +6,7 @@ if [ ! -d "${HOME}/${CC}-boost_${BOOST_VERSION}/include" ]; then tar jxf boost_${BOOST_VERSION}.tar.bz2 cd boost_${BOOST_VERSION} ./bootstrap.sh --with-toolset=$TOOLSET --prefix=${HOME}/${CC}-boost_${BOOST_VERSION} - ./b2 --stagedir=. -j2 --build-type=complete --layout=tagged cxxflags='-std=c++11' install 2>boost-error.log + travis_wait ./b2 --stagedir=. -j2 --build-type=complete --layout=tagged cxxflags='-std=c++11' install >boost-build.log 2>&1 cd .. rm -rf boost_${BOOST_VERSION} rm -rf boost_${BOOST_VERSION}.tar.bz2 From e19af746b57062c365067ba585d082aacf73a296 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Tue, 3 Nov 2015 00:32:31 +1100 Subject: [PATCH 022/123] Change level of travis_wait call; chmod +x .sh files --- .travis.yml | 2 +- build.sh | 0 install-boost.sh | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 build.sh mode change 100644 => 100755 install-boost.sh diff --git a/.travis.yml b/.travis.yml index 2082de386..d3aaa5891 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,7 +41,7 @@ install: fi - export BOOST_VERSION=${BOOST_VER//./_} - export PATH=${HOME}/bin:${PATH} - - sh -x ./install-boost.sh + - travis_wait ./install-boost.sh - export BOOST_ROOT=${HOME}/${CC}-boost_${BOOST_VER//./_} - ${CXX} --version diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 diff --git a/install-boost.sh b/install-boost.sh old mode 100644 new mode 100755 index e8b55e517..6eba749e4 --- a/install-boost.sh +++ b/install-boost.sh @@ -6,7 +6,7 @@ if [ ! -d "${HOME}/${CC}-boost_${BOOST_VERSION}/include" ]; then tar jxf boost_${BOOST_VERSION}.tar.bz2 cd boost_${BOOST_VERSION} ./bootstrap.sh --with-toolset=$TOOLSET --prefix=${HOME}/${CC}-boost_${BOOST_VERSION} - travis_wait ./b2 --stagedir=. -j2 --build-type=complete --layout=tagged cxxflags='-std=c++11' install >boost-build.log 2>&1 + ./b2 --stagedir=. -j2 --build-type=complete --layout=tagged cxxflags='-std=c++11' install >boost-build.log 2>&1 cd .. rm -rf boost_${BOOST_VERSION} rm -rf boost_${BOOST_VERSION}.tar.bz2 From abe68b4c812d901be71db0e39aa8ce124bebea20 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Tue, 3 Nov 2015 00:44:40 +1100 Subject: [PATCH 023/123] Only support Boost 1.59 for now. --- .travis.yml | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index d3aaa5891..9abf5f5a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,37 +6,25 @@ compiler: - clang env: - - BOOST_VER=1.55.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" - - BOOST_VER=1.55.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" - - BOOST_VER=1.55.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" - - BOOST_VER=1.56.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" - - BOOST_VER=1.56.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" - - BOOST_VER=1.56.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" - - BOOST_VER=1.56.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" - - BOOST_VER=1.57.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" - - BOOST_VER=1.57.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" - - BOOST_VER=1.57.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" - - BOOST_VER=1.57.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" - - BOOST_VER=1.57.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" - - BOOST_VER=1.58.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" - - BOOST_VER=1.58.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" - - BOOST_VER=1.58.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" - - BOOST_VER=1.58.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" + - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" - - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" + - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" + - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" + - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" + - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" install: - mkdir -p ${HOME}/bin - - if [ "${CXX}" == "g++" ] || [ ${BUILD_SHARED_LIBS} = "OFF" ]; then + - if [ "${CC}" = "gcc" ]; then export TOOLSET="gcc"; ln -s `which g++-4.8` ${HOME}/bin/g++; ln -s `which gcc-4.8` ${HOME}/bin/gcc; fi - - if [ "${CXX}" == "clang" ]; then + - if [ "${CC}" = "clang" ]; then export TOOLSET="clang"; - ln -s `which clang-3.6` ${HOME}/bin/g++; + ln -s `which clang-3.6` ${HOME}/bin/clang; ln -s `which clang++-3.6` ${HOME}/bin/clang++; fi - export BOOST_VERSION=${BOOST_VER//./_} From b10dfbbd63fb527b8606aa62acf16d7950662f8d Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Tue, 3 Nov 2015 01:12:22 +1100 Subject: [PATCH 024/123] Only produce shared+multithreaded debug & release boost libs --- install-boost.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-boost.sh b/install-boost.sh index 6eba749e4..c28d4e02f 100755 --- a/install-boost.sh +++ b/install-boost.sh @@ -6,7 +6,7 @@ if [ ! -d "${HOME}/${CC}-boost_${BOOST_VERSION}/include" ]; then tar jxf boost_${BOOST_VERSION}.tar.bz2 cd boost_${BOOST_VERSION} ./bootstrap.sh --with-toolset=$TOOLSET --prefix=${HOME}/${CC}-boost_${BOOST_VERSION} - ./b2 --stagedir=. -j2 --build-type=complete --layout=tagged cxxflags='-std=c++11' install >boost-build.log 2>&1 + ./b2 --stagedir=. -j2 --layout=tagged variant=debug,release link=shared threading=multi address-model=64 cxxflags='-std=c++11' install >boost-build.log 2>&1 cd .. rm -rf boost_${BOOST_VERSION} rm -rf boost_${BOOST_VERSION}.tar.bz2 From 8cb4c16ffb88ec0b368b0cc13b7d7efb8782fdd0 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Tue, 3 Nov 2015 01:32:19 +1100 Subject: [PATCH 025/123] Looks like we need static libs too --- install-boost.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-boost.sh b/install-boost.sh index c28d4e02f..5d5fa41ae 100755 --- a/install-boost.sh +++ b/install-boost.sh @@ -6,7 +6,7 @@ if [ ! -d "${HOME}/${CC}-boost_${BOOST_VERSION}/include" ]; then tar jxf boost_${BOOST_VERSION}.tar.bz2 cd boost_${BOOST_VERSION} ./bootstrap.sh --with-toolset=$TOOLSET --prefix=${HOME}/${CC}-boost_${BOOST_VERSION} - ./b2 --stagedir=. -j2 --layout=tagged variant=debug,release link=shared threading=multi address-model=64 cxxflags='-std=c++11' install >boost-build.log 2>&1 + ./b2 --stagedir=. -j2 --layout=tagged variant=debug,release link=shared,static threading=multi address-model=64 cxxflags='-std=c++11' install >boost-build.log 2>&1 cd .. rm -rf boost_${BOOST_VERSION} rm -rf boost_${BOOST_VERSION}.tar.bz2 From 198dd07976bee9b266574942be6494b50dc7aebe Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Tue, 3 Nov 2015 01:59:55 +1100 Subject: [PATCH 026/123] Integrate travis; Use Boost 1.57 at least; Always use shared libs from Boost. --- .travis.yml | 74 +++++++++++++++++++++--------------------------- CMakeLists.txt | 9 +++--- install-boost.sh | 2 +- 3 files changed, 38 insertions(+), 47 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9abf5f5a8..4c79e7bb9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,55 +1,45 @@ sudo: false language: cpp - compiler: - - g++ - - clang - +- g++ +- clang env: - - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" - - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" - - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" - - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" - - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" - - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" - - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" - - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" - +- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" +- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" +- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" +- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" +- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON" +- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" +- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" +- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" install: - - mkdir -p ${HOME}/bin - - if [ "${CC}" = "gcc" ]; then - export TOOLSET="gcc"; - ln -s `which g++-4.8` ${HOME}/bin/g++; - ln -s `which gcc-4.8` ${HOME}/bin/gcc; - fi - - if [ "${CC}" = "clang" ]; then - export TOOLSET="clang"; - ln -s `which clang-3.6` ${HOME}/bin/clang; - ln -s `which clang++-3.6` ${HOME}/bin/clang++; - fi - - export BOOST_VERSION=${BOOST_VER//./_} - - export PATH=${HOME}/bin:${PATH} - - travis_wait ./install-boost.sh - - export BOOST_ROOT=${HOME}/${CC}-boost_${BOOST_VER//./_} - - ${CXX} --version - +- mkdir -p ${HOME}/bin +- if [ "${CC}" = "gcc" ]; then export TOOLSET="gcc"; ln -s `which g++-4.8` ${HOME}/bin/g++; + ln -s `which gcc-4.8` ${HOME}/bin/gcc; fi +- if [ "${CC}" = "clang" ]; then export TOOLSET="clang"; ln -s `which clang-3.6` ${HOME}/bin/clang; + ln -s `which clang++-3.6` ${HOME}/bin/clang++; fi +- export BOOST_VERSION=${BOOST_VER//./_} +- export PATH=${HOME}/bin:${PATH} +- travis_wait ./install-boost.sh +- export BOOST_ROOT=${HOME}/${CC}-boost_${BOOST_VER//./_} +- "${CXX} --version" cache: directories: - - ${HOME}/${CC}-boost_${BOOST_VER//./_} - + - "${HOME}/${CC}-boost_${BOOST_VER//./_}" script: - - pwd - - sh -x build.sh - +- pwd +- sh -x build.sh after_failure: - - cat Testing/Temporary/LastTest.log - +- cat Testing/Temporary/LastTest.log addons: apt: sources: - - ubuntu-toolchain-r-test - - llvm-toolchain-precise-3.6 + - ubuntu-toolchain-r-test + - llvm-toolchain-precise-3.6 packages: - - gcc-4.8 - - g++-4.8 - - clang-3.6 + - gcc-4.8 + - g++-4.8 + - clang-3.6 +notifications: + slack: + secure: Y7lLjqZ83+b/jaJ5+EKwvgCDeERi4bVbDn9tLp8sieTdu+ENsPI+JmLYSXZXPpe7JrItrXW6uJJXN2wG1h7au4mpVVTghd31HBzuzrqVxDphWPhp16NYzvbAgQQRBXvFVvfSdW/Kb/n2fX6xDApY0t6vNREb/GKg0GyzESb4ZjU= diff --git a/CMakeLists.txt b/CMakeLists.txt index 91bc3e77e..856c31a02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,21 +27,22 @@ if(NOT IS_ABSOLUTE "${INSTALL_CMAKE_DIR}") set(INSTALL_CMAKE_DIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_CMAKE_DIR}") endif() - if(CPP-NETLIB_BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS) message (STATUS "Linking boost testing libs dynamically...") - set(Boost_USE_STATIC_LIBS OFF) set(CPP-NETLIB_BUILD_SHARED_LIBS ON) set(BUILD_SHARED_LIBS ON) add_definitions(-DBOOST_TEST_DYN_LINK) else() - set(Boost_USE_STATIC_LIBS ON) set(CPP-NETLIB_BUILD_SHARED_LIBS OFF) set(BUILD_SHARED_LIBS OFF) endif() +# Always use Boost's shared libraries. +set(Boost_USE_STATIC_LIBS OFF) + +# Always use multi-threaded Boost libraries. set(Boost_USE_MULTI_THREADED ON) -find_package( Boost 1.54.0 +find_package( Boost 1.57.0 REQUIRED unit_test_framework system regex date_time thread filesystem program_options chrono atomic ) diff --git a/install-boost.sh b/install-boost.sh index 5d5fa41ae..25607fb06 100755 --- a/install-boost.sh +++ b/install-boost.sh @@ -6,7 +6,7 @@ if [ ! -d "${HOME}/${CC}-boost_${BOOST_VERSION}/include" ]; then tar jxf boost_${BOOST_VERSION}.tar.bz2 cd boost_${BOOST_VERSION} ./bootstrap.sh --with-toolset=$TOOLSET --prefix=${HOME}/${CC}-boost_${BOOST_VERSION} - ./b2 --stagedir=. -j2 --layout=tagged variant=debug,release link=shared,static threading=multi address-model=64 cxxflags='-std=c++11' install >boost-build.log 2>&1 + ./b2 --stagedir=. -j4 --layout=tagged variant=debug,release link=shared threading=multi address-model=64 cxxflags='-std=c++11' install >boost-build.log 2>&1 cd .. rm -rf boost_${BOOST_VERSION} rm -rf boost_${BOOST_VERSION}.tar.bz2 From f6c7ee64d2aab95bc0b1dae9fc90d57a78860bda Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Tue, 3 Nov 2015 02:47:17 +1100 Subject: [PATCH 027/123] Use the dynamic version of Boost.Test always. --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 856c31a02..eadc34ea3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,6 @@ if(CPP-NETLIB_BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS) message (STATUS "Linking boost testing libs dynamically...") set(CPP-NETLIB_BUILD_SHARED_LIBS ON) set(BUILD_SHARED_LIBS ON) - add_definitions(-DBOOST_TEST_DYN_LINK) else() set(CPP-NETLIB_BUILD_SHARED_LIBS OFF) set(BUILD_SHARED_LIBS OFF) @@ -40,8 +39,12 @@ endif() # Always use Boost's shared libraries. set(Boost_USE_STATIC_LIBS OFF) +# We need this for all tests to use the dynamic version. +add_definitions(-DBOOST_TEST_DYN_LINK) + # Always use multi-threaded Boost libraries. set(Boost_USE_MULTI_THREADED ON) + find_package( Boost 1.57.0 REQUIRED unit_test_framework system regex date_time thread filesystem program_options chrono atomic ) From de7c710d05f3b94d2aaa56562d6a9969f8900da5 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Wed, 4 Nov 2015 18:27:06 +1100 Subject: [PATCH 028/123] Use v4 again instead of just address --- .../network/protocol/http/client/connection/normal_delegate.ipp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boost/network/protocol/http/client/connection/normal_delegate.ipp b/boost/network/protocol/http/client/connection/normal_delegate.ipp index 103b059b7..ddffc0a78 100644 --- a/boost/network/protocol/http/client/connection/normal_delegate.ipp +++ b/boost/network/protocol/http/client/connection/normal_delegate.ipp @@ -28,7 +28,7 @@ void boost::network::http::impl::normal_delegate::connect( socket_.reset(new asio::ip::tcp::socket( service_, - asio::ip::tcp::endpoint(asio::ip::address(), source_port))); + asio::ip::tcp::endpoint(asio::ip::v4(), source_port))); socket_->async_connect(endpoint, handler); } From 39a27054d8f0ac2909ec3a601a855946f15dfecc Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Wed, 4 Nov 2015 18:28:08 +1100 Subject: [PATCH 029/123] v4() for real this time --- .../network/protocol/http/client/connection/normal_delegate.ipp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boost/network/protocol/http/client/connection/normal_delegate.ipp b/boost/network/protocol/http/client/connection/normal_delegate.ipp index ddffc0a78..1a6046a79 100644 --- a/boost/network/protocol/http/client/connection/normal_delegate.ipp +++ b/boost/network/protocol/http/client/connection/normal_delegate.ipp @@ -28,7 +28,7 @@ void boost::network::http::impl::normal_delegate::connect( socket_.reset(new asio::ip::tcp::socket( service_, - asio::ip::tcp::endpoint(asio::ip::v4(), source_port))); + asio::ip::tcp::endpoint(asio::ip::tcp::v4(), source_port))); socket_->async_connect(endpoint, handler); } From 2e3340f07d3c86b32719173db0ea6b00e262c9a9 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Thu, 12 Nov 2015 23:30:12 +1100 Subject: [PATCH 030/123] Change test to fetch different targets --- .gitignore | 1 + boost/mime.hpp | 42 +++++++++---------- .../protocol/http/client/async_impl.hpp | 10 ++--- .../http/client/connection/async_normal.hpp | 4 +- .../client/connection/normal_delegate.ipp | 2 +- .../http/client/connection/sync_normal.hpp | 12 +++--- libs/network/test/http/client_get_test.cpp | 28 ++++++++----- 7 files changed, 54 insertions(+), 45 deletions(-) diff --git a/.gitignore b/.gitignore index 9e4137734..5781679f5 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ libs/mime/test/mime-roundtrip *.a _build /.project +build/ diff --git a/boost/mime.hpp b/boost/mime.hpp index e45d59c11..ecc9c160a 100644 --- a/boost/mime.hpp +++ b/boost/mime.hpp @@ -9,21 +9,21 @@ #ifndef _BOOST_MIME_HPP #define _BOOST_MIME_HPP +#include #include #include #include -#include -#include +#include #include #include // pulls in all of Phoenix +#include #include -#include -#include -#include -#include #include +#include +#include +#include // #define DUMP_MIME_DATA 1 @@ -321,7 +321,8 @@ static void read_multipart_body(Iterator &begin, Iterator end, "= %d %s") % mp_body.body_prolog.size() % mp_body.sub_parts.size() % mp_body.body_epilog.size() % - (mp_body.prolog_is_missing ? "(missing)" : "")) << std::endl; + (mp_body.prolog_is_missing ? "(missing)" : "")) + << std::endl; std::cout << std::endl << "****** Multipart Body Prolog *******" << std::endl; std::copy(mp_body.body_prolog.begin(), mp_body.body_prolog.end(), std::ostream_iterator(std::cout)); @@ -381,11 +382,7 @@ static boost::shared_ptr > parse_mime( template class basic_mime { public: - typedef enum { - simple_part, - multi_part, - message_part - } part_kind; + typedef enum { simple_part, multi_part, message_part } part_kind; // Types for headers typedef typename traits::string_type string_type; typedef std::pair headerEntry; @@ -618,8 +615,7 @@ class basic_mime { std::string boundary; try { boundary = detail::get_boundary(get_content_type_header()); - } - catch (std::runtime_error &) { + } catch (std::runtime_error &) { // FIXME: Make boundary strings (more?) unique boundary = str(boost::format("------=_NextPart-%s.%08ld") % detail::k_package_name % std::clock()); @@ -707,9 +703,8 @@ class basic_mime { else if (get_part_kind() == multi_part) { if (idx >= m_subparts.size()) throw std::runtime_error( - str(boost::format( - "Trying to access part %d (of %d) sub-part to a " - "multipart/xxx mime part") % + str(boost::format("Trying to access part %d (of %d) sub-part to a " + "multipart/xxx mime part") % idx % m_subparts.size())); } else { // message-part if (get_part_kind() == message_part) @@ -720,9 +715,8 @@ class basic_mime { if (idx >= m_subparts.size()) throw std::runtime_error( - str(boost::format( - "Trying to access part %d (of %d) sub-part to a " - "message/xxx mime part") % + str(boost::format("Trying to access part %d (of %d) sub-part to a " + "message/xxx mime part") % idx % m_subparts.size())); } } @@ -764,12 +758,14 @@ static boost::shared_ptr > parse_mime( #ifdef DUMP_MIME_DATA std::cout << "Content-Type: " << content_type << std::endl; std::cout << str(boost::format("retVal->get_part_kind () = %d") % - ((int)retVal->get_part_kind())) << std::endl; + ((int)retVal->get_part_kind())) + << std::endl; #endif if (retVal->get_part_kind() == mime_part::simple_part) - retVal->set_body(detail::read_simplepart_body< - typename mime_part::bodyContainer, Iterator>(begin, end)); + retVal->set_body( + detail::read_simplepart_body(begin, end)); else if (retVal->get_part_kind() == mime_part::message_part) { // If we've got a message/xxxx, then there is no body, and we have // a single diff --git a/boost/network/protocol/http/client/async_impl.hpp b/boost/network/protocol/http/client/async_impl.hpp index ca2805e3d..a70a90b36 100644 --- a/boost/network/protocol/http/client/async_impl.hpp +++ b/boost/network/protocol/http/client/async_impl.hpp @@ -40,11 +40,11 @@ struct async_client async_client(bool cache_resolved, bool follow_redirect, bool always_verify_peer, int timeout, boost::shared_ptr service, - optional certificate_filename, - optional verify_path, - optional certificate_file, - optional private_key_file, - optional ciphers, long ssl_options) + optional certificate_filename, + optional verify_path, + optional certificate_file, + optional private_key_file, + optional ciphers, long ssl_options) : connection_base(cache_resolved, follow_redirect, timeout), service_ptr(service.get() ? service diff --git a/boost/network/protocol/http/client/connection/async_normal.hpp b/boost/network/protocol/http/client/connection/async_normal.hpp index b5002344c..443d514c2 100644 --- a/boost/network/protocol/http/client/connection/async_normal.hpp +++ b/boost/network/protocol/http/client/connection/async_normal.hpp @@ -50,6 +50,9 @@ struct http_async_connection protected http_async_protocol_handler, boost::enable_shared_from_this< http_async_connection > { + + http_async_connection(http_async_connection const&) = delete; + typedef async_connection_base base; typedef http_async_protocol_handler protocol_base; @@ -115,7 +118,6 @@ struct http_async_connection } private: - http_async_connection(http_async_connection const&); // = delete void set_errors(boost::system::error_code const& ec) { boost::system::system_error error(ec); diff --git a/boost/network/protocol/http/client/connection/normal_delegate.ipp b/boost/network/protocol/http/client/connection/normal_delegate.ipp index 1a6046a79..103b059b7 100644 --- a/boost/network/protocol/http/client/connection/normal_delegate.ipp +++ b/boost/network/protocol/http/client/connection/normal_delegate.ipp @@ -28,7 +28,7 @@ void boost::network::http::impl::normal_delegate::connect( socket_.reset(new asio::ip::tcp::socket( service_, - asio::ip::tcp::endpoint(asio::ip::tcp::v4(), source_port))); + asio::ip::tcp::endpoint(asio::ip::address(), source_port))); socket_->async_connect(endpoint, handler); } diff --git a/boost/network/protocol/http/client/connection/sync_normal.hpp b/boost/network/protocol/http/client/connection/sync_normal.hpp index e02c75f57..db2feeae4 100644 --- a/boost/network/protocol/http/client/connection/sync_normal.hpp +++ b/boost/network/protocol/http/client/connection/sync_normal.hpp @@ -8,11 +8,13 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include #include +#include +#include +#include #include -#include - namespace boost { namespace network { namespace http { @@ -50,11 +52,11 @@ struct http_sync_connection resolve_(std::move(resolve)), socket_(resolver.get_io_service()) {} - void init_socket(string_type /*unused*/const& hostname, string_type const& port) { + void init_socket(string_type const& hostname, string_type const& port) { connection_base::init_socket(socket_, resolver_, hostname, port, resolve_); } - void send_request_impl(string_type /*unused*/const& method, + void send_request_impl(string_type const& method, basic_request const& request_, body_generator_function_type generator) { boost::asio::streambuf request_buffer; @@ -130,7 +132,7 @@ struct http_sync_connection }; } // namespace impl -} // namespace http +} // namespace http } // namespace network } // namespace boost diff --git a/libs/network/test/http/client_get_test.cpp b/libs/network/test/http/client_get_test.cpp index 3cc596367..6b6337b44 100644 --- a/libs/network/test/http/client_get_test.cpp +++ b/libs/network/test/http/client_get_test.cpp @@ -12,29 +12,37 @@ namespace net = boost::network; namespace http = boost::network::http; BOOST_AUTO_TEST_CASE_TEMPLATE(http_client_get_test, client, client_types) { - typename client::request request("http://www.boost.org"); + typename client::request request("http://cpp-netlib.org/"); client client_; typename client::response response; BOOST_REQUIRE_NO_THROW(response = client_.get(request)); typename net::headers_range::type range = headers(response)["Content-Type"]; - BOOST_CHECK(!boost::empty(range)); - BOOST_REQUIRE_NO_THROW(BOOST_CHECK(body(response).size() != 0)); + try { + auto data = body(response); + } catch (...) { + BOOST_ASSERT(false); + } BOOST_CHECK_EQUAL(response.version().substr(0, 7), std::string("HTTP/1.")); - BOOST_CHECK_EQUAL(response.status(), 200u); - BOOST_CHECK_EQUAL(response.status_message(), std::string("OK")); + BOOST_CHECK(response.status() == 200u || + (response.status() >= 300 && response.status() < 400)); } #ifdef BOOST_NETWORK_ENABLE_HTTPS BOOST_AUTO_TEST_CASE_TEMPLATE(https_client_get_test, client, client_types) { - typename client::request request("https://www.google.com/"); + typename client::request request("https://www.github.com/"); client client_; - typename client::response response_ = client_.get(request); + typename client::response response = client_.get(request); typename net::headers_range::type range = - headers(response_)["Content-Type"]; - BOOST_CHECK(boost::begin(range) != boost::end(range)); - BOOST_CHECK(body(response_).size() != 0); + headers(response)["Content-Type"]; + BOOST_CHECK(response.status() == 200 || + (response.status() >= 300 && response.status() < 400)); + try { + auto data = body(response); + } catch (...) { + BOOST_ASSERT(false); + } } #endif From 7e0f93e9ea1fae2a424d0263ae4ddedfbf0670e2 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Thu, 12 Nov 2015 23:50:46 +1100 Subject: [PATCH 031/123] Simplify http test --- libs/network/test/http/client_get_test.cpp | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/libs/network/test/http/client_get_test.cpp b/libs/network/test/http/client_get_test.cpp index 6b6337b44..dcc24cd04 100644 --- a/libs/network/test/http/client_get_test.cpp +++ b/libs/network/test/http/client_get_test.cpp @@ -3,7 +3,7 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#define BOOST_TEST_MODULE HTTP 1.0 Get Test +#define BOOST_TEST_MODULE HTTP Get Test #include #include #include "client_types.hpp" @@ -16,10 +16,9 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(http_client_get_test, client, client_types) { client client_; typename client::response response; BOOST_REQUIRE_NO_THROW(response = client_.get(request)); - typename net::headers_range::type range = - headers(response)["Content-Type"]; try { auto data = body(response); + std::cout << data; } catch (...) { BOOST_ASSERT(false); } @@ -34,12 +33,11 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(https_client_get_test, client, client_types) { typename client::request request("https://www.github.com/"); client client_; typename client::response response = client_.get(request); - typename net::headers_range::type range = - headers(response)["Content-Type"]; BOOST_CHECK(response.status() == 200 || (response.status() >= 300 && response.status() < 400)); try { auto data = body(response); + std::cout << data; } catch (...) { BOOST_ASSERT(false); } @@ -48,14 +46,18 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(https_client_get_test, client, client_types) { #endif BOOST_AUTO_TEST_CASE_TEMPLATE(http_temp_client_get_test, client, client_types) { - typename client::request request("http://www.google.co.kr"); + typename client::request request("http://cpp-netlib.org/"); typename client::response response; BOOST_REQUIRE_NO_THROW(response = client().get(request)); - typename net::headers_range::type range = - headers(response)["Content-Type"]; + auto range = headers(response); BOOST_CHECK(!boost::empty(range)); - BOOST_REQUIRE_NO_THROW(BOOST_CHECK(body(response).size() != 0)); + try { + auto data = body(response); + std::cout << data; + } catch (...) { + BOOST_ASSERT(false); + } BOOST_CHECK_EQUAL(response.version().substr(0, 7), std::string("HTTP/1.")); - BOOST_CHECK_EQUAL(response.status(), 200u); - BOOST_CHECK_EQUAL(response.status_message(), std::string("OK")); + BOOST_CHECK(response.status() == 200u || + (response.status() >= 300 && response.status() < 400)); } From 552401b631c4b352400847e341de6f7a8483e8c2 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Fri, 13 Nov 2015 00:01:56 +1100 Subject: [PATCH 032/123] Use ninja-build --- .travis.yml | 1 + build.sh | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4c79e7bb9..26e422412 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,6 +40,7 @@ addons: - gcc-4.8 - g++-4.8 - clang-3.6 + - ninja-build notifications: slack: secure: Y7lLjqZ83+b/jaJ5+EKwvgCDeERi4bVbDn9tLp8sieTdu+ENsPI+JmLYSXZXPpe7JrItrXW6uJJXN2wG1h7au4mpVVTghd31HBzuzrqVxDphWPhp16NYzvbAgQQRBXvFVvfSdW/Kb/n2fX6xDApY0t6vNREb/GKg0GyzESb4ZjU= diff --git a/build.sh b/build.sh index 7d776f907..fc62a6161 100755 --- a/build.sh +++ b/build.sh @@ -9,7 +9,8 @@ cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \ -DBOOST_INCLUDEDIR="${HOME}/${CC}-boost_${BOOST_VERSION}/include" \ -DBOOST_LIBRARYDIR="${HOME}/${CC}-boost_${BOOST_VERSION}/lib" \ -DCMAKE_CXX_FLAGS='-std=c++11' \ + -G Ninja \ .. -make -j2 -make test +ninja +ninja test cd .. From 19beafb9e7dd7ec0e971f5aa4f3d688aee9bd129 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Fri, 13 Nov 2015 00:04:32 +1100 Subject: [PATCH 033/123] Update cmake --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 26e422412..d8b4accec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,6 +41,7 @@ addons: - g++-4.8 - clang-3.6 - ninja-build + - cmake notifications: slack: secure: Y7lLjqZ83+b/jaJ5+EKwvgCDeERi4bVbDn9tLp8sieTdu+ENsPI+JmLYSXZXPpe7JrItrXW6uJJXN2wG1h7au4mpVVTghd31HBzuzrqVxDphWPhp16NYzvbAgQQRBXvFVvfSdW/Kb/n2fX6xDApY0t6vNREb/GKg0GyzESb4ZjU= From 99f6168a844329cfce10e528d24d4517a9fd1ae2 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Fri, 13 Nov 2015 00:09:46 +1100 Subject: [PATCH 034/123] Use updated cmake to support ninja-build --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index d8b4accec..b05dceef7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,6 +36,7 @@ addons: sources: - ubuntu-toolchain-r-test - llvm-toolchain-precise-3.6 + - kalakris-cmake packages: - gcc-4.8 - g++-4.8 From 937d589904b4abca159a7ff0715cf76a1395e9f2 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Fri, 13 Nov 2015 00:19:56 +1100 Subject: [PATCH 035/123] Travis cannot handle ninja builds yet, probably to lack of resources for build --- .travis.yml | 1 - build.sh | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index b05dceef7..ff194ccdd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,7 +41,6 @@ addons: - gcc-4.8 - g++-4.8 - clang-3.6 - - ninja-build - cmake notifications: slack: diff --git a/build.sh b/build.sh index fc62a6161..6b0a4a71d 100755 --- a/build.sh +++ b/build.sh @@ -9,8 +9,7 @@ cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \ -DBOOST_INCLUDEDIR="${HOME}/${CC}-boost_${BOOST_VERSION}/include" \ -DBOOST_LIBRARYDIR="${HOME}/${CC}-boost_${BOOST_VERSION}/lib" \ -DCMAKE_CXX_FLAGS='-std=c++11' \ - -G Ninja \ .. -ninja -ninja test +make -j4 +make test cd .. From d5ec24efcaeec37678b28a458ef2432ce83271b9 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Fri, 13 Nov 2015 00:23:44 +1100 Subject: [PATCH 036/123] j4 is too much. :( --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 6b0a4a71d..7d776f907 100755 --- a/build.sh +++ b/build.sh @@ -10,6 +10,6 @@ cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \ -DBOOST_LIBRARYDIR="${HOME}/${CC}-boost_${BOOST_VERSION}/lib" \ -DCMAKE_CXX_FLAGS='-std=c++11' \ .. -make -j4 +make -j2 make test cd .. From d661fcca27c2a40531258bf141529dccc8d40019 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Fri, 13 Nov 2015 00:36:50 +1100 Subject: [PATCH 037/123] Check with the sanitizers --- .travis.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.travis.yml b/.travis.yml index ff194ccdd..a1830ae94 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,18 @@ env: - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF" - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF" +# Support the sanitizers in clang only +- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=thread" +- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=address" +- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=memory" +matrix: + exclude: + - compiler: g++ + env: BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=thread" + - compiler: g++ + env: BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=address" + - compiler: g++ + env: BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=memory" install: - mkdir -p ${HOME}/bin - if [ "${CC}" = "gcc" ]; then export TOOLSET="gcc"; ln -s `which g++-4.8` ${HOME}/bin/g++; From 57513386e9551f9e3560f8f3a4b52c326f825dcc Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Fri, 13 Nov 2015 00:52:25 +1100 Subject: [PATCH 038/123] Honor the CMAKE_CXX_FLAGS environment variable --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 7d776f907..63f05de7e 100755 --- a/build.sh +++ b/build.sh @@ -8,7 +8,7 @@ cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \ -DCPP-NETLIB_ENABLE_HTTPS=$ENABLE_HTTPS \ -DBOOST_INCLUDEDIR="${HOME}/${CC}-boost_${BOOST_VERSION}/include" \ -DBOOST_LIBRARYDIR="${HOME}/${CC}-boost_${BOOST_VERSION}/lib" \ - -DCMAKE_CXX_FLAGS='-std=c++11' \ + -DCMAKE_CXX_FLAGS="-std=c++11 ${CMAKE_CXX_FLAGS}" \ .. make -j2 make test From 511dd04b58b8c75803d32fd4c27c0b2e4a4820ae Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Fri, 13 Nov 2015 01:05:45 +1100 Subject: [PATCH 039/123] Print latest log properly --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a1830ae94..ec22ccb4d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,7 +42,7 @@ script: - pwd - sh -x build.sh after_failure: -- cat Testing/Temporary/LastTest.log +- cat build/Testing/Temporary/LastTest.log addons: apt: sources: From 9fbc3008679edf85bc866196e55fe2abf9580f43 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Mon, 16 Nov 2015 23:24:19 +1100 Subject: [PATCH 040/123] Fix some issues with the (deprecated) synchronous client implementation running under tsan; also require C++11 in GNU compilers moving forward by default --- CMakeLists.txt | 14 ++-- .../http/client/connection/sync_normal.hpp | 19 +++-- .../http/policies/pooled_connection.hpp | 77 ++++++++++--------- 3 files changed, 59 insertions(+), 51 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eadc34ea3..4bcccc5dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,16 +71,12 @@ if (OPENSSL_FOUND) endif() if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") + # Use C++11 when using GNU compilers. + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11") elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang) - if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - # We want to link in C++11 mode if we're using Clang and on OS X. - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -ftemplate-depth=256 -std=c++11 -stdlib=libc++") - else() - # We just add the -Wall and a high enough template depth - # flag for Clang in other systems. - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -ftemplate-depth=256") - endif() + # We want to link in C++11 mode in Clang too, but also set a high enough + # template depth for the template metaprogramming. + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -ftemplate-depth=256 -std=c++11 -stdlib=libc++") endif() diff --git a/boost/network/protocol/http/client/connection/sync_normal.hpp b/boost/network/protocol/http/client/connection/sync_normal.hpp index db2feeae4..5ef295d35 100644 --- a/boost/network/protocol/http/client/connection/sync_normal.hpp +++ b/boost/network/protocol/http/client/connection/sync_normal.hpp @@ -9,6 +9,7 @@ // http://www.boost.org/LICENSE_1_0.txt) #include +#include #include #include #include @@ -97,7 +98,8 @@ struct http_sync_connection connection_base::read_body(socket_, response_, response_buffer); typename headers_range >::type connection_range = headers(response_)["Connection"]; - if (version_major == 1 && version_minor == 1 && !boost::empty(connection_range) && + if (version_major == 1 && version_minor == 1 && + !boost::empty(connection_range) && boost::iequals(boost::begin(connection_range)->second, "close")) { close_socket(); } else if (version_major == 1 && version_minor == 0) { @@ -109,19 +111,22 @@ struct http_sync_connection void close_socket() { timer_.cancel(); - if (!is_open()) { return; -} + if (!is_open()) { + return; + } boost::system::error_code ignored; socket_.shutdown(boost::asio::ip::tcp::socket::shutdown_both, ignored); - if (ignored != nullptr) { return; -} + if (ignored != nullptr) { + return; + } socket_.close(ignored); } private: void handle_timeout(boost::system::error_code const& ec) { - if (!ec) { close_socket(); -} + if (!ec) { + close_socket(); + } } int timeout_; diff --git a/boost/network/protocol/http/policies/pooled_connection.hpp b/boost/network/protocol/http/policies/pooled_connection.hpp index 411641a7b..21ecc9950 100644 --- a/boost/network/protocol/http/policies/pooled_connection.hpp +++ b/boost/network/protocol/http/policies/pooled_connection.hpp @@ -7,12 +7,12 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include - #include #include #include +#include #include +#include #include #include @@ -37,7 +37,7 @@ struct pooled_connection_policy : resolver_policy::type { system::error_code const&)> body_callback_function_type; typedef function body_generator_function_type; - void cleanup() { host_connection_map().swap(host_connections); } + void cleanup() { host_connection_map().swap(host_connections_); } struct connection_impl { typedef function( @@ -47,10 +47,10 @@ struct pooled_connection_policy : resolver_policy::type { get_connection_function; connection_impl( - resolver_type& resolver, bool follow_redirect, string_type /*unused*/const& host, - string_type const& port, resolver_function_type resolve, - get_connection_function get_connection, bool https, - bool always_verify_peer, int timeout, + resolver_type& resolver, bool follow_redirect, + string_type /*unused*/ const& host, string_type const& port, + resolver_function_type resolve, get_connection_function get_connection, + bool https, bool always_verify_peer, int timeout, optional const& certificate_filename = optional(), optional const& verify_path = optional(), @@ -77,7 +77,7 @@ struct pooled_connection_policy : resolver_policy::type { (void)port; } - basic_response send_request(string_type /*unused*/const& method, + basic_response send_request(string_type const& method, basic_request request_, bool get_body, body_callback_function_type callback, body_generator_function_type generator) { @@ -86,7 +86,7 @@ struct pooled_connection_policy : resolver_policy::type { private: basic_response send_request_impl( - string_type /*unused*/const& method, basic_request request_, bool get_body, + string_type const& method, basic_request request_, bool get_body, body_callback_function_type callback, body_generator_function_type generator) { // TODO(dberris): review parameter necessity. @@ -113,8 +113,7 @@ struct pooled_connection_policy : resolver_policy::type { try { pimpl->read_status(response_, response_buffer); - } - catch (boost::system::system_error& e) { + } catch (boost::system::system_error& e) { if (!retry && e.code() == boost::asio::error::eof) { retry = true; pimpl->init_socket(request_.host(), @@ -182,15 +181,16 @@ struct pooled_connection_policy : resolver_policy::type { typedef shared_ptr connection_ptr; - typedef unordered_map host_connection_map; - host_connection_map host_connections; + typedef unordered_map> host_connection_map; + boost::mutex host_mutex_; + host_connection_map host_connections_; bool follow_redirect_; int timeout_; connection_ptr get_connection( resolver_type& resolver, basic_request const& request_, bool always_verify_peer, - optional /*unused*/const& certificate_filename = + optional const& certificate_filename = optional(), optional const& verify_path = optional(), optional const& certificate_file = optional(), @@ -198,33 +198,40 @@ struct pooled_connection_policy : resolver_policy::type { optional const& ciphers = optional()) { string_type index = (request_.host() + ':') + lexical_cast(request_.port()); - connection_ptr connection_; - typename host_connection_map::iterator it = host_connections.find(index); - if (it == host_connections.end()) { - connection_.reset(new connection_impl( - resolver, follow_redirect_, request_.host(), - lexical_cast(request_.port()), - boost::bind(&pooled_connection_policy::resolve, - this, boost::arg<1>(), boost::arg<2>(), boost::arg<3>()), - boost::bind(&pooled_connection_policy::get_connection, - this, boost::arg<1>(), boost::arg<2>(), - always_verify_peer, boost::arg<3>(), boost::arg<4>(), - boost::arg<5>(), boost::arg<6>(), boost::arg<7>()), - boost::iequals(request_.protocol(), string_type("https")), - always_verify_peer, timeout_, certificate_filename, verify_path, - certificate_file, private_key_file, ciphers, 0)); - host_connections.insert(std::make_pair(index, connection_)); - return connection_; + boost::mutex::scoped_lock lock(host_mutex_); + auto it = host_connections_.find(index); + if (it != host_connections_.end()) { + // We've found an existing connection; but we should check if that + // connection hasn't been deleted yet. + auto result = it->second.lock(); + if (!result) return result; } - return it->second; + + connection_ptr connection(new connection_impl( + resolver, follow_redirect_, request_.host(), + lexical_cast(request_.port()), + // resolver function + boost::bind(&pooled_connection_policy::resolve, + this, boost::arg<1>(), boost::arg<2>(), boost::arg<3>()), + // connection factory + boost::bind(&pooled_connection_policy::get_connection, + this, boost::arg<1>(), boost::arg<2>(), always_verify_peer, + boost::arg<3>(), boost::arg<4>(), boost::arg<5>(), + boost::arg<6>(), boost::arg<7>()), + boost::iequals(request_.protocol(), string_type("https")), + always_verify_peer, timeout_, certificate_filename, verify_path, + certificate_file, private_key_file, ciphers, 0)); + host_connections_.insert(std::make_pair(index, connection)); + return connection; } pooled_connection_policy(bool cache_resolved, bool follow_redirect, int timeout) : resolver_base(cache_resolved), - host_connections(), + host_mutex_(), + host_connections_(), follow_redirect_(follow_redirect), timeout_(timeout) {} }; From 2f2239cbd2b1946f8f378dbdf36d50d9f8ea8cc9 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Mon, 16 Nov 2015 23:52:05 +1100 Subject: [PATCH 041/123] Only use libc++ if in OS X --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4bcccc5dc..ec04a3a57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,7 +76,11 @@ if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU) elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang) # We want to link in C++11 mode in Clang too, but also set a high enough # template depth for the template metaprogramming. - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -ftemplate-depth=256 -std=c++11 -stdlib=libc++") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -ftemplate-depth=256 -std=c++11") + if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + # Use libc++ only in OS X. + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") + endif() endif() From 4be4eae1bbac8e7dafc7df73d8b567bf69f8fb6d Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Tue, 17 Nov 2015 00:48:51 +1100 Subject: [PATCH 042/123] Issue identified with memory sanitizer --- boost/network/message.hpp | 101 ++++++++++++++++++-------------------- 1 file changed, 47 insertions(+), 54 deletions(-) diff --git a/boost/network/message.hpp b/boost/network/message.hpp index fba81d9cd..5609e9f69 100644 --- a/boost/network/message.hpp +++ b/boost/network/message.hpp @@ -3,26 +3,24 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef __NETWORK_MESSAGE_HPP__ -#define __NETWORK_MESSAGE_HPP__ +#ifndef BOOST_NETWORK_MESSAGE_HPP__ +#define BOOST_NETWORK_MESSAGE_HPP__ -#include -#include -#include #include #include #include -#include -#include - +#include #include -#include +#include #include -#include #include -#include - -#include +#include +#include +#include +#include +#include +#include +#include /** message.hpp * @@ -46,72 +44,67 @@ struct basic_message { typedef typename headers_container_type::value_type header_type; typedef typename string::type string_type; - basic_message() : _headers(), _body(), _source(), _destination() {} - - basic_message(const basic_message& other) - : _headers(other._headers), - _body(other._body), - _source(other._source), - _destination(other._destination) {} - - basic_message& operator=(basic_message rhs) { - rhs.swap(*this); - return *this; - } + basic_message() = default; + basic_message(const basic_message&) = default; + basic_message(basic_message&&) noexcept = default; + basic_message& operator=(basic_message const&) = default; + basic_message& operator=(basic_message&&) = default; + ~basic_message() = default; void swap(basic_message& other) { - std::swap(other._headers, _headers); - std::swap(other._body, _body); - std::swap(other._source, _source); - std::swap(other._destination, _destination); + using std::swap; + swap(other.headers_, headers_); + swap(other.body_, body_); + swap(other.source_, source_); + swap(other.destination_, destination_); } - headers_container_type& headers() { return _headers; } + headers_container_type& headers() { return headers_; } - void headers(headers_container_type const& headers_) const { - _headers = headers_; + void headers(headers_container_type headers) const { + headers_ = std::move(headers); } - void add_header(typename headers_container_type::value_type const& pair_) - const { - _headers.insert(pair_); + void add_header( + typename headers_container_type::value_type const& pair_) const { + headers_.insert(pair_); } - void remove_header(typename headers_container_type::key_type const& key) - const { - _headers.erase(key); + void remove_header( + typename headers_container_type::key_type const& key) const { + headers_.erase(key); } - headers_container_type const& headers() const { return _headers; } + headers_container_type const& headers() const { return headers_; } - string_type& body() { return _body; } + string_type& body() { return body_; } - void body(string_type const& body_) const { _body = body_; } + void body(string_type body) const { body_ = std::move(body); } - string_type const& body() const { return _body; } + string_type const& body() const { return body_; } - string_type& source() { return _source; } + string_type& source() { return source_; } - void source(string_type const& source_) const { _source = source_; } + void source(string_type source) const { source_ = std::move(source); } - string_type const& source() const { return _source; } + string_type const& source() const { return source_; } - string_type& destination() { return _destination; } + string_type& destination() { return destination_; } - void destination(string_type const& destination_) const { - _destination = destination_; + void destination(string_type destination) const { + destination_ = std::move(destination); } - string_type const& destination() const { return _destination; } + string_type const& destination() const { return destination_; } private: friend struct detail::directive_base; friend struct detail::wrapper_base >; - mutable headers_container_type _headers; - mutable string_type _body; - mutable string_type _source; - mutable string_type _destination; + mutable headers_container_type headers_; + mutable string_type body_; + mutable string_type source_; + mutable string_type destination_; }; template @@ -131,4 +124,4 @@ typedef basic_message wmessage; } // namespace network } // namespace boost -#endif // __NETWORK_MESSAGE_HPP__ +#endif // BOOST_NETWORK_MESSAGE_HPP__ From 600daffef4383a8e0139386d6a95fcaab3ba6ea6 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Tue, 17 Nov 2015 01:15:51 +1100 Subject: [PATCH 043/123] Fix unsafe usage of boost::as_literal, caught by memory sanitiser --- boost/network/uri/uri.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/boost/network/uri/uri.hpp b/boost/network/uri/uri.hpp index 1ffaeca59..9e7290485 100644 --- a/boost/network/uri/uri.hpp +++ b/boost/network/uri/uri.hpp @@ -310,7 +310,10 @@ inline bool operator==(const uri::string_type &lhs, const uri &rhs) { } inline bool operator==(const uri &lhs, const uri::value_type *rhs) { - return boost::equal(lhs, boost::as_literal(rhs)); + auto rlen = strlen(rhs); + auto llen = std::distance(lhs.begin(), lhs.end()); + if (rlen != std::abs(llen)) return false; + return boost::equal(lhs, boost::make_iterator_range(rhs, rhs + rlen)); } inline bool operator==(const uri::value_type *lhs, const uri &rhs) { From 03870caa0b895ec60b828c604ed9ed21ddf5bb32 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Tue, 17 Nov 2015 01:38:26 +1100 Subject: [PATCH 044/123] Force use of size_t in distance calculation --- boost/network/uri/uri.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/boost/network/uri/uri.hpp b/boost/network/uri/uri.hpp index 9e7290485..2124d8e4f 100644 --- a/boost/network/uri/uri.hpp +++ b/boost/network/uri/uri.hpp @@ -310,9 +310,9 @@ inline bool operator==(const uri::string_type &lhs, const uri &rhs) { } inline bool operator==(const uri &lhs, const uri::value_type *rhs) { - auto rlen = strlen(rhs); - auto llen = std::distance(lhs.begin(), lhs.end()); - if (rlen != std::abs(llen)) return false; + auto rlen = std::strlen(rhs); + size_t llen = std::labs(std::distance(lhs.begin(), lhs.end())); + if (rlen != llen) return false; return boost::equal(lhs, boost::make_iterator_range(rhs, rhs + rlen)); } From 9bad07c3d236ce6c8a25f7cf6abfb06c6bddd1de Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Wed, 18 Nov 2015 23:29:51 +1100 Subject: [PATCH 045/123] Removing noexcept from defaulted move constructor --- boost/network/message.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boost/network/message.hpp b/boost/network/message.hpp index 5609e9f69..9b4f08bf8 100644 --- a/boost/network/message.hpp +++ b/boost/network/message.hpp @@ -46,7 +46,7 @@ struct basic_message { basic_message() = default; basic_message(const basic_message&) = default; - basic_message(basic_message&&) noexcept = default; + basic_message(basic_message&&) = default; basic_message& operator=(basic_message const&) = default; basic_message& operator=(basic_message&&) = default; ~basic_message() = default; From 2f2c021746060092ac2f8ee16fe6efbb7635b066 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Wed, 18 Nov 2015 23:31:55 +1100 Subject: [PATCH 046/123] Track origins for memsan runs --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ec22ccb4d..8d6f30195 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ env: # Support the sanitizers in clang only - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=thread" - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=address" -- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=memory" +- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2" matrix: exclude: - compiler: g++ From 7f70dac65f4b199c333e2e633efa7538fd5a25ed Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Thu, 19 Nov 2015 00:22:55 +1100 Subject: [PATCH 047/123] Exclude msan builds from g++ --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8d6f30195..6362a069e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ matrix: - compiler: g++ env: BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=address" - compiler: g++ - env: BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=memory" + env: BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2" install: - mkdir -p ${HOME}/bin - if [ "${CC}" = "gcc" ]; then export TOOLSET="gcc"; ln -s `which g++-4.8` ${HOME}/bin/g++; From 8a8279a5f2b7367965805b535a18e055461909bf Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Thu, 19 Nov 2015 01:07:19 +1100 Subject: [PATCH 048/123] Do not use msan yet; Boost seems to be not msan-clean --- .travis.yml | 8 +++++--- boost/network/protocol/http/server/async_server.hpp | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6362a069e..e29d9c567 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,15 +15,17 @@ env: # Support the sanitizers in clang only - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=thread" - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=address" -- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2" +# TODO(deanberris): It seems Boost is not msan-clean yet; report bugs and maybe fix? +#- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2" matrix: exclude: - compiler: g++ env: BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=thread" - compiler: g++ env: BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=address" - - compiler: g++ - env: BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2" +# TODO(deanberris): It seems Boost is not msan-clean yet; report bugs and maybe fix? +# - compiler: g++ +# env: BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2" install: - mkdir -p ${HOME}/bin - if [ "${CC}" = "gcc" ]; then export TOOLSET="gcc"; ln -s `which g++-4.8` ${HOME}/bin/g++; diff --git a/boost/network/protocol/http/server/async_server.hpp b/boost/network/protocol/http/server/async_server.hpp index b3cdde502..ce3f16340 100644 --- a/boost/network/protocol/http/server/async_server.hpp +++ b/boost/network/protocol/http/server/async_server.hpp @@ -132,8 +132,8 @@ struct async_server_base : server_storage_base, socket_options_base { void start_listening() { using boost::asio::ip::tcp; system::error_code error; - service_.reset(); // this allows repeated cycles of run -> stop -> - // run + // this allows repeated cycles of run -> stop -> run + service_.reset(); tcp::resolver resolver(service_); tcp::resolver::query query(address_, port_); tcp::resolver::iterator endpoint_iterator = resolver.resolve(query, error); From 7a78eae4199cb0dd2d1734a4e1b8870beb1da931 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Thu, 17 Dec 2015 00:16:11 +1100 Subject: [PATCH 049/123] Streamlining and Refactorings This makes the following changes on the road to simplifying the implementation of the library: - Deprecate/remove the Synchronous Server implementation. - Remove all the concepts and the associated checks. - Clean up some usage of Boost.Bind to use lambda's instead. - Remove the synchronous client implementation, and make the async client the default. There's more work to be done here, and is squashed from multiple local commits. --- boost/network/constants.hpp | 3 + boost/network/include/message.hpp | 5 +- boost/network/message.hpp | 24 +-- boost/network/message/directives.hpp | 14 +- boost/network/message/message_concept.hpp | 66 ------- boost/network/message/traits/body.hpp | 13 +- boost/network/message/traits/destination.hpp | 20 +- boost/network/message/traits/source.hpp | 20 +- .../network/message/transformers/to_lower.hpp | 4 +- .../network/message/transformers/to_upper.hpp | 4 +- .../protocol/http/algorithms/linearize.hpp | 37 ++-- .../http/client/connection/async_normal.hpp | 91 ++++----- boost/network/protocol/http/impl/request.hpp | 98 ++++------ boost/network/protocol/http/message.hpp | 2 +- .../protocol/http/message/header_concept.hpp | 41 ---- .../http/message/modifiers/destination.hpp | 3 +- .../http/message/modifiers/source.hpp | 3 +- .../http/policies/async_connection.hpp | 7 +- boost/network/protocol/http/request.hpp | 56 ------ .../network/protocol/http/request_concept.hpp | 115 ----------- boost/network/protocol/http/response.hpp | 47 ++--- .../protocol/http/response_concept.hpp | 62 ------ boost/network/protocol/http/server.hpp | 12 +- .../protocol/http/server/async_connection.hpp | 182 +++++++++--------- .../protocol/http/support/sync_only.hpp | 38 ---- boost/network/protocol/http/tags.hpp | 20 +- .../protocol/http/traits/impl/delimiters.ipp | 3 +- boost/network/support/sync_only.hpp | 32 --- boost/network/tags.hpp | 12 +- libs/network/example/CMakeLists.txt | 3 +- libs/network/example/http/fileserver.cpp | 7 +- ...llo_world_async_server_with_work_queue.cpp | 4 +- .../example/http/hello_world_server.cpp | 9 +- libs/network/example/http_client.cpp | 4 +- .../http/client_get_different_port_test.cpp | 3 +- .../test/http/client_get_streaming_test.cpp | 3 +- libs/network/test/http/client_types.hpp | 10 +- .../test/http/request_linearize_test.cpp | 5 +- .../server_async_run_stop_concurrency.cpp | 2 +- .../test/http/server_constructor_test.cpp | 33 +--- libs/network/test/http/tag_types.hpp | 2 - libs/network/test/message_test.cpp | 15 +- 42 files changed, 306 insertions(+), 828 deletions(-) delete mode 100644 boost/network/message/message_concept.hpp delete mode 100644 boost/network/protocol/http/message/header_concept.hpp delete mode 100644 boost/network/protocol/http/request_concept.hpp delete mode 100644 boost/network/protocol/http/response_concept.hpp delete mode 100644 boost/network/protocol/http/support/sync_only.hpp delete mode 100644 boost/network/support/sync_only.hpp diff --git a/boost/network/constants.hpp b/boost/network/constants.hpp index a9ebfe657..3fd3060b8 100644 --- a/boost/network/constants.hpp +++ b/boost/network/constants.hpp @@ -126,6 +126,9 @@ struct constants_wide { }; } // namespace impl +template +struct unsupported_tag; + template struct constants : mpl::if_< diff --git a/boost/network/include/message.hpp b/boost/network/include/message.hpp index 77d10d42e..8201ccf77 100644 --- a/boost/network/include/message.hpp +++ b/boost/network/include/message.hpp @@ -8,7 +8,10 @@ // // This is the modular include file for using the basic message type -#include #include +#include +#include +#include +#include #endif // BOOST_NETWORK_INCLUDE_MESSAGE_HPP_ diff --git a/boost/network/message.hpp b/boost/network/message.hpp index 9b4f08bf8..013ecdf1f 100644 --- a/boost/network/message.hpp +++ b/boost/network/message.hpp @@ -1,24 +1,15 @@ -// Copyright Dean Michael Berris 2007. +// Copyright Dean Michael Berris 2007. +// Copyright Google, Inc. 2015 // 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) +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_NETWORK_MESSAGE_HPP__ #define BOOST_NETWORK_MESSAGE_HPP__ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include #include @@ -113,11 +104,6 @@ inline void swap(basic_message& left, basic_message& right) { left.swap(right); } -// Commenting this out as we don't need to do this anymore. -// BOOST_CONCEPT_ASSERT((Message -// >)); -// BOOST_CONCEPT_ASSERT((Message -// >)); typedef basic_message message; typedef basic_message wmessage; diff --git a/boost/network/message/directives.hpp b/boost/network/message/directives.hpp index 11db46af3..d1d541ada 100644 --- a/boost/network/message/directives.hpp +++ b/boost/network/message/directives.hpp @@ -1,12 +1,14 @@ -// Copyright Dean Michael Berris 2007. +// Copyright Dean Michael Berris 2007. +// Copyright Google, Inc. 2015 // 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) +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) -#ifndef __NETWORK_MESSAGE_DIRECTIVES_HPP__ -#define __NETWORK_MESSAGE_DIRECTIVES_HPP__ +#ifndef BOOST_NETWORK_MESSAGE_DIRECTIVES_HPP__ +#define BOOST_NETWORK_MESSAGE_DIRECTIVES_HPP__ +#include #include #include #include @@ -33,4 +35,4 @@ BOOST_NETWORK_STRING_DIRECTIVE(body, body_, message.body(body_), } // namespace boost -#endif // __NETWORK_MESSAGE_DIRECTIVES_HPP__ +#endif // BOOST_NETWORK_MESSAGE_DIRECTIVES_HPP__ diff --git a/boost/network/message/message_concept.hpp b/boost/network/message/message_concept.hpp deleted file mode 100644 index e2a1a1275..000000000 --- a/boost/network/message/message_concept.hpp +++ /dev/null @@ -1,66 +0,0 @@ - -#ifndef BOOST_NETWORK_MESSAGE_MESSAGE_CONCEPT_HPP_20100903 -#define BOOST_NETWORK_MESSAGE_MESSAGE_CONCEPT_HPP_20100903 - -// Copyright (c) Glyn Matthews 2010. -// Copyright 2010 (c) Dean Michael Berris. -// Copyright 2010 (c) Sinefunc, Inc. -// 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) - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace boost { -namespace network { - -template -struct Message : DefaultConstructible, CopyConstructible, Assignable { - typedef typename M::string_type string_type; - typedef typename M::headers_container_type headers_container_type; - - BOOST_CONCEPT_USAGE(Message) { - M message_; - swap(message, message_); - - typedef typename traits::body::type body_type; - typedef typename traits::source::type source_type; - typedef typename traits::destination::type destination_type; - - headers_container_type headers_ = headers(message); - string_type body_ = body(message); - string_type source_ = source(message); - string_type destination_ = destination(message); - - message << source(source_type()) << destination(destination_type()) - << header(string_type(), string_type()) << body(body_type()); - - add_header(message, string_type(), string_type()); - remove_header(message, string_type()); - clear_headers(message); - source(message, source_type()); - destination(message, destination_type()); - body(message, body_type()); - - (void)headers_; - (void)body_; - (void)source_; - (void)destination_; - } - - private: - M message; -}; - -} // namespace network - -} // namespace boost - -#endif // BOOST_NETWORK_MESSAGE_MESSAGE_CONCEPT_HPP_20100903 diff --git a/boost/network/message/traits/body.hpp b/boost/network/message/traits/body.hpp index 8f37bf6f1..4ed1edb79 100644 --- a/boost/network/message/traits/body.hpp +++ b/boost/network/message/traits/body.hpp @@ -3,20 +3,21 @@ #define BOOST_NETWORK_MESSAGE_TRAITS_BODY_HPP_20100903 // Copyright Dean Michael Berris 2010. +// Copyright Google, Inc. 2015 // 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) #include -#include #include #include +#include +#include #include #include namespace boost { namespace network { - namespace traits { template @@ -26,11 +27,13 @@ template struct body : mpl::if_< is_async, - boost::shared_future::type>, + shared_future::type>, typename mpl::if_< mpl::or_, - is_same, - is_same >, + is_same, + is_same >, typename string::type, unsupported_tag >::type> {}; diff --git a/boost/network/message/traits/destination.hpp b/boost/network/message/traits/destination.hpp index 9baf36ddd..7d0132b16 100644 --- a/boost/network/message/traits/destination.hpp +++ b/boost/network/message/traits/destination.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -24,15 +25,16 @@ struct unsupported_tag; template struct destination - : mpl::if_< - is_async, - boost::shared_future::type>, - typename mpl::if_< - mpl::or_, - is_same, - is_same >, - typename string::type, - unsupported_tag >::type> {}; + : mpl::if_, + shared_future::type>, + typename mpl::if_< + mpl::or_, + is_same, + is_same >, + typename string::type, + unsupported_tag >::type> {}; } // namespace traits } // namespace network diff --git a/boost/network/message/traits/source.hpp b/boost/network/message/traits/source.hpp index 1400a1e18..a3ef4ff63 100644 --- a/boost/network/message/traits/source.hpp +++ b/boost/network/message/traits/source.hpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -22,15 +23,16 @@ struct unsupported_tag; template struct source - : mpl::if_< - is_async, - boost::shared_future::type>, - typename mpl::if_< - mpl::or_, - is_same, - is_same >, - typename string::type, - unsupported_tag >::type> {}; + : mpl::if_, + shared_future::type>, + typename mpl::if_< + mpl::or_, + is_same, + is_same >, + typename string::type, + unsupported_tag >::type> {}; } // namespace traits } // namespace network diff --git a/boost/network/message/transformers/to_lower.hpp b/boost/network/message/transformers/to_lower.hpp index a5f9abdda..66a6a4a85 100644 --- a/boost/network/message/transformers/to_lower.hpp +++ b/boost/network/message/transformers/to_lower.hpp @@ -32,7 +32,7 @@ template <> struct to_lower_transformer { template void operator()(basic_message &message_) const { - boost::to_lower(message_.source()); + ::boost::to_lower(message_.source()); } protected: @@ -43,7 +43,7 @@ template <> struct to_lower_transformer { template void operator()(basic_message &message_) const { - boost::to_lower(message_.destination()); + ::boost::to_lower(message_.destination()); } protected: diff --git a/boost/network/message/transformers/to_upper.hpp b/boost/network/message/transformers/to_upper.hpp index 21850caa9..9142aaf87 100644 --- a/boost/network/message/transformers/to_upper.hpp +++ b/boost/network/message/transformers/to_upper.hpp @@ -32,7 +32,7 @@ template <> struct to_upper_transformer { template void operator()(basic_message &message_) const { - boost::to_upper(message_.source()); + ::boost::to_upper(message_.source()); } protected: @@ -43,7 +43,7 @@ template <> struct to_upper_transformer { template void operator()(basic_message &message_) const { - boost::to_upper(message_.destination()); + ::boost::to_upper(message_.destination()); } protected: diff --git a/boost/network/protocol/http/algorithms/linearize.hpp b/boost/network/protocol/http/algorithms/linearize.hpp index aae25aa05..0e6644909 100644 --- a/boost/network/protocol/http/algorithms/linearize.hpp +++ b/boost/network/protocol/http/algorithms/linearize.hpp @@ -3,6 +3,7 @@ // Copyright 2010 Dean Michael Berris. // Copyright 2014 Jussi Lyytinen +// Copyright 2015 Google, Inc. // 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) @@ -11,17 +12,20 @@ #include #include #include +#include #include +#include #include #include -#include -#include -#include +#include +#include +#include +#include #include +#include #include #include #include -#include namespace boost { namespace network { @@ -40,9 +44,7 @@ struct linearize_header { }; template - BOOST_CONCEPT_REQUIRES(((Header::type>)), - (string_type)) - operator()(ValueType& header) { + string_type operator()(ValueType& header) { typedef typename ostringstream::type output_stream; typedef constants consts; output_stream header_line; @@ -53,11 +55,10 @@ struct linearize_header { }; template -BOOST_CONCEPT_REQUIRES(((ClientRequest)), (OutputIterator)) - linearize(Request const& request, - typename Request::string_type const& method, - unsigned version_major, unsigned version_minor, - OutputIterator oi) { +OutputIterator linearize(Request const& request, + typename Request::string_type const& method, + unsigned version_major, unsigned version_minor, + OutputIterator oi) { typedef typename Request::tag Tag; typedef constants consts; typedef typename string::type string_type; @@ -97,13 +98,7 @@ BOOST_CONCEPT_REQUIRES(((ClientRequest)), (OutputIterator)) // We need to determine whether we've seen any of the following headers // before setting the defaults. We use a bitset to keep track of the // defaulted headers. - enum { - ACCEPT, - ACCEPT_ENCODING, - HOST, - CONNECTION, - MAX - }; + enum { ACCEPT, ACCEPT_ENCODING, HOST, CONNECTION, MAX }; std::bitset found_headers; static char const* defaulted_headers[][2] = { {consts::accept(), consts::accept() + std::strlen(consts::accept())}, @@ -182,7 +177,7 @@ BOOST_CONCEPT_REQUIRES(((ClientRequest)), (OutputIterator)) } boost::copy(crlf, oi); - typename body_range::type body_data = body(request).range(); + auto body_data = body(request).range(); return boost::copy(body_data, oi); } @@ -190,4 +185,4 @@ BOOST_CONCEPT_REQUIRES(((ClientRequest)), (OutputIterator)) } // namespace network } // namespace boost -#endif /* BOOST_NETWORK_PROTOCOL_HTTP_ALGORITHMS_LINEARIZE_HPP_20101028 */ +#endif // BOOST_NETWORK_PROTOCOL_HTTP_ALGORITHMS_LINEARIZE_HPP_20101028 diff --git a/boost/network/protocol/http/client/connection/async_normal.hpp b/boost/network/protocol/http/client/connection/async_normal.hpp index 443d514c2..e0f59d401 100644 --- a/boost/network/protocol/http/client/connection/async_normal.hpp +++ b/boost/network/protocol/http/client/connection/async_normal.hpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -50,7 +51,6 @@ struct http_async_connection protected http_async_protocol_handler, boost::enable_shared_from_this< http_async_connection > { - http_async_connection(http_async_connection const&) = delete; typedef async_connection_base base; @@ -64,10 +64,10 @@ struct http_async_connection typedef typename base::string_type string_type; typedef typename base::request request; typedef typename base::resolver_base::resolve_function resolve_function; - typedef typename base::body_callback_function_type - body_callback_function_type; - typedef typename base::body_generator_function_type - body_generator_function_type; + typedef + typename base::body_callback_function_type body_callback_function_type; + typedef + typename base::body_generator_function_type body_generator_function_type; typedef http_async_connection this_type; typedef typename delegate_factory::type delegate_factory_type; typedef typename delegate_factory_type::connection_delegate_ptr @@ -118,7 +118,6 @@ struct http_async_connection } private: - void set_errors(boost::system::error_code const& ec) { boost::system::system_error error(ec); this->version_promise.set_exception(boost::copy_exception(error)); @@ -196,13 +195,7 @@ struct http_async_connection } } - enum state_t { - version, - status, - status_message, - headers, - body - }; + enum state_t { version, status, status_message, headers, body }; void handle_sent_request(bool get_body, body_callback_function_type callback, body_generator_function_type generator, @@ -295,10 +288,10 @@ struct http_async_connection } case headers: if (ec == boost::asio::error::eof) return; - // In the following, remainder is the number of bytes that remain in - // the buffer. We need this in the body processing to make sure that - // the data remaining in the buffer is dealt with before another call - // to get more data for the body is scheduled. + // In the following, remainder is the number of bytes that remain in + // the buffer. We need this in the body processing to make sure that + // the data remaining in the buffer is dealt with before another call + // to get more data for the body is scheduled. fusion::tie(parsed_ok, remainder) = this->parse_headers( delegate_, request_strand_.wrap(boost::bind( @@ -312,8 +305,8 @@ struct http_async_connection } if (!get_body) { - // We short-circuit here because the user does not want to get the - // body (in the case of a HEAD request). + // We short-circuit here because the user does not want to get the + // body (in the case of a HEAD request). this->body_promise.set_value(""); this->destination_promise.set_value(""); this->source_promise.set_value(""); @@ -323,23 +316,23 @@ struct http_async_connection } if (callback) { - // Here we deal with the spill-over data from the headers - // processing. This means the headers data has already been parsed - // appropriately and we're looking to treat everything that remains - // in the buffer. + // Here we deal with the spill-over data from the headers + // processing. This means the headers data has already been parsed + // appropriately and we're looking to treat everything that remains + // in the buffer. typename protocol_base::buffer_type::const_iterator begin = this->part_begin; typename protocol_base::buffer_type::const_iterator end = begin; std::advance(end, remainder); - // We're setting the body promise here to an empty string because - // this can be used as a signaling mechanism for the user to - // determine that the body is now ready for processing, even though - // the callback is already provided. + // We're setting the body promise here to an empty string because + // this can be used as a signaling mechanism for the user to + // determine that the body is now ready for processing, even though + // the callback is already provided. this->body_promise.set_value(""); - // The invocation of the callback is synchronous to allow us to - // wait before scheduling another read. + // The invocation of the callback is synchronous to allow us to + // wait before scheduling another read. callback(make_iterator_range(begin, end), ec); delegate_->read_some( @@ -350,8 +343,8 @@ struct http_async_connection this_type::shared_from_this(), body, get_body, callback, placeholders::error, placeholders::bytes_transferred))); } else { - // Here we handle the body data ourself and append to an - // ever-growing string buffer. + // Here we handle the body data ourself and append to an + // ever-growing string buffer. this->parse_body( delegate_, request_strand_.wrap(boost::bind( @@ -363,19 +356,19 @@ struct http_async_connection return; case body: if (ec == boost::asio::error::eof || is_ssl_short_read_error) { - // Here we're handling the case when the connection has been closed - // from the server side, or at least that the end of file has been - // reached while reading the socket. This signals the end of the - // body processing chain. + // Here we're handling the case when the connection has been closed + // from the server side, or at least that the end of file has been + // reached while reading the socket. This signals the end of the + // body processing chain. if (callback) { typename protocol_base::buffer_type::const_iterator begin = this->part.begin(), end = begin; std::advance(end, bytes_transferred); - // We call the callback function synchronously passing the error - // condition (in this case, end of file) so that it can handle it - // appropriately. + // We call the callback function synchronously passing the error + // condition (in this case, end of file) so that it can handle it + // appropriately. callback(make_iterator_range(begin, end), ec); } else { string_type body_string; @@ -394,12 +387,12 @@ struct http_async_connection this->response_parser_.reset(); this->timer_.cancel(); } else { - // This means the connection has not been closed yet and we want to - // get more data. + // This means the connection has not been closed yet and we want to + // get more data. if (callback) { - // Here we have a body_handler callback. Let's invoke the - // callback from here and make sure we're getting more data right - // after. + // Here we have a body_handler callback. Let's invoke the + // callback from here and make sure we're getting more data right + // after. typename protocol_base::buffer_type::const_iterator begin = this->part.begin(); typename protocol_base::buffer_type::const_iterator end = begin; @@ -413,9 +406,9 @@ struct http_async_connection this_type::shared_from_this(), body, get_body, callback, placeholders::error, placeholders::bytes_transferred))); } else { - // Here we don't have a body callback. Let's make sure that we - // deal with the remainder from the headers part in case we do - // have data that's still in the buffer. + // Here we don't have a body callback. Let's make sure that we + // deal with the remainder from the headers part in case we do + // have data that's still in the buffer. this->parse_body( delegate_, request_strand_.wrap(boost::bind( @@ -446,9 +439,9 @@ struct http_async_connection this->headers_promise.set_exception(boost::copy_exception(error)); case body: if (!callback) { - // N.B. if callback is non-null, then body_promise has already been - // set to value "" to indicate body is handled by streaming handler - // so no exception should be set + // N.B. if callback is non-null, then body_promise has already been + // set to value "" to indicate body is handled by streaming handler + // so no exception should be set this->body_promise.set_exception(boost::copy_exception(error)); } break; diff --git a/boost/network/protocol/http/impl/request.hpp b/boost/network/protocol/http/impl/request.hpp index bd817e7fc..1defd5c15 100644 --- a/boost/network/protocol/http/impl/request.hpp +++ b/boost/network/protocol/http/impl/request.hpp @@ -1,13 +1,22 @@ -// Copyright Dean Michael Berris 2007,2009,2010. -// Copyright Michael Dickey 2008. +// Copyright Dean Michael Berris 2007,2009,2010. +// Copyright Michael Dickey 2008. +// Copyright Google, Inc. 2015 // 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) +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_NETWORK_PROTOCOL_HTTP_REQUEST_IMPL_20070908_1_HPP__ #define BOOST_NETWORK_PROTOCOL_HTTP_REQUEST_IMPL_20070908_1_HPP__ +/** request.hpp + * + * This file implements the basic request object required + * by the HTTP client implementation. The basic_request + * object encapsulates a URI which is parsed at runtime. + */ + +#include #include #include #include @@ -16,7 +25,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -26,44 +36,36 @@ namespace network { /** Specialize the traits for the http_server tag. */ template <> -struct headers_container< - http::tags::http_server> : vector:: - apply::type> {}; - -template <> -struct headers_container< - http::tags:: - http_async_server> : vector:: - apply::type> {}; +struct headers_container + : vector::apply< + http::request_header::type> {}; namespace http { -/** request.hpp - * - * This file implements the basic request object required - * by the HTTP client implementation. The basic_request - * object encapsulates a URI which is parsed at runtime. - */ - +/** + * basic_request + * + * This is the basic implementation of an HTTP request object. + * + */ template struct basic_request : public basic_message { - mutable boost::network::uri::uri uri_; boost::uint16_t source_port_; typedef basic_message base_type; public: - typedef typename sync_only::type tag; + typedef Tag tag; typedef typename string::type string_type; typedef boost::uint16_t port_type; - explicit basic_request(string_type /*unused*/const& uri_) : uri_(uri_), source_port_(0) {} + explicit basic_request(string_type const& uri_) + : uri_(uri_), source_port_(0) {} - explicit basic_request(boost::network::uri::uri const& uri_) : uri_(uri_), source_port_(0) {} + explicit basic_request(boost::network::uri::uri const& uri_) + : uri_(uri_), source_port_(0) {} - void uri(string_type /*unused*/const& new_uri) { uri_ = new_uri; } + void uri(string_type const& new_uri) { uri_ = new_uri; } void uri(boost::network::uri::uri const& new_uri) { uri_ = new_uri; } @@ -155,18 +157,8 @@ struct not_quite_pod_request_base { }; template <> -struct basic_request : not_quite_pod_request_base< - tags::http_async_server> {}; - -template <> -struct basic_request : not_quite_pod_request_base< - tags::http_server> {}; - -template -struct ServerRequest; - -BOOST_CONCEPT_ASSERT((ServerRequest >)); -BOOST_CONCEPT_ASSERT((ServerRequest >)); +struct basic_request + : not_quite_pod_request_base {}; template inline void swap(basic_request& lhs, basic_request& rhs) { @@ -181,7 +173,8 @@ namespace impl { template <> struct request_headers_wrapper { basic_request const& request_; - explicit request_headers_wrapper(basic_request const& request_) + explicit request_headers_wrapper( + basic_request const& request_) : request_(request_) {} typedef headers_container::type headers_container_type; operator headers_container_type() { return request_.headers; } @@ -196,32 +189,9 @@ struct body_wrapper > { operator string_type() { return request_.body; } }; -template <> -struct request_headers_wrapper { - basic_request const& request_; - explicit request_headers_wrapper( - basic_request const& request_) - : request_(request_) {} - typedef headers_container::type - headers_container_type; - operator headers_container_type() { return request_.headers; } -}; - -template <> -struct body_wrapper > { - typedef string::type string_type; - basic_request const& request_; - explicit body_wrapper(basic_request const& request_) - : request_(request_) {} - operator string_type() { return request_.body; } -}; - } // namespace impl - } // namespace http - } // namespace network - } // namespace boost #endif // BOOST_NETWORK_PROTOCOL_HTTP_REQUEST_IMPL_20070908_1_HPP__ diff --git a/boost/network/protocol/http/message.hpp b/boost/network/protocol/http/message.hpp index da89eb98b..d8e7b5a69 100644 --- a/boost/network/protocol/http/message.hpp +++ b/boost/network/protocol/http/message.hpp @@ -1,6 +1,7 @@ // This file is part of the Boost Network library // Based on the Pion Network Library (r421) // Copyright Atomic Labs, Inc. 2007-2008 +// Copyright 2015 Google, Inc. // See http://cpp-netlib.sourceforge.net for library home page. // // Distributed under the Boost Software License, Version 1.0. @@ -15,7 +16,6 @@ #include #include #include -#include #include #include #include diff --git a/boost/network/protocol/http/message/header_concept.hpp b/boost/network/protocol/http/message/header_concept.hpp deleted file mode 100644 index 45642376f..000000000 --- a/boost/network/protocol/http/message/header_concept.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_HEADER_CONCEPT_HPP_20101028 -#define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_HEADER_CONCEPT_HPP_20101028 - -// Copyright 2010 Dean Michael Berris. -// 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) - -#include - -namespace boost { -namespace network { -namespace http { - -template -struct Header : DefaultConstructible, Assignable, CopyConstructible { - - BOOST_CONCEPT_USAGE(Header) { - typedef typename H::string_type string_type; - string_type name_ = name(header); - string_type value_ = value(header); - H h1, h2; - swap(h1, h2); // ADL Swap! - (void)name_; - (void)value_; - } - - private: - H header; -}; - -} // namespace http - /* http */ - -} // namespace network - /* network */ - -} // namespace boost - /* boost */ - -#endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_HEADER_CONCEPT_HPP_20101028 */ diff --git a/boost/network/protocol/http/message/modifiers/destination.hpp b/boost/network/protocol/http/message/modifiers/destination.hpp index 1c29c1b0f..8387a3d9a 100644 --- a/boost/network/protocol/http/message/modifiers/destination.hpp +++ b/boost/network/protocol/http/message/modifiers/destination.hpp @@ -82,7 +82,8 @@ namespace impl { template inline void destination(Message const &message, ValueType const &destination_, - http::tags::http_server /*unused*/, Async /*unused*/) { + http::tags::http_server /*unused*/, + Async /*unused*/) { message.destination = destination_; } diff --git a/boost/network/protocol/http/message/modifiers/source.hpp b/boost/network/protocol/http/message/modifiers/source.hpp index 989c733a2..2597bde1b 100644 --- a/boost/network/protocol/http/message/modifiers/source.hpp +++ b/boost/network/protocol/http/message/modifiers/source.hpp @@ -73,7 +73,8 @@ namespace impl { template inline void source(Message const &message, ValueType const &source_, - http::tags::http_server const & /*unused*/, Async const & /*unused*/) { + http::tags::http_server const & /*unused*/, + Async const & /*unused*/) { message.source = source_; } diff --git a/boost/network/protocol/http/policies/async_connection.hpp b/boost/network/protocol/http/policies/async_connection.hpp index 8ddb4181a..297038f15 100644 --- a/boost/network/protocol/http/policies/async_connection.hpp +++ b/boost/network/protocol/http/policies/async_connection.hpp @@ -9,16 +9,17 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#include +#include #include +#include #include #include +#include #include #include #include -#include #include -#include -#include namespace boost { namespace network { diff --git a/boost/network/protocol/http/request.hpp b/boost/network/protocol/http/request.hpp index 7327bb825..af0134688 100644 --- a/boost/network/protocol/http/request.hpp +++ b/boost/network/protocol/http/request.hpp @@ -7,59 +7,6 @@ #ifndef __NETWORK_PROTOCOL_HTTP_REQUEST_20070908_1_HPP__ #define __NETWORK_PROTOCOL_HTTP_REQUEST_20070908_1_HPP__ -// Implement the HTTP Request Object - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -// forward declarations -namespace boost { -namespace network { -namespace http { - -template -struct basic_request; - -} // namespace http - -} // namespace network - -} // namespace boost - #include namespace boost { @@ -74,11 +21,8 @@ basic_request& operator<<(basic_request& message, } } // namespace http - } // namespace network - } // namespace boost -#include #endif // __NETWORK_PROTOCOL_HTTP_REQUEST_20070908-1_HPP__ diff --git a/boost/network/protocol/http/request_concept.hpp b/boost/network/protocol/http/request_concept.hpp deleted file mode 100644 index 09094d86d..000000000 --- a/boost/network/protocol/http/request_concept.hpp +++ /dev/null @@ -1,115 +0,0 @@ -#ifndef BOOST_NETWORK_PROTOCOL_HTTP_REQUEST_CONCEPT_HPP_20100603 -#define BOOST_NETWORK_PROTOCOL_HTTP_REQUEST_CONCEPT_HPP_20100603 - -// Copyright 2010 (c) Dean Michael Berris. -// Copyright 2010 (c) Sinefunc, Inc. -// 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) - -#include -#include -#include -#include -#include - -namespace boost { -namespace network { -namespace http { - -template -struct ServerRequest { - typedef typename R::string_type string_type; - typedef typename R::tag tag; - typedef typename R::headers_container_type headers_container_type; - - BOOST_CONCEPT_USAGE(ServerRequest) { - string_type source_, method_, destination_; - boost::uint8_t major_version_, minor_version_; - headers_container_type headers_; - string_type body_; - - source_ = source(request); - method_ = method(request); - destination_ = destination(request); - major_version_ = major_version(request); - minor_version_ = minor_version(request); - headers_ = headers(request); - body_ = body(request); - - source(request, source_); - method(request, method_); - destination(request, destination_); - major_version(request, major_version_); - minor_version(request, minor_version_); - headers(request, headers_); - add_header(request, string_type(), string_type()); - remove_header(request, string_type()); - clear_headers(request); - body(request, body_); - - string_type name, value; - - request << ::boost::network::source(source_) - << ::boost::network::destination(destination_) - << ::boost::network::http::method(method_) - << ::boost::network::http::major_version(major_version_) - << ::boost::network::http::minor_version(minor_version_) - << ::boost::network::header(name, value) - << ::boost::network::body(body_); - - (void)source_; - (void)method_; - (void)destination_; - (void)major_version_; - (void)minor_version_; - (void)headers_; - (void)body_; - (void)name; - (void)value; - } - - private: - R request; -}; - -template -struct ClientRequest : boost::network::Message { - typedef typename R::string_type string_type; - typedef typename R::port_type port_type; - - BOOST_CONCEPT_USAGE(ClientRequest) { - string_type tmp; - R request_(tmp); - swap(request, request_); // swappable via ADL - - string_type host_ = host(request); - port_type port_ = port(request); - string_type path_ = path(request); - string_type query_ = query(request); - string_type anchor_ = anchor(request); - string_type protocol_ = protocol(request); - - request << uri(string_type()); - - boost::network::http::uri(request, string_type()); - - (void)host_; - (void)port_; - (void)path_; - (void)query_; - (void)anchor_; - (void)protocol_; - } - - private: - R request; -}; - -} // namespace http - -} // namespace network - -} // namespace boost - -#endif // BOOST_NETWORK_PROTOCOL_HTTP_REQUEST_CONCEPT_HPP_20100603 diff --git a/boost/network/protocol/http/response.hpp b/boost/network/protocol/http/response.hpp index fa7a2eefe..e4b59057e 100644 --- a/boost/network/protocol/http/response.hpp +++ b/boost/network/protocol/http/response.hpp @@ -1,41 +1,36 @@ -// Copyright Dean Michael Berris 2007. -// Copyright Michael Dickey 2008. +// Copyright Dean Michael Berris 2007. +// Copyright Michael Dickey 2008. +// Copyright Google, Inc. 2015 // 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) +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_NETWORK_PROTOCOL_HTTP_RESPONSE_HPP #define BOOST_NETWORK_PROTOCOL_HTTP_RESPONSE_HPP #include - -#include - -#include -#include +#include +#include #include +#include #include - -#include -#include -#include -#include -#include +#include +#include +#include #include #include -#include - -#include -#include -#include +#include +#include +#include +#include +#include +#include #include -#include #include - -#include -#include -#include -#include +#include +#include +#include +#include namespace boost { namespace network { diff --git a/boost/network/protocol/http/response_concept.hpp b/boost/network/protocol/http/response_concept.hpp deleted file mode 100644 index d262b97be..000000000 --- a/boost/network/protocol/http/response_concept.hpp +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef BOOST_NETWORK_PROTOCOL_HTTP_RESPONSE_CONCEPT_HPP_20100603 -#define BOOST_NETWORK_PROTOCOL_HTTP_RESPONSE_CONCEPT_HPP_20100603 - -// Copyright 2010 (c) Dean Michael Berris. -// Copyright 2010 (c) Sinefunc, Inc. -// 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) - -#include -#include -#include -#include -#include -#include - -namespace boost { -namespace network { -namespace http { - -template -struct Response : boost::network::Message { - typedef typename R::string_type string_type; - - BOOST_CONCEPT_USAGE(Response) { - R response_; - swap(response, response_); // swappable via ADL - - typedef typename traits::version::type version_type; - typedef typename traits::status::type status_type; - typedef typename traits::status_message::type status_message_type; - - response << version(version_type()) // version directive - << status(status_type()) // status directive - << status_message( - status_message_type()) // status_message directive - ; - - version(response, version_type()); - status(response, status_type()); - status_message(response, status_message_type()); - - string_type version_ = version(response); - boost::uint16_t status_ = status(response); - string_type status_message_ = status_message(response); - - (void)version_; - (void)status_; - (void)status_message_; - } - - private: - R response; -}; - -} // namespace http - -} // namespace network - -} // namespace boost - -#endif // BOOST_NETWORK_PROTOCOL_HTTP_RESPONSE_CONCEPT_HPP_20100603 diff --git a/boost/network/protocol/http/server.hpp b/boost/network/protocol/http/server.hpp index d7c127ee1..386901c13 100644 --- a/boost/network/protocol/http/server.hpp +++ b/boost/network/protocol/http/server.hpp @@ -1,6 +1,7 @@ // Copyright 2009 (c) Tarro, Inc. // Copyright 2009 (c) Dean Michael Berris // Copyright 2010 (c) Glyn Matthews +// Copyright Google, Inc. 2015 // Copyright 2003-2008 (c) Chris Kholhoff // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -44,19 +45,8 @@ struct server : server_base::type { explicit server(options const &options) : server_base(options) {} }; -template -struct async_server : server_base::type { - typedef typename server_base::type - server_base; - typedef server_options options; - - explicit async_server(options const &options) : server_base(options) {} -}; - } // namespace http - } // namespace network - } // namespace boost #endif // BOOST_NETWORK_HTTP_SERVER_HPP_ diff --git a/boost/network/protocol/http/server/async_connection.hpp b/boost/network/protocol/http/server/async_connection.hpp index 835d6f5d9..131aa2890 100644 --- a/boost/network/protocol/http/server/async_connection.hpp +++ b/boost/network/protocol/http/server/async_connection.hpp @@ -3,36 +3,34 @@ // Copyright 2010 Dean Michael Berris. // Copyright 2014 Jelle Van den Driessche. +// Copyright 2015 Google, Inc. // 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) -#include -#include -#include -#include -#include -#include -#include +#include #include -#include #include -#include +#include #include -#include +#include #include -#include +#include +#include #include -#include +#include +#include +#include +#include +#include #include #include +#include #include +#include +#include #include #include -#include -#ifdef BOOST_NETWORK_NO_LIB -#include -#endif #ifndef BOOST_NETWORK_HTTP_SERVER_CONNECTION_HEADER_BUFFER_MAX_SIZE /** Here we define a page's worth of header connection buffer data. @@ -49,6 +47,14 @@ #define BOOST_NETWORK_HTTP_SERVER_CONNECTION_HEADER_BUFFER_MAX_SIZE 4096 #endif /* BOOST_NETWORK_HTTP_SERVER_CONNECTION_HEADER_BUFFER_MAX_SIZE */ +#ifndef BOOST_NETWORK_HTTP_SERVER_CONNECTION_BUFFER_SIZE +/** + * We define the buffer size for each connection that we will use on the server + * side. + */ +#define BOOST_NETWORK_HTTP_SERVER_CONNECTION_BUFFER_SIZE 1024uL +#endif + namespace boost { namespace network { namespace http { @@ -189,6 +195,7 @@ struct async_connection handshake_done(false), headers_already_sent(false), headers_in_progress(false) { + (void)ctx; new_start = read_buffer_.begin(); } @@ -235,9 +242,8 @@ struct async_connection stream << consts::crlf(); } - write_headers_only( - boost::bind(&async_connection::do_nothing, - async_connection::shared_from_this())); + auto self = this->shared_from_this(); + write_headers_only([self] {}); } void set_status(status_t new_status) { @@ -256,11 +262,10 @@ struct async_connection lock_guard lock(headers_mutex); if (error_encountered) boost::throw_exception(boost::system::system_error(*error_encountered)); - - boost::function f = boost::bind( - &async_connection::default_error, - async_connection::shared_from_this(), boost::arg<1>()); - + auto self = this->shared_from_this(); + auto f = [this, self](boost::system::error_code ec) { + this->default_error(ec); + }; write_impl(boost::make_iterator_range(range), f); } @@ -300,19 +305,20 @@ struct async_connection boost::make_iterator_range(new_start, read_buffer_.end()); buffer_type::iterator start_tmp = new_start; new_start = read_buffer_.begin(); - thread_pool().post( - boost::bind(callback, input, boost::system::error_code(), - std::distance(start_tmp, data_end), - async_connection::shared_from_this())); + auto self = this->shared_from_this(); + thread_pool().post([this, self, callback, input, start_tmp] { + callback(input, {}, std::distance(start_tmp, data_end), self); + }); return; } + auto self = this->shared_from_this(); socket().async_read_some( asio::buffer(read_buffer_), - strand.wrap(boost::bind( - &async_connection::wrap_read_handler, - async_connection::shared_from_this(), callback, - asio::placeholders::error, asio::placeholders::bytes_transferred))); + strand.wrap([this, self, callback](boost::system::error_code ec, + size_t bytes_transferred) { + callback(ec, bytes_transferred); + })); } boost::network::stream_handler& socket() { return socket_; } @@ -328,9 +334,11 @@ struct async_connection buffer_type::const_iterator data_start = read_buffer_.begin(), data_end = read_buffer_.begin(); std::advance(data_end, bytes_transferred); - thread_pool().post(boost::bind( - callback, boost::make_iterator_range(data_start, data_end), ec, - bytes_transferred, async_connection::shared_from_this())); + auto range = boost::make_iterator_range(data_start, data_end); + auto self = this->shared_from_this(); + thread_pool().post([callback, range, ec, bytes_transferred, self] { + callback(range, ec, bytes_transferred, self); + }); } void default_error(boost::system::error_code const& ec) { @@ -383,22 +391,22 @@ struct async_connection } void read_more(state_t state) { + auto self = this->shared_from_this(); #ifdef BOOST_NETWORK_ENABLE_HTTPS if (socket_.is_ssl_enabled() && !handshake_done) { socket_.async_handshake( boost::asio::ssl::stream_base::server, - boost::bind(&async_connection::handle_handshake, - async_connection::shared_from_this(), - boost::asio::placeholders::error, state)); + [this, self, state](boost::system::error_code ec) { + handle_handshake(ec, state); + }); } else { #endif socket_.async_read_some( asio::buffer(read_buffer_), - strand.wrap( - boost::bind(&async_connection::handle_read_data, - async_connection::shared_from_this(), - state, boost::asio::placeholders::error, - boost::asio::placeholders::bytes_transferred))); + strand.wrap([this, self, state](boost::system::error_code ec, + size_t bytes_transferred) { + handle_read_data(state, ec, bytes_transferred); + })); #ifdef BOOST_NETWORK_ENABLE_HTTPS } #endif @@ -492,9 +500,8 @@ struct async_connection break; } new_start = boost::end(result_range); - thread_pool().post(boost::bind( - &Handler::operator(), &handler, cref(request_), - async_connection::shared_from_this())); + auto self = this->shared_from_this(); + thread_pool().post([this, self] { handler(request_, self); }); return; } else { partial_parsed.append(boost::begin(result_range), @@ -515,20 +522,19 @@ struct async_connection } void client_error() { - static char const* bad_request = + static char const bad_request[] = "HTTP/1.0 400 Bad Request\r\nConnection: close\r\nContent-Type: " "text/plain\r\nContent-Length: 12\r\n\r\nBad Request."; - asio::async_write( - socket(), asio::buffer(bad_request, strlen(bad_request)), - strand.wrap(boost::bind( - &async_connection::client_error_sent, - async_connection::shared_from_this(), - asio::placeholders::error, asio::placeholders::bytes_transferred))); + auto self = this->shared_from_this(); + asio::async_write(socket(), asio::buffer(bad_request, strlen(bad_request)), + strand.wrap([this, self](boost::system::error_code ec, + size_t bytes_transferred) { + client_error_sent(ec, bytes_transferred); + })); } - void client_error_sent(boost::system::error_code const& ec, - std::size_t bytes_transferred) { + void client_error_sent(boost::system::error_code const& ec, std::size_t) { if (!ec) { boost::system::error_code ignored; socket().shutdown(asio::ip::tcp::socket::shutdown_both, ignored); @@ -538,29 +544,25 @@ struct async_connection } } - void do_nothing() {} - void write_headers_only(boost::function callback) { if (headers_in_progress) return; headers_in_progress = true; + auto self = this->shared_from_this(); asio::async_write( socket(), headers_buffer, - strand.wrap(boost::bind( - &async_connection::handle_write_headers, - async_connection::shared_from_this(), callback, - asio::placeholders::error, asio::placeholders::bytes_transferred))); + strand.wrap([this, self, callback] (boost::system::error_code ec, size_t bytes_transferred) { + handle_write_headers(callback, ec, bytes_transferred); + })); } void handle_write_headers(boost::function callback, - boost::system::error_code const& ec, - std::size_t bytes_transferred) { + boost::system::error_code const& ec, std::size_t) { lock_guard lock(headers_mutex); if (!ec) { headers_buffer.consume(headers_buffer.size()); headers_already_sent = true; thread_pool().post(callback); - auto start = pending_actions.begin(), - end = pending_actions.end(); + auto start = pending_actions.begin(), end = pending_actions.end(); while (start != end) { thread_pool().post(*start++); } @@ -572,10 +574,10 @@ struct async_connection void handle_write( boost::function callback, - shared_array_list temporaries, shared_buffers buffers, - boost::system::error_code const& ec, std::size_t bytes_transferred) { + shared_array_list, shared_buffers, boost::system::error_code const& ec, + std::size_t) { // we want to forget the temporaries and buffers - thread_pool().post(boost::bind(callback, ec)); + thread_pool().post([callback, ec] { callback(ec); }); } template @@ -604,8 +606,7 @@ struct async_connection buffers->reserve((range_size / connection_buffer_size) + ((range_size % connection_buffer_size) ? 1 : 0)); std::size_t slice_size = std::min(range_size, connection_buffer_size); - typename boost::range_iterator::type start = boost::begin(range), - end = boost::end(range); + auto start = boost::begin(range), end = boost::end(range); while (slice_size != 0) { using boost::adaptors::sliced; shared_ptr new_array = make_shared(); @@ -629,32 +630,25 @@ struct async_connection lock_guard lock(headers_mutex); if (error_encountered) boost::throw_exception(boost::system::system_error(*error_encountered)); - - boost::function callback_function = - callback; - - boost::function continuation = boost::bind( - &async_connection::template write_vec_impl< - ConstBufferSeq, boost::function >, - async_connection::shared_from_this(), seq, - callback_function, temporaries, buffers); - + auto self = this->shared_from_this(); + auto continuation = [this, self, seq, callback, temporaries, buffers] { + write_vec_impl(seq, callback, temporaries, buffers); + }; if (!headers_already_sent && !headers_in_progress) { write_headers_only(continuation); return; - } else if (headers_in_progress && !headers_already_sent) { + } + if (headers_in_progress && !headers_already_sent) { pending_actions.push_back(continuation); return; } - - asio::async_write( - socket_, seq, - boost::bind(&async_connection::handle_write, - async_connection::shared_from_this(), - callback_function, temporaries, buffers, - asio::placeholders::error, - asio::placeholders::bytes_transferred)); + asio::async_write(socket_, seq, [this, self, callback, temporaries, + buffers](boost::system::error_code ec, + size_t bytes_transferred) { + handle_write(callback, temporaries, buffers, ec, bytes_transferred); + }); } + void handle_handshake(const boost::system::error_code& ec, state_t state) { if (!ec) { handshake_done = true; @@ -665,10 +659,8 @@ struct async_connection } }; -} /* http */ - -} /* network */ - -} /* boost */ +} // namespace http +} // namespace network +} // namespace boost -#endif /* BOOST_NETWORK_PROTOCOL_HTTP_SERVER_CONNECTION_HPP_20101027 */ +#endif // BOOST_NETWORK_PROTOCOL_HTTP_SERVER_CONNECTION_HPP_20101027 diff --git a/boost/network/protocol/http/support/sync_only.hpp b/boost/network/protocol/http/support/sync_only.hpp deleted file mode 100644 index c762cf2f1..000000000 --- a/boost/network/protocol/http/support/sync_only.hpp +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef BOOST_NETWORK_PROTOCOL_HTTP_SUPPORT_SYNC_ONLY_HPP_20100927 -#define BOOST_NETWORK_PROTOCOL_HTTP_SUPPORT_SYNC_ONLY_HPP_20100927 - -// Copyright Dean Michael Berris 2010. -// 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) - -#include -#include -#include -#include -#include -#include - -namespace boost { -namespace network { -namespace http { - -template -struct sync_only - : mpl::inherit_linearly< - typename mpl::replace_if< - typename tags::components::type, - is_same, - boost::network::tags::sync>::type, - mpl::inherit > {}; - -} // namespace http - /* http */ - -} // namespace network - /* network */ - -} // namespace boost - /* boost */ - -#endif /* BOOST_NETWORK_PROTOCOL_HTTP_SUPPORT_SYNC_ONLY_HPP_20100927 */ diff --git a/boost/network/protocol/http/tags.hpp b/boost/network/protocol/http/tags.hpp index 2517f262c..e33da8083 100644 --- a/boost/network/protocol/http/tags.hpp +++ b/boost/network/protocol/http/tags.hpp @@ -35,19 +35,11 @@ template struct components; typedef mpl::vector< - http, client, simple, boost::network::tags::sync, boost::network::tags::tcp, + http, client, simple, boost::network::tags::async, boost::network::tags::tcp, boost::network::tags::default_string> http_default_8bit_tcp_resolve_tags; typedef mpl::vector< - http, client, simple, boost::network::tags::sync, boost::network::tags::udp, + http, client, simple, boost::network::tags::async, boost::network::tags::udp, boost::network::tags::default_string> http_default_8bit_udp_resolve_tags; -typedef mpl::vector - http_keepalive_8bit_tcp_resolve_tags; -typedef mpl::vector - http_keepalive_8bit_udp_resolve_tags; typedef mpl::vector @@ -56,21 +48,15 @@ typedef mpl::vector http_async_8bit_tcp_resolve_tags; -typedef mpl::vector< - http, simple, boost::network::tags::sync, boost::network::tags::pod, - boost::network::tags::default_string, server> http_server_tags; typedef mpl::vector< http, simple, boost::network::tags::async, boost::network::tags::pod, - boost::network::tags::default_string, server> http_async_server_tags; + boost::network::tags::default_string, server> http_server_tags; BOOST_NETWORK_DEFINE_TAG(http_default_8bit_tcp_resolve); BOOST_NETWORK_DEFINE_TAG(http_default_8bit_udp_resolve); -BOOST_NETWORK_DEFINE_TAG(http_keepalive_8bit_tcp_resolve); -BOOST_NETWORK_DEFINE_TAG(http_keepalive_8bit_udp_resolve); BOOST_NETWORK_DEFINE_TAG(http_async_8bit_udp_resolve); BOOST_NETWORK_DEFINE_TAG(http_async_8bit_tcp_resolve); BOOST_NETWORK_DEFINE_TAG(http_server); -BOOST_NETWORK_DEFINE_TAG(http_async_server); } // namespace tags } // namespace http diff --git a/boost/network/protocol/http/traits/impl/delimiters.ipp b/boost/network/protocol/http/traits/impl/delimiters.ipp index b916b6702..ee796132e 100644 --- a/boost/network/protocol/http/traits/impl/delimiters.ipp +++ b/boost/network/protocol/http/traits/impl/delimiters.ipp @@ -1,5 +1,6 @@ -// Copyright Dean Michael Berris 2008. +// Copyright Dean Michael Berris 2008. +// Copyright Google, Inc. 2015 // 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) diff --git a/boost/network/support/sync_only.hpp b/boost/network/support/sync_only.hpp deleted file mode 100644 index e68f9ba2b..000000000 --- a/boost/network/support/sync_only.hpp +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef BOOST_NETWORK_SUPPORT_SYNC_ONLY_HPP_20100927 -#define BOOST_NETWORK_SUPPORT_SYNC_ONLY_HPP_20100927 - -// Copyright Dean Michael Berris 2010. -// 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) - -#include -#include -#include -#include -#include - -namespace boost { -namespace network { - -template -struct sync_only - : mpl::inherit_linearly< - typename mpl::replace_if::type, - is_same, - tags::sync>::type, - mpl::inherit > {}; - -} // namespace network - /* network */ - -} // namespace boost - /* boost */ - -#endif /* BOOST_NETWORK_SUPPORT_SYNC_ONLY_HPP_20100927 */ diff --git a/boost/network/tags.hpp b/boost/network/tags.hpp index a220fd430..440b654a7 100644 --- a/boost/network/tags.hpp +++ b/boost/network/tags.hpp @@ -1,8 +1,9 @@ -// Copyright Dean Michael Berris 2008, 2009. -// Glyn Matthews 2009 +// Copyright Dean Michael Berris 2008, 2009. +// Copyright Google, Inc. 2015 +// Glyn Matthews 2009 // 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) +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_NETWORK_TAG_INCLUDED_20100808 #define BOOST_NETWORK_TAG_INCLUDED_20100808 @@ -31,9 +32,6 @@ struct tcp { struct udp { typedef mpl::true_::type is_udp; }; -struct sync { - typedef mpl::true_::type is_sync; -}; struct default_string { typedef mpl::true_::type is_default_string; }; diff --git a/libs/network/example/CMakeLists.txt b/libs/network/example/CMakeLists.txt index 2828e97f0..7127fe769 100644 --- a/libs/network/example/CMakeLists.txt +++ b/libs/network/example/CMakeLists.txt @@ -82,7 +82,8 @@ target_link_libraries(trivial_google target_link_libraries(hello_world_server ${BOOST_SERVER_LIBS} - ${CMAKE_THREAD_LIBS_INIT}) + ${CMAKE_THREAD_LIBS_INIT} + cppnetlib-server-parsers) target_link_libraries(hello_world_client ${BOOST_CLIENT_LIBS} diff --git a/libs/network/example/http/fileserver.cpp b/libs/network/example/http/fileserver.cpp index 557d71b01..4aab62416 100644 --- a/libs/network/example/http/fileserver.cpp +++ b/libs/network/example/http/fileserver.cpp @@ -18,7 +18,7 @@ namespace http = boost::network::http; namespace utils = boost::network::utils; struct file_server; -typedef http::async_server server; +typedef http::server server; struct file_cache { @@ -112,7 +112,7 @@ struct connection_handler : boost::enable_shared_from_this { } } - void not_found(std::string const &path, server::connection_ptr connection) { + void not_found(std::string const &, server::connection_ptr connection) { static server::response_header headers[] = {{"Connection", "close"}, {"Content-Type", "text/plain"}}; connection->set_status(server::connection::not_found); @@ -175,7 +175,7 @@ struct file_server { file_cache &cache_; }; -int main(int argc, char *argv[]) { +int main(int, char *[]) { file_cache cache("."); file_server handler(cache); server::options options(handler); @@ -183,5 +183,4 @@ int main(int argc, char *argv[]) { .address("0.0.0.0") .port("8000")); instance.run(); - return 0; } diff --git a/libs/network/example/http/hello_world_async_server_with_work_queue.cpp b/libs/network/example/http/hello_world_async_server_with_work_queue.cpp index 3607317f1..3a6ea5bcb 100644 --- a/libs/network/example/http/hello_world_async_server_with_work_queue.cpp +++ b/libs/network/example/http/hello_world_async_server_with_work_queue.cpp @@ -24,7 +24,7 @@ } while (false) struct handler; -typedef boost::network::http::async_server server; +typedef boost::network::http::server server; /** * request + connection encapsulation (work item) @@ -93,7 +93,7 @@ struct handler { * @param signal * @param p_server_instance */ -void shut_me_down(const boost::system::error_code& error, int signal, +void shut_me_down(const boost::system::error_code& error, int, boost::shared_ptr p_server_instance) { if (!error) p_server_instance->stop(); } diff --git a/libs/network/example/http/hello_world_server.cpp b/libs/network/example/http/hello_world_server.cpp index 848824427..d23659446 100644 --- a/libs/network/example/http/hello_world_server.cpp +++ b/libs/network/example/http/hello_world_server.cpp @@ -24,17 +24,12 @@ typedef http::server server; functions, `operator()` and `log()` >>*/ struct hello_world { /*<< This is the function that handles the incoming request. >>*/ - void operator()(server::request const &request, server::response &response) { + void operator()(server::request const &request, server::connection_ptr connection) { server::string_type ip = source(request); unsigned int port = request.source_port; std::ostringstream data; data << "Hello, " << ip << ':' << port << '!'; - response = server::response::stock_reply(server::response::ok, data.str()); - } - /*<< It's necessary to define a log function, but it's ignored in - this example. >>*/ - void log(...) { - // do nothing + connection->write(data.str()); } }; diff --git a/libs/network/example/http_client.cpp b/libs/network/example/http_client.cpp index a2ea1f27f..0b4738191 100644 --- a/libs/network/example/http_client.cpp +++ b/libs/network/example/http_client.cpp @@ -72,9 +72,9 @@ int main(int argc, char* argv[]) { << std::endl; if (show_headers) { - headers_range::type headers_ = response.headers(); + auto headers_ = response.headers(); typedef std::pair header_type; - BOOST_FOREACH(header_type const & header, headers_) { + for (auto const& header : headers_) { std::cout << header.first << ": " << header.second << std::endl; } std::cout << std::endl; diff --git a/libs/network/test/http/client_get_different_port_test.cpp b/libs/network/test/http/client_get_different_port_test.cpp index 3279f22cc..69b63969f 100644 --- a/libs/network/test/http/client_get_different_port_test.cpp +++ b/libs/network/test/http/client_get_different_port_test.cpp @@ -17,8 +17,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(http_get_test_different_port, client, typename client::request request("http://www.boost.org:80/"); client client_; typename client::response response_ = client_.get(request); - typename net::headers_range::type range = - headers(response_)["Content-Type"]; + auto range = headers(response_)["Content-Type"]; BOOST_CHECK(boost::begin(range) != boost::end(range)); BOOST_CHECK(body(response_).size() != 0); } diff --git a/libs/network/test/http/client_get_streaming_test.cpp b/libs/network/test/http/client_get_streaming_test.cpp index 4925814aa..a3ba4cf96 100644 --- a/libs/network/test/http/client_get_streaming_test.cpp +++ b/libs/network/test/http/client_get_streaming_test.cpp @@ -33,8 +33,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(http_client_get_streaming_test, client, { client client_; BOOST_CHECK_NO_THROW(response = client_.get(request, handler_instance)); - typename net::headers_range::type range = - headers(response)["Content-Type"]; + auto range = headers(response)["Content-Type"]; BOOST_CHECK(!boost::empty(range)); BOOST_CHECK_EQUAL(body(response).size(), 0u); BOOST_CHECK_EQUAL(response.version().substr(0, 7), std::string("HTTP/1.")); diff --git a/libs/network/test/http/client_types.hpp b/libs/network/test/http/client_types.hpp index 3b5474270..e9e253a27 100644 --- a/libs/network/test/http/client_types.hpp +++ b/libs/network/test/http/client_types.hpp @@ -2,17 +2,19 @@ #define CLIENT_TYPES_ROOWQCLE // Copyright 2010 Dean Michael Berris. +// Copyright 2015 Google, Inc. // 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) -#include "tag_types.hpp" -#include #include -#include -#include #include +#include +#include +#include +#include #include +#include "tag_types.hpp" namespace mpl = boost::mpl; diff --git a/libs/network/test/http/request_linearize_test.cpp b/libs/network/test/http/request_linearize_test.cpp index 204fbff1c..f29e1ee0b 100644 --- a/libs/network/test/http/request_linearize_test.cpp +++ b/libs/network/test/http/request_linearize_test.cpp @@ -5,10 +5,11 @@ // http://www.boost.org/LICENSE_1_0.txt) #define BOOST_TEST_MODULE HTTP Request Linearize Test -#include +#include +#include #include +#include #include -#include #include #include diff --git a/libs/network/test/http/server_async_run_stop_concurrency.cpp b/libs/network/test/http/server_async_run_stop_concurrency.cpp index f3a69e8a7..535111906 100644 --- a/libs/network/test/http/server_async_run_stop_concurrency.cpp +++ b/libs/network/test/http/server_async_run_stop_concurrency.cpp @@ -11,7 +11,7 @@ namespace http = boost::network::http; namespace util = boost::network::utils; struct dummy_async_handler; -typedef http::async_server async_server; +typedef http::server async_server; struct dummy_async_handler { void operator()(async_server::request const& req, diff --git a/libs/network/test/http/server_constructor_test.cpp b/libs/network/test/http/server_constructor_test.cpp index dc8349b46..0da83e4bd 100644 --- a/libs/network/test/http/server_constructor_test.cpp +++ b/libs/network/test/http/server_constructor_test.cpp @@ -12,50 +12,28 @@ namespace http = boost::network::http; namespace util = boost::network::utils; -struct dummy_sync_handler; struct dummy_async_handler; -typedef http::server sync_server; -typedef http::async_server async_server; - -struct dummy_sync_handler { - void operator()(sync_server::request const &req, sync_server::response &res) { - // Really, this is just for testing purposes - } - - void log(char const *) {} -}; +typedef http::server async_server; struct dummy_async_handler { - void operator()(async_server::request const &req, - async_server::connection_ptr conn) { + void operator()(async_server::request const &, async_server::connection_ptr) { // Really, this is just for testing purposes } }; BOOST_AUTO_TEST_CASE(minimal_constructor) { - dummy_sync_handler sync_handler; dummy_async_handler async_handler; - sync_server::options sync_options(sync_handler); async_server::options async_options(async_handler); - BOOST_CHECK_NO_THROW( - sync_server sync_instance(sync_options.address("127.0.0.1").port("80"))); BOOST_CHECK_NO_THROW(async_server async_instance( async_options.address("127.0.0.1").port("80"))); } BOOST_AUTO_TEST_CASE(with_io_service_parameter) { - dummy_sync_handler sync_handler; dummy_async_handler async_handler; boost::shared_ptr thread_pool; boost::shared_ptr io_service; - sync_server::options sync_options(sync_handler); async_server::options async_options(async_handler); - BOOST_CHECK_NO_THROW( - sync_server sync_instance(sync_options.address("127.0.0.1") - .port("80") - .io_service(io_service) - .thread_pool(thread_pool))); BOOST_CHECK_NO_THROW( async_server async_instance(async_options.address("127.0.0.1") .port("80") @@ -64,20 +42,13 @@ BOOST_AUTO_TEST_CASE(with_io_service_parameter) { } BOOST_AUTO_TEST_CASE(throws_on_failure) { - dummy_sync_handler sync_handler; dummy_async_handler async_handler; boost::shared_ptr thread_pool; boost::shared_ptr io_service; - sync_server::options sync_options(sync_handler); async_server::options async_options(async_handler); - sync_server sync_instance(sync_options.address("127.0.0.1") - .port("80") - .io_service(io_service) - .thread_pool(thread_pool)); async_server async_instance(async_options.address("127.0.0.1") .port("80") .io_service(io_service) .thread_pool(thread_pool)); - BOOST_CHECK_THROW(sync_instance.run(), std::runtime_error); BOOST_CHECK_THROW(async_instance.run(), std::runtime_error); } diff --git a/libs/network/test/http/tag_types.hpp b/libs/network/test/http/tag_types.hpp index 1d8df0922..681a4ae59 100644 --- a/libs/network/test/http/tag_types.hpp +++ b/libs/network/test/http/tag_types.hpp @@ -13,8 +13,6 @@ namespace http = boost::network::http; typedef boost::mpl::vector tag_types; diff --git a/libs/network/test/message_test.cpp b/libs/network/test/message_test.cpp index d31429682..166811af1 100644 --- a/libs/network/test/message_test.cpp +++ b/libs/network/test/message_test.cpp @@ -5,18 +5,17 @@ // http://www.boost.org/LICENSE_1_0.txt) #define BOOST_TEST_MODULE message test -#include -#include -#include #include +#include #include +#include +#include +#include using namespace boost::network; typedef boost::mpl::list tag_types; struct string_header_name { @@ -122,7 +121,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(copy_constructor_test, T, tag_types) { basic_message copy(instance); BOOST_CHECK_EQUAL(headers(copy).count(header_name::string), static_cast(1)); - typename headers_range >::type range = + typename headers_range::type range = headers(copy)[header_name::string]; BOOST_CHECK(boost::begin(range) != boost::end(range)); } @@ -143,7 +142,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(headers_directive_test, T, tag_types) { instance << header(header_name::string, header_value::string); BOOST_CHECK_EQUAL(headers(instance).count(header_name::string), static_cast(1)); - typename headers_range >::type range = + typename headers_range::type range = headers(instance)[header_name::string]; BOOST_CHECK(boost::begin(range) != boost::end(range)); } @@ -172,6 +171,6 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(remove_header_directive_test, T, tag_types) { basic_message instance; instance << header(header_name::string, header_value::string) << remove_header(header_name::string); - typename headers_range >::type range = headers(instance); + typename headers_range::type range = headers(instance); BOOST_CHECK(boost::begin(range) == boost::end(range)); } From 34c2a2eb6ed5acdbd1b9a4a48561086390377f3e Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Thu, 17 Dec 2015 01:07:19 +1100 Subject: [PATCH 050/123] Disable SSLv3 Support by Default If users do not provide their own options in the construction of the HTTP Client with SSL support, we explicitly turn off SSLv3 support. Fixes cpp-netlib/cpp-netlib#570 --- .../http/client/connection/ssl_delegate.ipp | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/boost/network/protocol/http/client/connection/ssl_delegate.ipp b/boost/network/protocol/http/client/connection/ssl_delegate.ipp index 7c4672097..539751488 100644 --- a/boost/network/protocol/http/client/connection/ssl_delegate.ipp +++ b/boost/network/protocol/http/client/connection/ssl_delegate.ipp @@ -7,17 +7,15 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include #include #include +#include boost::network::http::impl::ssl_delegate::ssl_delegate( asio::io_service &service, bool always_verify_peer, optional certificate_filename, - optional verify_path, - optional certificate_file, - optional private_key_file, - optional ciphers, + optional verify_path, optional certificate_file, + optional private_key_file, optional ciphers, long ssl_options) : service_(service), certificate_filename_(std::move(certificate_filename)), @@ -29,15 +27,19 @@ boost::network::http::impl::ssl_delegate::ssl_delegate( always_verify_peer_(always_verify_peer) {} void boost::network::http::impl::ssl_delegate::connect( - asio::ip::tcp::endpoint &endpoint, std::string host, boost::uint16_t source_port, + asio::ip::tcp::endpoint &endpoint, std::string host, + boost::uint16_t source_port, function handler) { context_.reset( - new asio::ssl::context(service_, asio::ssl::context::sslv23_client)); + new asio::ssl::context(asio::ssl::context::method::sslv23_client)); if (ciphers_) { ::SSL_CTX_set_cipher_list(context_->native_handle(), ciphers_->c_str()); } if (ssl_options_ != 0) { context_->set_options(ssl_options_); + } else { + // By default, disable v3 support. + context_->set_options(asio::ssl::context::no_sslv3); } if (certificate_filename_ || verify_path_) { context_->set_verify_mode(asio::ssl::context::verify_peer); @@ -50,8 +52,9 @@ void boost::network::http::impl::ssl_delegate::connect( // use openssl default verify paths. uses openssl environment variables // SSL_CERT_DIR, SSL_CERT_FILE context_->set_default_verify_paths(); - } else + } else { context_->set_verify_mode(asio::ssl::context::verify_none); + } } if (certificate_file_) context_->use_certificate_file(*certificate_file_, @@ -60,9 +63,10 @@ void boost::network::http::impl::ssl_delegate::connect( context_->use_private_key_file(*private_key_file_, boost::asio::ssl::context::pem); - tcp_socket_.reset(new asio::ip::tcp::socket(service_, asio::ip::tcp::endpoint(asio::ip::tcp::v4(), source_port))); - socket_.reset( - new asio::ssl::stream(*(tcp_socket_.get()), *context_)); + tcp_socket_.reset(new asio::ip::tcp::socket( + service_, asio::ip::tcp::endpoint(asio::ip::tcp::v4(), source_port))); + socket_.reset(new asio::ssl::stream( + *(tcp_socket_.get()), *context_)); if (always_verify_peer_) socket_->set_verify_callback(boost::asio::ssl::rfc2818_verification(host)); @@ -109,5 +113,4 @@ void boost::network::http::impl::ssl_delegate::disconnect() { boost::network::http::impl::ssl_delegate::~ssl_delegate() {} -#endif /* BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_SSL_DELEGATE_IPP_20110819 \ - */ +#endif // BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_SSL_DELEGATE_IPP_20110819 From df3c16cccac022f007e59d3accfd34995c81e7ff Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Fri, 18 Dec 2015 23:54:38 +1100 Subject: [PATCH 051/123] Initial migration from Boost.Test to googletest Squashed from a few (local) commits: * Migrate message_transform_test and utils_thread_pool tests to googletest * Simplify message testing, breaking it down to basics (construction, equality) * Add googletest to YCM config * Add the googletest dependency to CMakeLists.txt * Add googlemock and googletest submodules properly. * Add submodules for gtest and gmock --- .gitmodules | 6 + .ycm_extra_conf.py | 4 + CMakeLists.txt | 1 + boost/network/message.hpp | 12 ++ deps/googlemock | 1 + deps/googletest | 1 + libs/network/test/CMakeLists.txt | 51 ++--- libs/network/test/message_test.cpp | 204 +++++-------------- libs/network/test/message_transform_test.cpp | 33 ++- libs/network/test/utils_thread_pool.cpp | 36 +++- 10 files changed, 139 insertions(+), 210 deletions(-) create mode 100644 .gitmodules create mode 160000 deps/googlemock create mode 160000 deps/googletest diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..c65b6b312 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "deps/googletest"] + path = deps/googletest + url = https://github.com/google/googletest.git +[submodule "deps/googlemock"] + path = deps/googlemock + url = https://github.com/google/googlemock.git diff --git a/.ycm_extra_conf.py b/.ycm_extra_conf.py index 2fca4f841..9b241abb0 100644 --- a/.ycm_extra_conf.py +++ b/.ycm_extra_conf.py @@ -30,6 +30,10 @@ '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1', '-I', os.environ['BOOST_ROOT'], + # add dependency to googletest and googlemock + '-I', 'deps/googletest/googletest/include', + '-I', 'deps/googletest/googlemock/include', + # Always enable debugging for the project when building for semantic # completion. '-DBOOST_NETWORK_DEBUG', diff --git a/CMakeLists.txt b/CMakeLists.txt index ec04a3a57..52b995476 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,6 +95,7 @@ if (Boost_FOUND) enable_testing() add_subdirectory(libs/network/src) if (CPP-NETLIB_BUILD_TESTS) + add_subdirectory(deps/googletest) add_subdirectory(libs/network/test) endif (CPP-NETLIB_BUILD_TESTS) if (CPP-NETLIB_BUILD_EXPERIMENTS) diff --git a/boost/network/message.hpp b/boost/network/message.hpp index 9b4f08bf8..e262e91fc 100644 --- a/boost/network/message.hpp +++ b/boost/network/message.hpp @@ -101,6 +101,18 @@ struct basic_message { friend struct detail::directive_base; friend struct detail::wrapper_base >; + // Define an equality operator that's only available via ADL. + friend bool operator==(basic_message const& l, basic_message const& r) { + return l.headers_ == r.headers_ && l.source_ == r.source_ && + l.destination_ == r.destination_ && l.body_ == r.body_; + } + + // Define an inequality operator that's only available via ADL in terms of + // equality defined above. + friend bool operator!=(basic_message const& l, basic_message const& r) { + return !(l == r); + } + mutable headers_container_type headers_; mutable string_type body_; mutable string_type source_; diff --git a/deps/googlemock b/deps/googlemock new file mode 160000 index 000000000..f7d03d273 --- /dev/null +++ b/deps/googlemock @@ -0,0 +1 @@ +Subproject commit f7d03d2734759ee12b57d2dbcb695607d89e8e05 diff --git a/deps/googletest b/deps/googletest new file mode 160000 index 000000000..ddb8012eb --- /dev/null +++ b/deps/googletest @@ -0,0 +1 @@ +Subproject commit ddb8012eb48bc203aa93dcc2b22c1db516302b29 diff --git a/libs/network/test/CMakeLists.txt b/libs/network/test/CMakeLists.txt index 7d1e5386e..a8be0cfdf 100644 --- a/libs/network/test/CMakeLists.txt +++ b/libs/network/test/CMakeLists.txt @@ -1,9 +1,10 @@ -# Copyright (c) Dean Michael Berris 2010. +# Copyright (c) Dean Michael Berris 2010. +# Copyright 2015 Google, Inc. # 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) +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) -include_directories(${CPP-NETLIB_SOURCE_DIR}) +include_directories(${CPP-NETLIB_SOURCE_DIR} ${gtest_SOURCE_DIR}/include) add_subdirectory(uri) add_subdirectory(http) @@ -17,26 +18,28 @@ if (Boost_FOUND) # utils_base64_test -- turn on when ready. ) foreach (test ${TESTS}) - if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU) - set_source_files_properties(${test}.cpp - PROPERTIES COMPILE_FLAGS "-Wall") - endif() - add_executable(cpp-netlib-${test} ${test}.cpp) - add_dependencies(cpp-netlib-${test} cppnetlib-uri) - target_link_libraries(cpp-netlib-${test} ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} cppnetlib-uri) - if (OPENSSL_FOUND) - target_link_libraries(cpp-netlib-${test} ${OPENSSL_LIBRARIES}) - endif() - if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU AND ${CMAKE_SYSTEM_NAME} MATCHES "Windows") - target_link_libraries(cpp-netlib-${test} ws2_32 wsock32) - endif() - if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") - target_link_libraries(cpp-netlib-${test} rt) - endif() - set_target_properties(cpp-netlib-${test} - PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests) - add_test(cpp-netlib-${test} - ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-${test}) + if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU) + set_source_files_properties(${test}.cpp + PROPERTIES COMPILE_FLAGS "-Wall") + endif() + add_executable(cpp-netlib-${test} ${test}.cpp) + add_dependencies(cpp-netlib-${test} cppnetlib-uri) + target_link_libraries(cpp-netlib-${test} + ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY} + ${CMAKE_THREAD_LIBS_INIT} cppnetlib-uri gtest_main) + if (OPENSSL_FOUND) + target_link_libraries(cpp-netlib-${test} ${OPENSSL_LIBRARIES}) + endif() + if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU AND ${CMAKE_SYSTEM_NAME} MATCHES "Windows") + target_link_libraries(cpp-netlib-${test} ws2_32 wsock32) + endif() + if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + target_link_libraries(cpp-netlib-${test} rt) + endif() + set_target_properties(cpp-netlib-${test} + PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests) + add_test(cpp-netlib-${test} + ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-${test}) endforeach (test) # Also copy the server directory to the root of the build directory. diff --git a/libs/network/test/message_test.cpp b/libs/network/test/message_test.cpp index d31429682..90ce480a8 100644 --- a/libs/network/test/message_test.cpp +++ b/libs/network/test/message_test.cpp @@ -1,177 +1,65 @@ -// Copyright Dean Michael Berris 2007. +// Copyright Dean Michael Berris 2007. +// Copyright 2015 Google, Inc. // 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) +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) -#define BOOST_TEST_MODULE message test -#include -#include -#include +// Migrated from using Boost.Test to using googletest instead. +#include #include -#include +#include +#include -using namespace boost::network; +namespace { -typedef boost::mpl::list tag_types; +namespace http = boost::network::http; +namespace network = boost::network; -struct string_header_name { - static std::string string; +template +class MessageTest : public ::testing::Test { }; -std::string string_header_name::string = "Header"; - -struct wstring_header_name { - static std::wstring string; -}; - -std::wstring wstring_header_name::string = L"Header"; - -struct string_header_value { - static std::string string; -}; - -std::string string_header_value::string = "Value"; - -struct wstring_header_value { - static std::wstring string; -}; - -std::wstring wstring_header_value::string = L"Value"; - -template -struct header_name : string_header_name {}; - -template <> -struct header_name : wstring_header_name {}; - -template -struct header_value : string_header_value {}; - -template <> -struct header_value : wstring_header_value {}; - -struct string_body_data { - static std::string string; -}; - -std::string string_body_data::string = - "The quick brown fox jumps over the lazy dog."; - -struct wstring_body_data { - static std::wstring string; -}; - -std::wstring wstring_body_data::string = - L"The quick brown fox jumps over the lazy dog."; - -template -struct body_data : string_body_data {}; - -template <> -struct body_data : wstring_body_data {}; - -struct string_source_data { - static std::string string; -}; - -std::string string_source_data::string = "Source"; - -struct wstring_source_data { - static std::wstring string; -}; - -std::wstring wstring_source_data::string = L"Source"; - -template -struct source_data : string_source_data {}; - -template <> -struct source_data : wstring_body_data {}; - -struct string_destination_data { - static std::string string; -}; - -std::string string_destination_data::string = "Destination"; - -struct wstring_destination_data { - static std::wstring string; -}; - -std::wstring wstring_destination_data::string = L"Destination"; - -template -struct destination_data : string_destination_data {}; - -template <> -struct destination_data : wstring_destination_data {}; +using TagTypes = ::testing::Types; +TYPED_TEST_CASE(MessageTest, TagTypes); + +TYPED_TEST(MessageTest, Constructors){ + network::basic_message message; // default construction + auto copy = message; // copy construction + ASSERT_TRUE(copy == message); +} -/** - * Defines a set of template functions that can be used to test - * generic code. - */ +TYPED_TEST(MessageTest, Equality) { + // Create an original message. + network::basic_message message; + message << network::source("source") << network::destination("destination") + << network::header("key", "value") << network::body("body"); -BOOST_AUTO_TEST_CASE_TEMPLATE(copy_constructor_test, T, tag_types) { - basic_message instance; - instance << header(header_name::string, header_value::string); - basic_message copy(instance); - BOOST_CHECK_EQUAL(headers(copy).count(header_name::string), - static_cast(1)); - typename headers_range >::type range = - headers(copy)[header_name::string]; - BOOST_CHECK(boost::begin(range) != boost::end(range)); -} + // Create the identical message. + network::basic_message other; + other << network::source("source") << network::destination("destination") + << network::header("key", "value") << network::body("body"); -BOOST_AUTO_TEST_CASE_TEMPLATE(swap_test, T, tag_types) { - basic_message instance; - instance << header(header_name::string, header_value::string); - basic_message other; - swap(instance, other); - BOOST_CHECK_EQUAL(headers(instance).count(header_name::string), - static_cast(0)); - BOOST_CHECK_EQUAL(headers(other).count(header_name::string), - static_cast(1)); + ASSERT_TRUE(message == other); } -BOOST_AUTO_TEST_CASE_TEMPLATE(headers_directive_test, T, tag_types) { - basic_message instance; - instance << header(header_name::string, header_value::string); - BOOST_CHECK_EQUAL(headers(instance).count(header_name::string), - static_cast(1)); - typename headers_range >::type range = - headers(instance)[header_name::string]; - BOOST_CHECK(boost::begin(range) != boost::end(range)); -} +TYPED_TEST(MessageTest, Inequality) { + // Create an original message. + network::basic_message message; + message << network::source("source") << network::destination("destination") + << network::header("key", "value") << network::body("body"); -BOOST_AUTO_TEST_CASE_TEMPLATE(body_directive_test, T, tag_types) { - basic_message instance; - instance << ::boost::network::body(body_data::string); - typename string::type body_string = body(instance); - BOOST_CHECK(body_string == body_data::string); -} + // Create a different message. + network::basic_message other; + other << network::source("source") << network::destination("destination") + << network::header("key", "value") << network::body("different body!"); -BOOST_AUTO_TEST_CASE_TEMPLATE(source_directive_test, T, tag_types) { - basic_message instance; - instance << ::boost::network::source(source_data::string); - typename string::type source_string = source(instance); - BOOST_CHECK(source_string == source_data::string); + ASSERT_FALSE(message == other); } -BOOST_AUTO_TEST_CASE_TEMPLATE(destination_directive_test, T, tag_types) { - basic_message instance; - instance << destination(destination_data::string); - BOOST_CHECK(destination(instance) == destination_data::string); -} +} // namespace -BOOST_AUTO_TEST_CASE_TEMPLATE(remove_header_directive_test, T, tag_types) { - basic_message instance; - instance << header(header_name::string, header_value::string) - << remove_header(header_name::string); - typename headers_range >::type range = headers(instance); - BOOST_CHECK(boost::begin(range) == boost::end(range)); -} diff --git a/libs/network/test/message_transform_test.cpp b/libs/network/test/message_transform_test.cpp index bab8c4ede..10971519b 100644 --- a/libs/network/test/message_transform_test.cpp +++ b/libs/network/test/message_transform_test.cpp @@ -1,39 +1,38 @@ -// Copyright Dean Michael Berris 2007. +// Copyright Dean Michael Berris 2007. +// Copyright 2015, Google, Inc. // 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) +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) -#define BOOST_TEST_MODULE message test -#include -#include -#include +#include #include +#include -BOOST_AUTO_TEST_CASE(message_transform_toupper) { +TEST(MessageTransformTest, TransformToUpper) { using namespace boost::network; message msg; msg << source("me"); - BOOST_CHECK_EQUAL(source(msg), "me"); + ASSERT_EQ("me",source(msg)); msg << transform(to_upper_, source_); - BOOST_CHECK_EQUAL(source(msg), "ME"); + ASSERT_EQ("ME",source(msg)); msg << destination("you"); - BOOST_CHECK_EQUAL(destination(msg), "you"); + ASSERT_EQ("you",destination(msg)); msg << transform(to_upper_, destination_); - BOOST_CHECK_EQUAL(destination(msg), "YOU"); + ASSERT_EQ("YOU",destination(msg)); } -BOOST_AUTO_TEST_CASE(message_transform_tolower) { +TEST(MessageTransformTest, TransformToLower) { using namespace boost::network; message msg; msg << source("ME"); - BOOST_CHECK_EQUAL(source(msg), "ME"); + ASSERT_EQ("ME",source(msg)); msg << transform(to_lower_, source_); - BOOST_CHECK_EQUAL(source(msg), "me"); + ASSERT_EQ("me",source(msg)); msg << destination("YOU"); - BOOST_CHECK_EQUAL(destination(msg), "YOU"); + ASSERT_EQ("YOU",destination(msg)); msg << transform(to_lower_, destination_); - BOOST_CHECK_EQUAL(destination(msg), "you"); + ASSERT_EQ("you",destination(msg)); } diff --git a/libs/network/test/utils_thread_pool.cpp b/libs/network/test/utils_thread_pool.cpp index f2e424996..6a0cec6b6 100644 --- a/libs/network/test/utils_thread_pool.cpp +++ b/libs/network/test/utils_thread_pool.cpp @@ -1,14 +1,13 @@ // Copyright 2010 Dean Michael Berris. +// Copyright 2015 Google, Inc. // 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) -#define BOOST_TEST_MODULE utils thread pool test -#include -#include +#include +#include #include -#include using namespace boost::network; @@ -20,27 +19,42 @@ using namespace boost::network; // syntactically. // -BOOST_AUTO_TEST_CASE(default_constructor) { +TEST(ThreadPoolTest, DefaultConstructor) { utils::thread_pool pool; - BOOST_CHECK_EQUAL(pool.thread_count(), std::size_t(1)); + ASSERT_EQ(1, pool.thread_count()); } struct foo { foo() : val_(0) {} void bar(int val) { val_ += val; } - int const val() const { return val_; } + int val() const { return val_; } protected: int val_; }; -BOOST_AUTO_TEST_CASE(post_work) { +TEST(ThreadPoolTest, PostWork) { foo instance; { utils::thread_pool pool; - BOOST_CHECK_NO_THROW(pool.post(boost::bind(&foo::bar, &instance, 1))); - BOOST_CHECK_NO_THROW(pool.post(boost::bind(&foo::bar, &instance, 2))); + ASSERT_NO_THROW(pool.post([&instance] { instance.bar(1); })); + ASSERT_NO_THROW(pool.post([&instance] { instance.bar(2); })); // require that pool is destroyed here, RAII baby } - BOOST_CHECK_EQUAL(instance.val(), 3); + ASSERT_EQ(instance.val(), 3); +} + +// Test using multiple threads. +TEST(ThreadPoolTest, MultipleThreads) { + std::atomic counter{0}; + constexpr int64_t kMaxCount = 1e5; + { + utils::thread_pool pool(8); // nice round number of threads. + for (int64_t i = 0; i < kMaxCount; ++i) { + ASSERT_NO_THROW(pool.post( + [&counter] { counter.fetch_add(1, std::memory_order_acq_rel); })); + } + // Wait for threads to be done. + } + ASSERT_EQ(kMaxCount, counter.load(std::memory_order_acquire)); } From f5925e15bbc451591af25486ba3d43d481fcf1e3 Mon Sep 17 00:00:00 2001 From: Glyn Matthews Date: Sun, 20 Dec 2015 10:17:13 +0100 Subject: [PATCH 052/123] Added missing header that was lost during the last merge. --- libs/network/test/message_test.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/network/test/message_test.cpp b/libs/network/test/message_test.cpp index a70170c37..c51c63aeb 100644 --- a/libs/network/test/message_test.cpp +++ b/libs/network/test/message_test.cpp @@ -10,6 +10,7 @@ #include #include #include +#include namespace { From 60d35b5f43a80a95f43f96c68ad17c95d497bcb3 Mon Sep 17 00:00:00 2001 From: Glyn Matthews Date: Sun, 20 Dec 2015 10:42:09 +0100 Subject: [PATCH 053/123] Removed keepalive tags from message_test.cpp --- libs/network/test/message_test.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/libs/network/test/message_test.cpp b/libs/network/test/message_test.cpp index c51c63aeb..2f1140364 100644 --- a/libs/network/test/message_test.cpp +++ b/libs/network/test/message_test.cpp @@ -23,8 +23,6 @@ class MessageTest : public ::testing::Test { using TagTypes = ::testing::Types; TYPED_TEST_CASE(MessageTest, TagTypes); From 28a4b71a525a8a6e192b79f21e0b189ef1ff2397 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Sat, 2 Jan 2016 14:29:49 +0300 Subject: [PATCH 054/123] XCode crash fix --- boost/network/uri/uri.ipp | 122 +++++++++++++++++++++++++++----------- 1 file changed, 87 insertions(+), 35 deletions(-) diff --git a/boost/network/uri/uri.ipp b/boost/network/uri/uri.ipp index 63813c6c8..a4c614e5d 100644 --- a/boost/network/uri/uri.ipp +++ b/boost/network/uri/uri.ipp @@ -84,42 +84,92 @@ struct uri_grammar ipvfuture %= qi::lit('v') >> +qi::xdigit >> '.' >> +(unreserved | sub_delims | ':'); + ipv6addresses[0] %= qi::repeat(6)[h16 >> ':'] >> ls32; + ipv6addresses[1] %= "::" >> qi::repeat(5)[h16 >> ':'] >> ls32; + ipv6addresses[2] %= -qi::raw[h16] >> "::" >> qi::repeat(4)[h16 >> ':'] + >> ls32; + ipv6addresses[3] %= -qi::raw[h16] >> "::" >> qi::repeat(3)[h16 >> ':'] + >> ls32; + ipv6addresses[4] %= -qi::raw[h16] >> "::" >> qi::repeat(2)[h16 >> ':'] + >> ls32; + ipv6addresses[5] %= -qi::raw[h16] >> "::" >> h16 >> ':' >> ls32; + ipv6addresses[6] %= -qi::raw[h16] >> "::" >> ls32; + ipv6addresses[7] %= -qi::raw[h16] >> "::" >> h16; + ipv6addresses[8] %= -qi::raw[h16] >> "::"; + ipv6addresses[9] %= -qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> + "::" >> qi::repeat(3)[h16 >> ':'] >> ls32; + ipv6addresses[10] %= -qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> + "::" >> qi::repeat(2)[h16 >> ':'] >> ls32; + ipv6addresses[11] %= -qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> + "::" >> h16 >> ':' >> ls32; + ipv6addresses[12] %= -qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> + "::" >> ls32; + ipv6addresses[13] %= -qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> + "::" >> h16; + ipv6addresses[14] %= -qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> + "::"; + ipv6addresses[15] %= -qi::raw[qi::repeat(2)[(h16 >> ':')] >> h16] >> + "::" >> qi::repeat(2)[h16 >> ':'] >> ls32; + ipv6addresses[16] %= -qi::raw[qi::repeat(2)[(h16 >> ':')] >> h16] >> + "::" >> h16 >> ':' >> ls32; + ipv6addresses[17] %= -qi::raw[qi::repeat(2)[(h16 >> ':')] >> h16] >> + "::" >> ls32; + ipv6addresses[18] %= -qi::raw[qi::repeat(2)[(h16 >> ':')] >> h16] >> + "::" >> h16; + ipv6addresses[19] %= -qi::raw[qi::repeat(2)[(h16 >> ':')] >> h16] >> + "::"; + ipv6addresses[20] %= -qi::raw[qi::repeat(3)[(h16 >> ':')] >> h16] >> + "::" >> h16 >> ':' >> ls32; + ipv6addresses[21] %= -qi::raw[qi::repeat(3)[(h16 >> ':')] >> h16] >> + "::" >> ls32; + ipv6addresses[22] %= -qi::raw[qi::repeat(3)[(h16 >> ':')] >> h16] >> + "::" >> h16; + ipv6addresses[23] %= -qi::raw[qi::repeat(3)[(h16 >> ':')] >> h16] >> + "::"; + ipv6addresses[24] %= -qi::raw[qi::repeat(4)[(h16 >> ':')] >> h16] >> + "::" >> ls32; + ipv6addresses[25] %= -qi::raw[qi::repeat(4)[(h16 >> ':')] >> h16] >> + "::" >> h16; + ipv6addresses[26] %= -qi::raw[qi::repeat(4)[(h16 >> ':')] >> h16] >> + "::"; + ipv6addresses[27] %= -qi::raw[qi::repeat(5)[(h16 >> ':')] >> h16] >> + "::" >> h16; + ipv6addresses[28] %= -qi::raw[qi::repeat(5)[(h16 >> ':')] >> h16] >> + "::"; + ipv6addresses[29] %= -qi::raw[qi::repeat(6)[(h16 >> ':')] >> h16] >> + "::"; + ipv6address %= qi::raw - [qi::repeat(6)[h16 >> ':'] >> ls32 | - "::" >> qi::repeat(5)[h16 >> ':'] >> ls32 | - -qi::raw[h16] >> "::" >> qi::repeat(4)[h16 >> ':'] >> ls32 | - -qi::raw[h16] >> "::" >> qi::repeat(3)[h16 >> ':'] >> ls32 | - -qi::raw[h16] >> "::" >> qi::repeat(2)[h16 >> ':'] >> ls32 | - -qi::raw[h16] >> "::" >> h16 >> ':' >> ls32 | - -qi::raw[h16] >> "::" >> ls32 | -qi::raw[h16] >> "::" >> h16 | - -qi::raw[h16] >> "::" | - -qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> "::" >> - qi::repeat(3)[h16 >> ':'] >> ls32 | - -qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> "::" >> - qi::repeat(2)[h16 >> ':'] >> ls32 | - -qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> "::" >> h16 >> - ':' >> ls32 | - -qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> "::" >> ls32 | - -qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> "::" >> h16 | - -qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> "::" | - -qi::raw[qi::repeat(2)[(h16 >> ':')] >> h16] >> "::" >> - qi::repeat(2)[h16 >> ':'] >> ls32 | - -qi::raw[qi::repeat(2)[(h16 >> ':')] >> h16] >> "::" >> h16 >> - ':' >> ls32 | - -qi::raw[qi::repeat(2)[(h16 >> ':')] >> h16] >> "::" >> ls32 | - -qi::raw[qi::repeat(2)[(h16 >> ':')] >> h16] >> "::" >> h16 | - -qi::raw[qi::repeat(2)[(h16 >> ':')] >> h16] >> "::" | - -qi::raw[qi::repeat(3)[(h16 >> ':')] >> h16] >> "::" >> h16 >> - ':' >> ls32 | - -qi::raw[qi::repeat(3)[(h16 >> ':')] >> h16] >> "::" >> ls32 | - -qi::raw[qi::repeat(3)[(h16 >> ':')] >> h16] >> "::" >> h16 | - -qi::raw[qi::repeat(3)[(h16 >> ':')] >> h16] >> "::" | - -qi::raw[qi::repeat(4)[(h16 >> ':')] >> h16] >> "::" >> ls32 | - -qi::raw[qi::repeat(4)[(h16 >> ':')] >> h16] >> "::" >> h16 | - -qi::raw[qi::repeat(4)[(h16 >> ':')] >> h16] >> "::" | - -qi::raw[qi::repeat(5)[(h16 >> ':')] >> h16] >> "::" >> h16 | - -qi::raw[qi::repeat(5)[(h16 >> ':')] >> h16] >> "::" | - -qi::raw[qi::repeat(6)[(h16 >> ':')] >> h16] >> "::"]; + [ipv6addresses[0] | + ipv6addresses[1] | + ipv6addresses[2] | + ipv6addresses[3] | + ipv6addresses[4] | + ipv6addresses[5] | + ipv6addresses[6] | + ipv6addresses[7] | + ipv6addresses[8] | + ipv6addresses[9] | + ipv6addresses[10] | + ipv6addresses[11] | + ipv6addresses[12] | + ipv6addresses[13] | + ipv6addresses[14] | + ipv6addresses[15] | + ipv6addresses[16] | + ipv6addresses[17] | + ipv6addresses[18] | + ipv6addresses[19] | + ipv6addresses[20] | + ipv6addresses[21] | + ipv6addresses[22] | + ipv6addresses[23] | + ipv6addresses[24] | + ipv6addresses[25] | + ipv6addresses[26] | + ipv6addresses[27] | + ipv6addresses[28] | + ipv6addresses[29]]; // ls32 = ( h16 ":" h16 ) / IPv4address ls32 %= (h16 >> ':' >> h16) | ipv4address; @@ -178,6 +228,8 @@ struct uri_grammar ipv6address, ipvfuture, ip_literal; qi::rule h16, ls32; + qi::rule ipv6addresses[30]; + qi::rule()> host, port; From a9df2cdf6a30a022de92ff38e1d227f67227fc4c Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Thu, 7 Jan 2016 21:30:19 +1100 Subject: [PATCH 055/123] Convert all tests to use googletest This change systematically removes the dependency to Boost.Test throughout the tests in libs/network/test/*. Most of the changes are mechanical, and functionally equivalent. We can actually start simplifying the test structure after this change gets pulled into the main repository. --- CMakeLists.txt | 8 +- libs/network/test/CMakeLists.txt | 9 +- libs/network/test/http/CMakeLists.txt | 91 +-- .../test/http/client_constructor_test.cpp | 30 +- .../http/client_get_different_port_test.cpp | 19 +- .../test/http/client_get_streaming_test.cpp | 35 +- libs/network/test/http/client_get_test.cpp | 36 +- .../test/http/client_get_timeout_test.cpp | 39 +- .../test/http/client_include_inlined.cpp | 22 - .../http/client_localhost_normal_test.cpp | 308 +++++----- .../test/http/client_localhost_ssl_test.cpp | 306 +++------- libs/network/test/http/client_types.hpp | 59 +- .../test/http/message_async_ready_test.cpp | 17 +- .../http/request_incremental_parser_test.cpp | 40 +- .../test/http/request_linearize_test.cpp | 39 +- .../http/response_incremental_parser_test.cpp | 118 ++-- libs/network/test/http/server_async.cpp | 52 -- .../test/http/server_async_less_copy.cpp | 61 -- .../server_async_run_stop_concurrency.cpp | 15 +- .../test/http/server_constructor_test.cpp | 24 +- .../test/http/server_header_parser_test.cpp | 10 +- libs/network/test/http/server_hello_world.cpp | 51 -- .../test/http/server_include_inlined.cpp | 60 -- libs/network/test/http/tag_types.hpp | 13 +- libs/network/test/uri/CMakeLists.txt | 34 +- libs/network/test/uri/relative_uri_test.cpp | 14 +- .../test/uri/uri_builder_stream_test.cpp | 82 +-- libs/network/test/uri/uri_builder_test.cpp | 82 +-- libs/network/test/uri/uri_encoding_test.cpp | 30 +- libs/network/test/uri/uri_test.cpp | 533 +++++++++--------- 30 files changed, 937 insertions(+), 1300 deletions(-) delete mode 100644 libs/network/test/http/client_include_inlined.cpp delete mode 100644 libs/network/test/http/server_async.cpp delete mode 100644 libs/network/test/http/server_async_less_copy.cpp delete mode 100644 libs/network/test/http/server_hello_world.cpp delete mode 100644 libs/network/test/http/server_include_inlined.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 52b995476..7052ac1e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.0) project(CPP-NETLIB) option( CPP-NETLIB_BUILD_SHARED_LIBS "Build cpp-netlib as shared libraries." OFF ) @@ -45,9 +45,9 @@ add_definitions(-DBOOST_TEST_DYN_LINK) # Always use multi-threaded Boost libraries. set(Boost_USE_MULTI_THREADED ON) -find_package( Boost 1.57.0 - REQUIRED unit_test_framework system regex date_time thread filesystem - program_options chrono atomic ) +find_package(Boost 1.57.0 + REQUIRED system regex date_time thread filesystem program_options chrono + atomic) if (CPP-NETLIB_ENABLE_HTTPS) find_package( OpenSSL ) diff --git a/libs/network/test/CMakeLists.txt b/libs/network/test/CMakeLists.txt index a8be0cfdf..5f4061a05 100644 --- a/libs/network/test/CMakeLists.txt +++ b/libs/network/test/CMakeLists.txt @@ -10,11 +10,7 @@ add_subdirectory(uri) add_subdirectory(http) if (Boost_FOUND) - set( - TESTS - message_test - message_transform_test - utils_thread_pool + set(TESTS message_test message_transform_test utils_thread_pool # utils_base64_test -- turn on when ready. ) foreach (test ${TESTS}) @@ -23,7 +19,7 @@ if (Boost_FOUND) PROPERTIES COMPILE_FLAGS "-Wall") endif() add_executable(cpp-netlib-${test} ${test}.cpp) - add_dependencies(cpp-netlib-${test} cppnetlib-uri) + add_dependencies(cpp-netlib-${test} cppnetlib-uri gtest_main) target_link_libraries(cpp-netlib-${test} ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} cppnetlib-uri gtest_main) @@ -44,6 +40,5 @@ if (Boost_FOUND) # Also copy the server directory to the root of the build directory. file(COPY server DESTINATION ${CPP-NETLIB_BINARY_DIR}/libs/network/test/) - endif() diff --git a/libs/network/test/http/CMakeLists.txt b/libs/network/test/http/CMakeLists.txt index 019fe0120..62fc03f41 100644 --- a/libs/network/test/http/CMakeLists.txt +++ b/libs/network/test/http/CMakeLists.txt @@ -12,82 +12,93 @@ if (OPENSSL_FOUND) endif() if (Boost_FOUND) - set ( TESTS - response_incremental_parser_test - request_incremental_parser_test - request_linearize_test - ) + set(TESTS response_incremental_parser_test request_incremental_parser_test + request_linearize_test) foreach ( test ${TESTS} ) add_executable(cpp-netlib-http-${test} ${test}.cpp) - add_dependencies(cpp-netlib-http-${test} + add_dependencies(cpp-netlib-http-${test} gtest_main cppnetlib-uri) target_link_libraries(cpp-netlib-http-${test} - ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} + ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} gtest_main cppnetlib-uri) - if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU AND ${CMAKE_SYSTEM_NAME} MATCHES "Windows") + if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU AND ${CMAKE_SYSTEM_NAME} MATCHES "Windows") target_link_libraries(cpp-netlib-http-${test} ws2_32) endif() - if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") - target_link_libraries(cpp-netlib-http-${test} rt) - endif() + if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + target_link_libraries(cpp-netlib-http-${test} rt) + endif() set_target_properties(cpp-netlib-http-${test} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests) add_test(cpp-netlib-http-${test} ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-http-${test}) endforeach (test) - set ( TESTS - client_constructor_test - client_get_test - client_get_different_port_test - client_get_timeout_test - client_get_streaming_test - ) + set(TESTS client_constructor_test client_get_test + client_get_different_port_test client_get_timeout_test + client_get_streaming_test) foreach ( test ${TESTS} ) add_executable(cpp-netlib-http-${test} ${test}.cpp) - add_dependencies(cpp-netlib-http-${test} - cppnetlib-uri - cppnetlib-client-connections) - target_link_libraries(cpp-netlib-http-${test} - ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} - cppnetlib-uri - cppnetlib-client-connections) + add_dependencies(cpp-netlib-http-${test} cppnetlib-uri + cppnetlib-client-connections gtest_main) + target_link_libraries(cpp-netlib-http-${test} ${Boost_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} cppnetlib-uri gtest_main cppnetlib-client-connections) if (OPENSSL_FOUND) target_link_libraries(cpp-netlib-http-${test} ${OPENSSL_LIBRARIES}) endif() - if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU AND ${CMAKE_SYSTEM_NAME} MATCHES "Windows") + if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU AND ${CMAKE_SYSTEM_NAME} MATCHES "Windows") target_link_libraries(cpp-netlib-http-${test} ws2_32) endif() - if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") - target_link_libraries(cpp-netlib-http-${test} rt) - endif() + if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + target_link_libraries(cpp-netlib-http-${test} rt) + endif() set_target_properties(cpp-netlib-http-${test} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests) add_test(cpp-netlib-http-${test} ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-http-${test}) endforeach (test) - set ( SERVER_API_TESTS - server_constructor_test - server_async_run_stop_concurrency - server_header_parser_test - ) - foreach ( test ${SERVER_API_TESTS} ) + set(SERVER_API_TESTS server_constructor_test + server_header_parser_test) + foreach (test ${SERVER_API_TESTS}) add_executable(cpp-netlib-http-${test} ${test}.cpp) add_dependencies(cpp-netlib-http-${test} cppnetlib-server-parsers) - target_link_libraries(cpp-netlib-http-${test} ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} cppnetlib-server-parsers) + target_link_libraries(cpp-netlib-http-${test} ${Boost_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} cppnetlib-server-parsers gtest_main) if (OPENSSL_FOUND) target_link_libraries(cpp-netlib-http-${test} ${OPENSSL_LIBRARIES}) endif() - if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU AND ${CMAKE_SYSTEM_NAME} MATCHES "Windows") + if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU AND ${CMAKE_SYSTEM_NAME} MATCHES "Windows") target_link_libraries(cpp-netlib-http-${test} ws2_32 wsock32) endif() - if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") - target_link_libraries(cpp-netlib-http-${test} rt) - endif() + if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + target_link_libraries(cpp-netlib-http-${test} rt) + endif() set_target_properties(cpp-netlib-http-${test} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests) add_test(cpp-netlib-http-${test} ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-http-${test}) endforeach (test) + # Add the server start/stop concurrency test + add_executable(cpp-netlib-http-server_async_run_stop_concurrency + server_async_run_stop_concurrency.cpp) + add_dependencies(cpp-netlib-http-server_async_run_stop_concurrency + cppnetlib-server-parsers) + target_link_libraries(cpp-netlib-http-server_async_run_stop_concurrency + ${Boost_LIBRARIES} cppnetlib-server-parsers) + if (OPENSSL_FOUND) + target_link_libraries(cpp-netlib-http-server_async_run_stop_concurrency + ${OPENSSL_LIBRARIES}) + endif() + if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU + AND ${CMAKE_SYSTEM_NAME} MATCHES "Windows") + target_link_libraries(cpp-netlib-http-server_async_run_stop_concurrency + ws2_32 wsock32) + endif() + if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + target_link_libraries(cpp-netlib-http-server_async_run_stop_concurrency rt) + endif() + set_target_properties(cpp-netlib-http-server_async_run_stop_concurrency + PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests) + add_test(cpp-netlib-http-server_async_run_stop_concurrency + ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-http-server_async_run_stop_concurrency) endif() diff --git a/libs/network/test/http/client_constructor_test.cpp b/libs/network/test/http/client_constructor_test.cpp index f5a6dad14..5a64d6d2f 100644 --- a/libs/network/test/http/client_constructor_test.cpp +++ b/libs/network/test/http/client_constructor_test.cpp @@ -1,33 +1,35 @@ // Copyright 2010 Dean Michael Berris. +// Copyright 2015 Google, Inc. // 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) -#define BOOST_TEST_MODULE HTTP 1.0 Client Constructor Test +// Migrated from using Boost.Test to using googletest intead. +#include + #include -#include #include "client_types.hpp" namespace http = boost::network::http; -BOOST_AUTO_TEST_CASE_TEMPLATE(http_client_constructor_test, client, - client_types) { - typename client::options options; - client instance; - client instance2( +TYPED_TEST_CASE(HTTPClientTest, ClientTypes); + +TYPED_TEST(HTTPClientTest, Constructors) { + typename TypeParam::options options; + TypeParam instance; + TypeParam instance2( options.io_service(boost::make_shared())); } -BOOST_AUTO_TEST_CASE_TEMPLATE(http_cient_constructor_params_test, client, - client_types) { - typename client::options options; - client instance(options.follow_redirects(true).cache_resolved(true)); - client instance2( +TYPED_TEST(HTTPClientTest, ConstructorsWithOptions) { + typename TypeParam::options options; + TypeParam instance(options.follow_redirects(true).cache_resolved(true)); + TypeParam instance2( options.openssl_certificate("foo").openssl_verify_path("bar")); - client instance3( + TypeParam instance3( options.openssl_certificate_file("foo").openssl_private_key_file("bar")); - client instance4( + TypeParam instance4( options.follow_redirects(true) .io_service(boost::make_shared()) .cache_resolved(true)); diff --git a/libs/network/test/http/client_get_different_port_test.cpp b/libs/network/test/http/client_get_different_port_test.cpp index 69b63969f..488e1c20d 100644 --- a/libs/network/test/http/client_get_different_port_test.cpp +++ b/libs/network/test/http/client_get_different_port_test.cpp @@ -1,23 +1,24 @@ // Copyright 2010 Dean Michael Berris. +// Copyright 2016 Google, Inc. // 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) -#define BOOST_TEST_MODULE HTTP Client Get Different Port Test +#include #include -#include #include "client_types.hpp" namespace net = boost::network; namespace http = boost::network::http; -BOOST_AUTO_TEST_CASE_TEMPLATE(http_get_test_different_port, client, - client_types) { - typename client::request request("http://www.boost.org:80/"); - client client_; - typename client::response response_ = client_.get(request); +TYPED_TEST_CASE(HTTPClientTest, ClientTypes); + +TYPED_TEST(HTTPClientTest, GetDifferentPort) { + TypeParam client; + typename TypeParam::request r("http://www.boost.org:80/"); + auto response_ = client.get(r); auto range = headers(response_)["Content-Type"]; - BOOST_CHECK(boost::begin(range) != boost::end(range)); - BOOST_CHECK(body(response_).size() != 0); + EXPECT_TRUE(boost::begin(range) != boost::end(range)); + EXPECT_NE(0, body(response_).size()); } diff --git a/libs/network/test/http/client_get_streaming_test.cpp b/libs/network/test/http/client_get_streaming_test.cpp index a3ba4cf96..23622ba13 100644 --- a/libs/network/test/http/client_get_streaming_test.cpp +++ b/libs/network/test/http/client_get_streaming_test.cpp @@ -1,11 +1,11 @@ // Copyright 2011 Dean Michael Berris <mikhailberis@gmail.com>. +// Copyright 2016 Google, Inc. // 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) -#define BOOST_TEST_MODULE HTTP 1.1 Get Streaming Test +#include #include -#include #include #include "client_types.hpp" @@ -13,33 +13,34 @@ namespace net = boost::network; namespace http = boost::network::http; struct body_handler { - explicit body_handler(std::string& body) : body(body) {} BOOST_NETWORK_HTTP_BODY_CALLBACK(operator(), range, error) { + (void)error; body.append(boost::begin(range), boost::end(range)); } std::string& body; }; -BOOST_AUTO_TEST_CASE_TEMPLATE(http_client_get_streaming_test, client, - async_only_client_types) { - typename client::request request("http://www.boost.org"); - typename client::response response; - typename client::string_type body_string; - typename client::string_type dummy_body; +TYPED_TEST_CASE(HTTPClientTest, ClientTypes); + +TYPED_TEST(HTTPClientTest, GetStreamingTest) { + typename TypeParam::request request("http://www.boost.org"); + typename TypeParam::response response; + typename TypeParam::string_type body_string; + typename TypeParam::string_type dummy_body; body_handler handler_instance(body_string); { - client client_; - BOOST_CHECK_NO_THROW(response = client_.get(request, handler_instance)); + TypeParam client_; + ASSERT_NO_THROW(response = client_.get(request, handler_instance)); auto range = headers(response)["Content-Type"]; - BOOST_CHECK(!boost::empty(range)); - BOOST_CHECK_EQUAL(body(response).size(), 0u); - BOOST_CHECK_EQUAL(response.version().substr(0, 7), std::string("HTTP/1.")); - BOOST_CHECK_EQUAL(response.status(), 200u); - BOOST_CHECK_EQUAL(response.status_message(), std::string("OK")); + ASSERT_TRUE(!boost::empty(range)); + EXPECT_EQ(0u, body(response).size()); + EXPECT_EQ("HTTP/1.", response.version().substr(0, 7)); + EXPECT_EQ(200u, response.status()); + EXPECT_EQ("OK", response.status_message()); dummy_body = body(response); } - BOOST_CHECK(dummy_body == typename client::string_type()); + EXPECT_EQ(dummy_body, typename TypeParam::string_type()); } diff --git a/libs/network/test/http/client_get_test.cpp b/libs/network/test/http/client_get_test.cpp index dcc24cd04..b5eb5b77b 100644 --- a/libs/network/test/http/client_get_test.cpp +++ b/libs/network/test/http/client_get_test.cpp @@ -3,61 +3,65 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#define BOOST_TEST_MODULE HTTP Get Test +#include #include -#include #include "client_types.hpp" namespace net = boost::network; namespace http = boost::network::http; -BOOST_AUTO_TEST_CASE_TEMPLATE(http_client_get_test, client, client_types) { +TYPED_TEST_CASE(HTTPClientTest, ClientTypes); + +TYPED_TEST(HTTPClientTest, GetTest) { + using client = TypeParam; typename client::request request("http://cpp-netlib.org/"); client client_; typename client::response response; - BOOST_REQUIRE_NO_THROW(response = client_.get(request)); + ASSERT_NO_THROW(response = client_.get(request)); try { auto data = body(response); std::cout << data; } catch (...) { - BOOST_ASSERT(false); + FAIL() << "Caught exception while retrieving body from GET request"; } - BOOST_CHECK_EQUAL(response.version().substr(0, 7), std::string("HTTP/1.")); - BOOST_CHECK(response.status() == 200u || + EXPECT_EQ("HTTP/1.", response.version().substr(0, 7)); + EXPECT_TRUE(response.status() == 200u || (response.status() >= 300 && response.status() < 400)); } #ifdef BOOST_NETWORK_ENABLE_HTTPS -BOOST_AUTO_TEST_CASE_TEMPLATE(https_client_get_test, client, client_types) { +TYPED_TEST(HTTPClientTest, GetHTTPSTest) { + using client = TypeParam; typename client::request request("https://www.github.com/"); client client_; typename client::response response = client_.get(request); - BOOST_CHECK(response.status() == 200 || + EXPECT_TRUE(response.status() == 200 || (response.status() >= 300 && response.status() < 400)); try { auto data = body(response); std::cout << data; } catch (...) { - BOOST_ASSERT(false); + FAIL() << "Caught exception while retrieving body from GET request"; } } #endif -BOOST_AUTO_TEST_CASE_TEMPLATE(http_temp_client_get_test, client, client_types) { +TYPED_TEST(HTTPClientTest, TemporaryClientObjectTest) { + using client = TypeParam; typename client::request request("http://cpp-netlib.org/"); typename client::response response; - BOOST_REQUIRE_NO_THROW(response = client().get(request)); + ASSERT_NO_THROW(response = client().get(request)); auto range = headers(response); - BOOST_CHECK(!boost::empty(range)); + ASSERT_TRUE(!boost::empty(range)); try { auto data = body(response); std::cout << data; } catch (...) { - BOOST_ASSERT(false); + FAIL() << "Caught exception while retrieving body from GET request"; } - BOOST_CHECK_EQUAL(response.version().substr(0, 7), std::string("HTTP/1.")); - BOOST_CHECK(response.status() == 200u || + EXPECT_EQ("HTTP/1.", response.version().substr(0, 7)); + EXPECT_TRUE(response.status() == 200u || (response.status() >= 300 && response.status() < 400)); } diff --git a/libs/network/test/http/client_get_timeout_test.cpp b/libs/network/test/http/client_get_timeout_test.cpp index 4fc4d97c6..5c9e0013d 100644 --- a/libs/network/test/http/client_get_timeout_test.cpp +++ b/libs/network/test/http/client_get_timeout_test.cpp @@ -1,25 +1,26 @@ // Copyright 2010 Dean Michael Berris. +// Copyright 2016 Google, Inc. // 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) -#define BOOST_TEST_MODULE HTTP Client Get Timeout Test +#include #include #include -#include #include "client_types.hpp" #include "http_test_server.hpp" -struct localhost_server_fixture { - localhost_server_fixture() { +class LocalServerEnvironment : public ::testing::Environment { + public: + void SetUp() override { if (!server.start()) { std::cout << "Failed to start HTTP server for test!" << std::endl; std::abort(); } } - ~localhost_server_fixture() { + void TearDown() override { if (!server.stop()) { std::cout << "Failed to stop HTTP server for test!" << std::endl; std::abort(); @@ -29,39 +30,45 @@ struct localhost_server_fixture { http_test_server server; }; -BOOST_GLOBAL_FIXTURE(localhost_server_fixture); +auto* local_env = + ::testing::AddGlobalTestEnvironment(new LocalServerEnvironment); -BOOST_AUTO_TEST_CASE_TEMPLATE(http_get_test_timeout_1_0, client, client_types) { +TYPED_TEST_CASE(HTTPClientTest, ClientTypes); + +TYPED_TEST(HTTPClientTest, GetTimeoutTest) { + using client = TypeParam; typename client::request request("http://localhost:12121/"); typename client::response response_; client client_; boost::uint16_t port_ = port(request); typename client::response::string_type temp; - BOOST_CHECK_EQUAL(12121, port_); - BOOST_CHECK_THROW(response_ = client_.get(request); temp = body(response_); - , std::exception); + EXPECT_EQ(12121, port_); + EXPECT_THROW(response_ = client_.get(request); temp = body(response_); + , std::exception); } -BOOST_AUTO_TEST_CASE_TEMPLATE(http_get_test_timeout_with_options, client, client_types) { +TYPED_TEST(HTTPClientTest, GetTimeoutWithOptionsTest) { + using client = TypeParam; typename client::request request("http://localhost:8000/cgi-bin/sleep.py?3"); typename client::response response; typename client::options options; client client_(options.timeout(1)); typename client::response::string_type temp; - BOOST_CHECK_THROW(response = client_.get(request); temp = body(response); - , std::exception); + EXPECT_THROW(response = client_.get(request); temp = body(response); + , std::exception); } #ifdef BOOST_NETWORK_ENABLE_HTTPS -BOOST_AUTO_TEST_CASE_TEMPLATE(https_get_test_timeout_with_options, client, client_types) { +TYPED_TEST(HTTPClientTest, HTTPSGetTimeoutWithOptionsTest) { + using client = TypeParam; typename client::request request("https://localhost:8000/cgi-bin/sleep.py?3"); typename client::response response; typename client::options options; client client_(options.timeout(1)); typename client::response::string_type temp; - BOOST_CHECK_THROW(response = client_.get(request); temp = body(response); - , std::exception); + EXPECT_THROW(response = client_.get(request); temp = body(response); + , std::exception); } #endif diff --git a/libs/network/test/http/client_include_inlined.cpp b/libs/network/test/http/client_include_inlined.cpp deleted file mode 100644 index 68c929151..000000000 --- a/libs/network/test/http/client_include_inlined.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2011 Dean Michael Berris <mikhailberis@gmail.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) - -#define BOOST_NETWORK_NO_LIB -#include - -int main(int argc, char* argv[]) { - using namespace boost; - using namespace boost::network; - http::client c; - http::client::request req("http://www.boost.org/"); - try { - http::client::response res = c.get(req); - } - catch (...) { - // ignore the error, we just want to make sure - // the interface works inlined. - } - return 0; -} diff --git a/libs/network/test/http/client_localhost_normal_test.cpp b/libs/network/test/http/client_localhost_normal_test.cpp index 29202158c..14ee8079a 100644 --- a/libs/network/test/http/client_localhost_normal_test.cpp +++ b/libs/network/test/http/client_localhost_normal_test.cpp @@ -1,17 +1,15 @@ -// -// Copyright Divye Kapoor 2008. +// Copyright Divye Kapoor 2008. +// Copyright 2016 Google, Inc. // 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) +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) // // Changes by Kim Grasman 2008 -// Changes by Dean Michael Berris 2008, 2010 - -#define BOOST_TEST_MODULE http 1.0 localhost tests +// Changes by Dean Michael Berris 2008, 2010, 2016 +#include #include #include -#include #include #include #include @@ -19,6 +17,7 @@ #include #include +#include "client_types.hpp" #include "http_test_server.hpp" using std::cout; @@ -28,15 +27,14 @@ namespace { const std::string base_url = "http://localhost:8000"; const std::string cgi_url = base_url + "/cgi-bin/requestinfo.py"; -struct running_server_fixture { - // NOTE: Can't use BOOST_REQUIRE_MESSAGE here, as Boost.Test data structures - // are not fully set up when the global fixture runs. - running_server_fixture() { +class RunningServerEnvironment : public ::testing::Environment { + public: + void SetUp() override { if (!server.start()) cout << "Failed to start HTTP server for test!" << endl; } - ~running_server_fixture() { + void TearDown() override { if (!server.stop()) cout << "Failed to stop HTTP server for test!" << endl; } @@ -85,72 +83,75 @@ std::string get_content_length(std::string const& content) { // BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(text_query_preserves_crlf, 2); #endif -BOOST_GLOBAL_FIXTURE(running_server_fixture); +auto *local_env = ::testing::AddGlobalTestEnvironment(new RunningServerEnvironment()); -BOOST_AUTO_TEST_CASE(body_test) { +TYPED_TEST_CASE(HTTPClientTest, ClientTypes); + +TYPED_TEST(HTTPClientTest, BodyTest) { // Tests presence of body in http responses using namespace boost::network; - http::client::request request_(base_url); - http::client client_; - http::client::response response_; - BOOST_REQUIRE_NO_THROW(response_ = client_.get(request_)); - BOOST_CHECK(body(response_).size() != 0); + using client = TypeParam; + typename client::request request_(base_url); + client client_; + typename client::response response_; + ASSERT_NO_THROW(response_ = client_.get(request_)); + EXPECT_NE(0, body(response_).size()); } -BOOST_AUTO_TEST_CASE(text_content_type_test) { +TYPED_TEST(HTTPClientTest, TextContentTypeTest) { // Tests correct parsing of the content-type header sent by the server using namespace boost::network; - http::client::request request_(base_url); - http::client client_; - http::client::response response_; - BOOST_REQUIRE_NO_THROW(response_ = client_.get(request_)); - BOOST_REQUIRE(headers(response_).count("Content-type") != 0); - headers_range::type range = - headers(response_)["Content-type"]; - BOOST_CHECK(boost::begin(range)->first == "Content-type"); - BOOST_CHECK(boost::begin(range)->second == "text/html"); + using client = TypeParam; + typename client::request request_(base_url); + client client_; + typename client::response response_; + ASSERT_NO_THROW(response_ = client_.get(request_)); + ASSERT_NE(0, headers(response_).count("Content-type")); + auto range = headers(response_)["Content-type"]; + EXPECT_EQ("Content-type", boost::begin(range)->first); + EXPECT_EQ("text/html", boost::begin(range)->second); } -BOOST_AUTO_TEST_CASE(binary_content_type_test) { +TYPED_TEST(HTTPClientTest, BinaryContentTypeTest) { // Tests correct parsing of content-type for binary files such as .zip files using namespace boost::network; - http::client::request request_(base_url + "/boost.jpg"); - http::client client_; - http::client::response response_; - BOOST_REQUIRE_NO_THROW(response_ = client_.get(request_)); - BOOST_REQUIRE(headers(response_).count("Content-type") != 0); - headers_range::type range = - headers(response_)["Content-type"]; - BOOST_CHECK(boost::begin(range)->first == "Content-type"); - BOOST_CHECK(boost::begin(range)->second == "image/jpeg"); + using client = TypeParam; + typename client::request request_(base_url + "/boost.jpg"); + client client_; + typename client::response response_; + ASSERT_NO_THROW(response_ = client_.get(request_)); + ASSERT_NE(0, headers(response_).count("Content-type")); + auto range = headers(response_)["Content-type"]; + EXPECT_EQ("Content-type", boost::begin(range)->first); + EXPECT_EQ("image/jpeg", boost::begin(range)->second); } -BOOST_AUTO_TEST_CASE(content_length_header_test) { +TYPED_TEST(HTTPClientTest, ContentLengthHeaderTypest) { // Uses the test.xml file to ensure that the file was received at the correct // length for a text encoding using namespace boost::network; - http::client::request request_(base_url + "/test.xml"); - http::client client_; - http::client::response response_; - BOOST_REQUIRE_NO_THROW(response_ = client_.get(request_)); - BOOST_REQUIRE(headers(response_).count("Content-Length") != 0); - headers_range::type range = - headers(response_)["Content-Length"]; - BOOST_CHECK_EQUAL(boost::begin(range)->first, "Content-Length"); - BOOST_CHECK_EQUAL(boost::begin(range)->second, "113"); - BOOST_CHECK(body(response_).size() != 0); + using client = TypeParam; + typename client::request request_(base_url + "/test.xml"); + client client_; + typename client::response response_; + ASSERT_NO_THROW(response_ = client_.get(request_)); + ASSERT_NE(0, headers(response_).count("Content-Length")); + auto range = headers(response_)["Content-Length"]; + EXPECT_EQ("Content-Length", boost::begin(range)->first); + EXPECT_EQ("113", boost::begin(range)->second); + EXPECT_NE(0, body(response_).size()); } -BOOST_AUTO_TEST_CASE(text_query_preserves_crlf) { +TYPED_TEST(HTTPClientTest, TextQueryPreservesCRLFTest) { // Tests proper transfer of a text file using namespace boost::network; - http::client::request request_(base_url + "/test.xml"); - http::client client_; - http::client::response response_; - BOOST_REQUIRE_NO_THROW(response_ = client_.get(request_)); - + using client = TypeParam; + typename client::request request_(base_url + "/test.xml"); + client client_; + typename client::response response_; + ASSERT_NO_THROW(response_ = client_.get(request_)); http::client::response::string_type body_ = body(response_); - BOOST_CHECK(body(response_).size() != 0); + ASSERT_NE(0, body(response_).size()); using std::ios; @@ -161,34 +162,34 @@ BOOST_AUTO_TEST_CASE(text_query_preserves_crlf) { file.open("server/test.xml", ios::in | ios::binary); } - BOOST_REQUIRE_MESSAGE(file, "Could not open local test.xml"); + ASSERT_TRUE(file) << "Could not open local test.xml"; std::vector memblock; std::size_t size = readfile(file, memblock); - BOOST_CHECK(size != 0); - BOOST_CHECK_EQUAL(body_.size(), size); + EXPECT_NE(0, size); + EXPECT_EQ(size, body_.size()); if (body(response_).size() == size) { - std::pair::iterator, std::string::const_iterator> - diff_pos = - std::mismatch(memblock.begin(), memblock.end(), body_.begin()); - BOOST_CHECK_EQUAL( + auto diff_pos = + std::mismatch(memblock.begin(), memblock.end(), body_.begin()); + EXPECT_EQ( boost::numeric_cast(diff_pos.first - memblock.begin()), size); } } -BOOST_AUTO_TEST_CASE(binary_file_query) { +TYPED_TEST(HTTPClientTest, BinaryFileQueryTest) { // Tests proper transfer of a binary image using namespace boost::network; - http::client::request request_(base_url + "/boost.jpg"); - http::client client_; - http::client::response response_; + using client = TypeParam; + typename client::request request_(base_url + "/boost.jpg"); + client client_; + typename client::response response_; BOOST_REQUIRE_NO_THROW(response_ = client_.get(request_)); http::client::response::string_type body_ = body(response_); - BOOST_CHECK(body_.size() != 0); + EXPECT_NE(0, body_.size()); using std::ios; @@ -199,168 +200,169 @@ BOOST_AUTO_TEST_CASE(binary_file_query) { file.open("server/boost.jpg", ios::in | ios::binary); } - BOOST_REQUIRE_MESSAGE(file, "Could not open boost.jpg locally"); + ASSERT_TRUE(file) << "Could not open boost.jpg locally"; std::vector memblock; std::size_t size = readfile(file, memblock); - BOOST_CHECK(size != 0); - BOOST_CHECK_EQUAL(body_.size(), size); + EXPECT_NE(0, size); + EXPECT_EQ(size, body_.size()); - std::pair::iterator, std::string::const_iterator> diff_pos = + auto diff_pos = std::mismatch(memblock.begin(), memblock.end(), body_.begin()); - BOOST_CHECK_EQUAL( - boost::numeric_cast(diff_pos.first - memblock.begin()), - size); + EXPECT_EQ(boost::numeric_cast(diff_pos.first - memblock.begin()), + size); } -BOOST_AUTO_TEST_CASE(cgi_query) { +TYPED_TEST(HTTPClientTest, CGIQueryTest) { // Get a dynamic request with no Content-Length header // Ensure that we have a body using namespace boost::network; - - http::client::request req(cgi_url + "?query=1"); - http::client c; - http::client::response r; - BOOST_REQUIRE_NO_THROW(r = c.get(req)); - BOOST_CHECK(body(r).size() != 0); - BOOST_CHECK(boost::empty(headers(r)["Content-Length"])); + using client = TypeParam; + + typename client::request req(cgi_url + "?query=1"); + client c; + typename client::response r; + ASSERT_NO_THROW(r = c.get(req)); + EXPECT_NE(0, body(r).size()); + EXPECT_TRUE(boost::empty(headers(r)["Content-Length"])); } -BOOST_AUTO_TEST_CASE(cgi_multi_line_headers) { +TYPED_TEST(HTTPClientTest, CGIMultiLineHeaderTest) { using namespace boost::network; - - http::client::request req(base_url + "/cgi-bin/multiline-header.py?query=1"); - http::client c; - http::client::response r; - BOOST_REQUIRE_NO_THROW(r = c.get(req)); - BOOST_CHECK(body(r).size() != 0); - BOOST_CHECK(boost::empty(headers(r)["Content-Type"])); - headers_range::type range = - headers(r)["X-CppNetlib-Test"]; - BOOST_REQUIRE(boost::begin(range) != boost::end(range)); - BOOST_REQUIRE(distance(range) == 2); - BOOST_CHECK_EQUAL(boost::begin(range)->second, - std::string("multi-line-header")); - BOOST_CHECK_EQUAL((++boost::begin(range))->second, - std::string("that-should-concatenate")); + using client = TypeParam; + + typename client::request req(base_url + "/cgi-bin/multiline-header.py?query=1"); + client c; + typename client::response r; + ASSERT_NO_THROW(r = c.get(req)); + EXPECT_NE(0, body(r).size()); + EXPECT_TRUE(boost::empty(headers(r)["Content-Type"])); + auto range = headers(r)["X-CppNetlib-Test"]; + ASSERT_TRUE(boost::begin(range) != boost::end(range)); + ASSERT_EQ(2, distance(range)); + EXPECT_EQ("multi-line-header", boost::begin(range)->second); + EXPECT_EQ("that-should-concatenate", (++boost::begin(range))->second); } -BOOST_AUTO_TEST_CASE(file_not_found) { +TYPED_TEST(HTTPClientTest, FileNotFoundTest) { // Request for a non existing file. // Ensure that we have a body even in the presence of an error response using namespace boost::network; + using client = TypeParam; - http::client::request req(base_url + "/file_not_found"); - http::client c; - http::client::response r = c.get(req); + typename client::request req(base_url + "/file_not_found"); + client c; + typename client::response r = c.get(req); - BOOST_CHECK(body(r).size() != 0); + EXPECT_NE(0, body(r).size()); } -BOOST_AUTO_TEST_CASE(head_test) { +TYPED_TEST(HTTPClientTest, HeadTest) { using namespace boost::network; - http::client::request request_(base_url + "/test.xml"); - http::client client_; - http::client::response response_; - BOOST_REQUIRE_NO_THROW(response_ = client_.head(request_)); - BOOST_REQUIRE(headers(response_).count("Content-Length") != 0); - headers_range::type range = - headers(response_)["Content-Length"]; - BOOST_CHECK_EQUAL(boost::begin(range)->first, "Content-Length"); - BOOST_CHECK_EQUAL(boost::begin(range)->second, "113"); - BOOST_CHECK(body(response_).size() == 0); + using client = TypeParam; + typename client::request request_(base_url + "/test.xml"); + client client_; + typename client::response response_; + ASSERT_NO_THROW(response_ = client_.head(request_)); + ASSERT_NE(0, headers(response_).count("Content-Length")); + auto range = headers(response_)["Content-Length"]; + EXPECT_EQ("Content-Length", boost::begin(range)->first); + EXPECT_EQ("113", boost::begin(range)->second); + EXPECT_EQ(0, body(response_).size()); } -BOOST_AUTO_TEST_CASE(post_with_explicit_headers) { +TYPED_TEST(HTTPClientTest, PostWithExplicitHeadersTest) { // This test checks that the headers echoed through echo_headers.py // are in fact the same as what are sent through the POST request using namespace boost::network; + using client = TypeParam; const std::string postdata = "empty"; const std::string content_length = get_content_length(postdata); const std::string content_type = "application/x-www-form-urlencoded"; - http::client::request req(base_url + "/cgi-bin/echo_headers.py"); + typename client::request req(base_url + "/cgi-bin/echo_headers.py"); req << header("Content-Length", content_length); req << header("Content-Type", content_type); req << body(postdata); - http::client c; - http::client::response r; - BOOST_REQUIRE_NO_THROW(r = c.post(req)); + client c; + typename client::response r; + ASSERT_NO_THROW(r = c.post(req)); std::map headers = parse_headers(body(r)); - BOOST_CHECK_EQUAL(headers["content-length"], content_length); - BOOST_CHECK_EQUAL(headers["content-type"], content_type); + EXPECT_EQ(content_length, headers["content-length"]); + EXPECT_EQ(content_type, headers["content-type"]); } -BOOST_AUTO_TEST_CASE(post_with_implicit_headers) { +TYPED_TEST(HTTPClientTest, PostWithImplicitHeadersTest) { // This test checks that post(request, body) derives Content-Length // and Content-Type using namespace boost::network; + using client = TypeParam; const std::string postdata = "empty"; - http::client::request req(base_url + "/cgi-bin/echo_headers.py"); - - http::client c; - http::client::response r; - BOOST_REQUIRE_NO_THROW(r = c.post(req, postdata)); + typename client::request req(base_url + "/cgi-bin/echo_headers.py"); + client c; + typename client::response r; + ASSERT_NO_THROW(r = c.post(req, postdata)); std::map headers = parse_headers(body(r)); - BOOST_CHECK_EQUAL(headers["content-length"], get_content_length(postdata)); - BOOST_CHECK_EQUAL(headers["content-type"], "x-application/octet-stream"); + EXPECT_EQ(get_content_length(postdata), headers["content-length"]); + EXPECT_EQ("x-application/octet-stream", headers["content-type"]); } -BOOST_AUTO_TEST_CASE(post_with_explicit_content_type) { +TYPED_TEST(HTTPClientTest, PostWithExplicitContentTypeTest) { // This test checks that post(request, content_type, body) derives // Content-Length, // and keeps Content-Type using namespace boost::network; + using client = TypeParam; const std::string postdata = "empty"; const std::string content_type = "application/x-my-content-type"; - http::client::request req(base_url + "/cgi-bin/echo_headers.py"); - - http::client c; - http::client::response r; - BOOST_REQUIRE_NO_THROW(r = c.post(req, content_type, postdata)); + typename client::request req(base_url + "/cgi-bin/echo_headers.py"); + client c; + typename client::response r; + ASSERT_NO_THROW(r = c.post(req, content_type, postdata)); std::map headers = parse_headers(body(r)); - BOOST_CHECK_EQUAL(headers["content-length"], get_content_length(postdata)); - BOOST_CHECK_EQUAL(headers["content-type"], content_type); + EXPECT_EQ(get_content_length(postdata),headers["content-length"]); + EXPECT_EQ(content_type, headers["content-type"]); } -BOOST_AUTO_TEST_CASE(post_body_default_content_type) { +TYPED_TEST(HTTPClientTest, PostBodyDefaultContentType) { // This test checks that post(request, body) gets the post data // through to the server using namespace boost::network; + using client = TypeParam; const std::string postdata = "firstname=bill&lastname=badger"; - http::client::request req(base_url + "/cgi-bin/echo_body.py"); - - http::client c; - http::client::response r; - BOOST_REQUIRE_NO_THROW(r = c.post(req, postdata)); + typename client::request req(base_url + "/cgi-bin/echo_body.py"); + client c; + typename client::response r; + ASSERT_NO_THROW(r = c.post(req, postdata)); http::client::response::string_type body_ = body(r); - BOOST_CHECK_EQUAL(postdata, body_); + EXPECT_EQ(postdata, body_); } -BOOST_AUTO_TEST_CASE(post_with_custom_headers) { +TYPED_TEST(HTTPClientTest, PostWithCustomHeadersTest) { // This test checks that custom headers pass through to the server // when posting using namespace boost::network; + using client = TypeParam; - http::client::request req(base_url + "/cgi-bin/echo_headers.py"); + typename client::request req(base_url + "/cgi-bin/echo_headers.py"); req << header("X-Cpp-Netlib", "rocks!"); - http::client c; - http::client::response r; - BOOST_REQUIRE_NO_THROW(r = c.post(req, std::string())); + client c; + typename client::response r; + ASSERT_NO_THROW(r = c.post(req, std::string())); std::map headers = parse_headers(body(r)); - BOOST_CHECK_EQUAL(headers["x-cpp-netlib"], "rocks!"); + EXPECT_EQ("rocks!", headers["x-cpp-netlib"]); } diff --git a/libs/network/test/http/client_localhost_ssl_test.cpp b/libs/network/test/http/client_localhost_ssl_test.cpp index a28e56453..c473af8e5 100644 --- a/libs/network/test/http/client_localhost_ssl_test.cpp +++ b/libs/network/test/http/client_localhost_ssl_test.cpp @@ -1,17 +1,16 @@ -// -// Copyright Divye Kapoor 2008. + +// Copyright Divye Kapoor 2008. +// Copyright 2016 Google, Inc. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// https://www.boost.org/LICENSE_1_0.txt) +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) // // Changes by Kim Grasman 2008 -// Changes by Dean Michael Berris 2008, 2009 - -#define BOOST_TEST_MODULE https 1.0 localhost tests +// Changes by Dean Michael Berris 2008, 2009, 2016 +#include #include #include -#include #include #include #include @@ -20,6 +19,7 @@ #define HTTPS_SERVER_TEST #include "http_test_server.hpp" +#include "client_types.hpp" using std::cout; using std::endl; @@ -28,15 +28,14 @@ namespace { const std::string base_url = "https://localhost:8443"; const std::string cgi_url = base_url + "/cgi-bin/requestinfo.py"; -struct running_server_fixture { - // NOTE: Can't use BOOST_REQUIRE_MESSAGE here, as Boost.Test data structures - // are not fully set up when the global fixture runs. - running_server_fixture() { +class RunningServerEnvironment : public ::testing::Environment { + public: + void SetUp() override { if (!server.start()) cout << "Failed to start HTTP server for test!" << endl; } - ~running_server_fixture() { + void TearDown() override { if (!server.stop()) cout << "Failed to stop HTTP server for test!" << endl; } @@ -61,67 +60,71 @@ std::size_t readfile(std::ifstream& file, std::vector& buffer) { // BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(text_query_preserves_crlf, 2); #endif -BOOST_GLOBAL_FIXTURE(running_server_fixture); +auto *local_env = ::testing::AddGlobalTestEnvironment(new RunningServerEnvironment()); -BOOST_AUTO_TEST_CASE(body_test) { +TYPED_TEST_CASE(HTTPClientTest, ClientTypes); + +TYPED_TEST(HTTPClientTest, BodyTest) { // Tests presence of body in http responses using namespace boost::network; - http::client::request request_(base_url); - http::client client_; - http::client::response response_ = client_.get(request_); - BOOST_CHECK(body(response_).size() != 0); + using client = TypeParam; + typename client::request request_(base_url); + client client_; + typename client::response response_ = client_.get(request_); + EXPECT_NE(0, body(response_).size()); } -BOOST_AUTO_TEST_CASE(text_content_type_test) { +TYPED_TEST(HTTPClientTest, TextContentTypeTest) { // Tests correct parsing of the content-type header sent by the server using namespace boost::network; - http::client::request request_(base_url); - http::client client_; - http::client::response response_ = client_.get(request_); - BOOST_REQUIRE(headers(response_).count("Content-type") != 0); - headers_range::type range = - headers(response_)["Content-type"]; - BOOST_CHECK(boost::begin(range)->first == "Content-type"); - BOOST_CHECK(boost::begin(range)->second == "text/html"); + using client = TypeParam; + typename client::request request_(base_url); + client client_; + typename client::response response_ = client_.get(request_); + ASSERT_NE(0, headers(response_).count("Content-type")); + auto range = headers(response_)["Content-type"]; + EXPECT_EQ("Content-type", boost::begin(range)->first); + EXPECT_EQ("text/html", boost::begin(range)->second); } -BOOST_AUTO_TEST_CASE(binary_content_type_test) { +TYPED_TEST(HTTPClientTest, BinaryContentTypeTest) { // Tests correct parsing of content-type for binary files such as .zip files using namespace boost::network; - http::client::request request_(base_url + "/boost.jpg"); - http::client client_; - http::client::response response_ = client_.get(request_); + using client = TypeParam; + typename client::request request_(base_url + "/boost.jpg"); + client client_; + typename client::response response_ = client_.get(request_); BOOST_REQUIRE(headers(response_).count("Content-type") != 0); - headers_range::type range = - headers(response_)["Content-type"]; - BOOST_CHECK(boost::begin(range)->first == "Content-type"); - BOOST_CHECK(boost::begin(range)->second == "image/jpeg"); + auto range = headers(response_)["Content-type"]; + EXPECT_EQ("Content-type", boost::begin(range)->first); + EXPECT_EQ("image/jpeg", boost::begin(range)->second); } -BOOST_AUTO_TEST_CASE(content_length_header_test) { +TYPED_TEST(HTTPClientTest, ContentLengthHeaderTest) { // Uses the test.xml file to ensure that the file was received at the correct // length for a text encoding using namespace boost::network; - http::client::request request_(base_url + "/test.xml"); - http::client client_; - http::client::response response_ = client_.get(request_); + using client = TypeParam; + typename client::request request_(base_url + "/test.xml"); + client client_; + typename client::response response_ = client_.get(request_); BOOST_REQUIRE(headers(response_).count("Content-Length") != 0); - headers_range::type range = - headers(response_)["Content-Length"]; - BOOST_CHECK_EQUAL(boost::begin(range)->first, "Content-Length"); - BOOST_CHECK_EQUAL(boost::begin(range)->second, "113"); - BOOST_CHECK(body(response_).size() != 0); + auto range = headers(response_)["Content-Length"]; + EXPECT_EQ("Content-Length", boost::begin(range)->first); + EXPECT_EQ("113", boost::begin(range)->second); + EXPECT_NE(0, body(response_).size()); } -BOOST_AUTO_TEST_CASE(text_query_preserves_crlf) { +TYPED_TEST(HTTPClientTest, TextQueryPreservesCRLFTest) { // Tests proper transfer of a text file using namespace boost::network; - http::client::request request_(base_url + "/test.xml"); - http::client client_; - http::client::response response_ = client_.get(request_); + using client = TypeParam; + typename client::request request_(base_url + "/test.xml"); + client client_; + typename client::response response_ = client_.get(request_); http::client::response::string_type body_ = body(response_); - BOOST_CHECK(body_.size() != 0); + EXPECT_NE(0, body_.size()); using std::ios; @@ -132,34 +135,33 @@ BOOST_AUTO_TEST_CASE(text_query_preserves_crlf) { file.open("server/test.xml", ios::in | ios::binary); } - BOOST_REQUIRE_MESSAGE(file, "Could not open local test.xml"); + ASSERT_TRUE(file) << "Could not open local test.xml"; std::vector memblock; std::size_t size = readfile(file, memblock); - BOOST_CHECK(size != 0); - BOOST_CHECK_EQUAL(body(response_).size(), size); + EXPECT_NE(0, size); + EXPECT_EQ(size, body(response_).size()); if (body(response_).size() == size) { - std::pair::iterator, std::string::const_iterator> - diff_pos = - std::mismatch(memblock.begin(), memblock.end(), body_.begin()); - BOOST_CHECK_EQUAL( + auto diff_pos = + std::mismatch(memblock.begin(), memblock.end(), body_.begin()); + EXPECT_EQ( boost::numeric_cast(diff_pos.first - memblock.begin()), size); } } -BOOST_AUTO_TEST_CASE(binary_file_query) { +TYPED_TEST(HTTPClientTest, BinaryFileQueryTest) { // Tests proper transfer of a binary image using namespace boost::network; - http::client::request request_(base_url + "/boost.jpg"); - http::client client_; - http::client::response response_; - BOOST_CHECK_NO_THROW(response_ = client_.get(request_)); - - http::client::response::string_type body_ = body(response_); - BOOST_CHECK(body_.size() != 0); + using client = TypeParam; + typename client::request request_(base_url + "/boost.jpg"); + client client_; + typename client::response response_; + ASSERT_NO_THROW(response_ = client_.get(request_)); + typename client::response::string_type body_ = body(response_); + EXPECT_NE(0, body_.size()); using std::ios; @@ -170,172 +172,42 @@ BOOST_AUTO_TEST_CASE(binary_file_query) { file.open("server/boost.jpg", ios::in | ios::binary); } - BOOST_REQUIRE_MESSAGE(file, "Could not open boost.jpg locally"); + ASSERT_TRUE(file) << "Could not open boost.jpg locally"; std::vector memblock; std::size_t size = readfile(file, memblock); - BOOST_CHECK(size != 0); - BOOST_CHECK_EQUAL(body(response_).size(), size); + ASSERT_NE(0, size); + EXPECT_EQ(size, body(response_).size()); - std::pair::iterator, std::string::const_iterator> diff_pos = + auto diff_pos = std::mismatch(memblock.begin(), memblock.end(), body_.begin()); - BOOST_CHECK_EQUAL( - boost::numeric_cast(diff_pos.first - memblock.begin()), - size); + EXPECT_EQ(boost::numeric_cast(diff_pos.first - memblock.begin()), + size); } -// BOOST_AUTO_TEST_CASE(cgi_query) { -// // Get a dynamic request with no Content-Length header -// // Ensure that we have a body -// using namespace boost::network; -// -// http::client::request req(cgi_url + "?query=1"); -// http::client c; -// http::client::response r; -// BOOST_REQUIRE_NO_THROW(r = c.get(req)); -// BOOST_CHECK(body(r).size() != 0); -// BOOST_CHECK(headers(r)["Content-Type"].begin() != -// headers(r)["Content-Type"].end()); -//} -// -// BOOST_AUTO_TEST_CASE(cgi_multi_line_headers) { -// using namespace boost::network; -// -// http::client::request req(base_url + -// "/cgi-bin/multiline-header.py?query=1"); -// http::client c; -// http::client::response r; -// BOOST_REQUIRE_NO_THROW(r = c.get(req)); -// BOOST_CHECK(body(r).size() != 0); -// BOOST_CHECK(headers(r)["Content-Type"].begin() != -// headers(r)["Content-Type"].end()); -// headers_range::type -// range=headers(r)["X-CppNetlib-Test"]; -// BOOST_REQUIRE(boost::begin(range) != boost::end(range)); -// BOOST_REQUIRE(distance(range) == 2); -// BOOST_CHECK_EQUAL(boost::begin(range)->second, -// std::string("multi-line-header")); -// BOOST_CHECK_EQUAL((++boost::begin(range))->second, -// std::string("that-should-concatenate")); -//} - -BOOST_AUTO_TEST_CASE(file_not_found) { +TYPED_TEST(HTTPClientTest, FileNotFoundTest) { // Request for a non existing file. // Ensure that we have a body even in the presence of an error response using namespace boost::network; + using client = TypeParam; - http::client::request req(base_url + "/file_not_found"); - http::client c; - http::client::response r = c.get(req); + typename client::request req(base_url + "/file_not_found"); + client c; + typename client::response r = c.get(req); - BOOST_CHECK(body(r).size() != 0); + EXPECT_NE(0, body(r).size()); } -BOOST_AUTO_TEST_CASE(head_test) { +TYPED_TEST(HTTPClientTest, HeadTest) { using namespace boost::network; - http::client::request request_(base_url + "/test.xml"); - http::client client_; - http::client::response response_ = client_.head(request_); - BOOST_REQUIRE(headers(response_).count("Content-Length") != 0); - headers_range::type range = - headers(response_)["Content-Length"]; - BOOST_CHECK_EQUAL(boost::begin(range)->first, "Content-Length"); - BOOST_CHECK_EQUAL(boost::begin(range)->second, "113"); - BOOST_CHECK(body(response_).size() == 0); + using client = TypeParam; + typename client::request request_(base_url + "/test.xml"); + client client_; + typename client::response response_ = client_.head(request_); + ASSERT_NE(0, headers(response_).count("Content-Length")); + auto range = headers(response_)["Content-Length"]; + EXPECT_EQ("Content-Length", boost::begin(range)->first); + EXPECT_EQ("113", boost::begin(range)->second); + EXPECT_EQ(0, body(response_).size()); } - -// BOOST_AUTO_TEST_CASE(post_with_explicit_headers) { -// // This test checks that the headers echoed through echo_headers.py -// // are in fact the same as what are sent through the POST request -// using namespace boost::network; -// -// const std::string postdata = "empty"; -// const std::string content_length = get_content_length(postdata); -// const std::string content_type = "application/x-www-form-urlencoded"; -// -// http::client::request req(base_url + "/cgi-bin/echo_headers.py"); -// req << header("Content-Length", content_length); -// req << header("Content-Type", content_type); -// req << body(postdata); -// -// http::client c; -// http::client::response r; -// BOOST_REQUIRE_NO_THROW(r = c.post(req)); -// -// std::map headers = parse_headers(body(r)); -// BOOST_CHECK_EQUAL(headers["content-length"], content_length); -// BOOST_CHECK_EQUAL(headers["content-type"], content_type); -//} -// -// BOOST_AUTO_TEST_CASE(post_with_implicit_headers) { -// // This test checks that post(request, body) derives Content-Length -// // and Content-Type -// using namespace boost::network; -// -// const std::string postdata = "empty"; -// -// http::client::request req(base_url + "/cgi-bin/echo_headers.py"); -// -// http::client c; -// http::client::response r; -// BOOST_REQUIRE_NO_THROW(r = c.post(req, postdata)); -// -// std::map headers = parse_headers(body(r)); -// BOOST_CHECK_EQUAL(headers["content-length"], -// get_content_length(postdata)); -// BOOST_CHECK_EQUAL(headers["content-type"], "x-application/octet-stream"); -//} -// -// BOOST_AUTO_TEST_CASE(post_with_explicit_content_type) { -// // This test checks that post(request, content_type, body) derives -// Content-Length, -// // and keeps Content-Type -// using namespace boost::network; -// -// const std::string postdata = "empty"; -// const std::string content_type = "application/x-my-content-type"; -// -// http::client::request req(base_url + "/cgi-bin/echo_headers.py"); -// -// http::client c; -// http::client::response r; -// BOOST_REQUIRE_NO_THROW(r = c.post(req, content_type, postdata)); -// -// std::map headers = parse_headers(body(r)); -// BOOST_CHECK_EQUAL(headers["content-length"], -// get_content_length(postdata)); -// BOOST_CHECK_EQUAL(headers["content-type"], content_type); -//} -// -// BOOST_AUTO_TEST_CASE(post_body_default_content_type) { -// // This test checks that post(request, body) gets the post data -// // through to the server -// using namespace boost::network; -// -// const std::string postdata = "firstname=bill&lastname=badger"; -// -// http::client::request req(base_url + "/cgi-bin/echo_body.py"); -// -// http::client c; -// http::client::response r; -// BOOST_REQUIRE_NO_THROW(r = c.post(req, postdata)); -// -// BOOST_CHECK_EQUAL(postdata, body(r)); -//} -// -// BOOST_AUTO_TEST_CASE(post_with_custom_headers) { -// // This test checks that custom headers pass through to the server -// // when posting -// using namespace boost::network; -// -// http::client::request req(base_url + "/cgi-bin/echo_headers.py"); -// req << header("X-Cpp-Netlib", "rocks!"); -// -// http::client c; -// http::client::response r; -// BOOST_REQUIRE_NO_THROW(r = c.post(req, std::string())); -// -// std::map headers = parse_headers(body(r)); -// BOOST_CHECK_EQUAL(headers["x-cpp-netlib"], "rocks!"); -//} diff --git a/libs/network/test/http/client_types.hpp b/libs/network/test/http/client_types.hpp index e9e253a27..aa7b1b4fa 100644 --- a/libs/network/test/http/client_types.hpp +++ b/libs/network/test/http/client_types.hpp @@ -7,37 +7,38 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include -#include -#include -#include -#include -#include -#include +#include +#include #include "tag_types.hpp" - -namespace mpl = boost::mpl; - -template -struct client_adapter { - template - struct apply { - typedef boost::network::http::basic_client type; - }; +#include + +// HTTPClientTest is a re-usable fixture for client tests that need to test +// various variations of the client. This is to be used with googletest's +// type-parameteric tests: +// +// using ClientTypes = ::testing::Types< +// std::tuple, std::tuple>; +// INSTANTIATE_TYPED_TEST_CASE_P(MyTest, HTTPClientTest, ClientTypes) +// +// We also already provide ClientTypes as a convenience in this header for all +// known and supported client type implementations in the library. +// +// T must be a tuple in the form: . +template +class HTTPClientTest : public ::testing::Test { + public: + using ClientType = T; }; -typedef mpl::transform >::type client_1_0; - -typedef mpl::transform >::type client_1_1; - -typedef mpl::joint_view::type client_types; - -typedef mpl::joint_view< - mpl::transform >::type, - client_adapter<1, 0> >::type, - mpl::transform >::type, - client_adapter<1, 1> >::type>::type async_only_client_types; +// This is the list of known ClientTypes for testing. +using ClientTypes = ::testing::Types< + boost::network::http::basic_client< + boost::network::http::tags::http_default_8bit_tcp_resolve, 1, 0>, + boost::network::http::basic_client< + boost::network::http::tags::http_default_8bit_tcp_resolve, 1, 1>, + boost::network::http::basic_client< + boost::network::http::tags::http_default_8bit_udp_resolve, 1, 0>, + boost::network::http::basic_client< + boost::network::http::tags::http_default_8bit_udp_resolve, 1, 1>>; #endif /* CLIENT_TYPES_ROOWQCLE */ diff --git a/libs/network/test/http/message_async_ready_test.cpp b/libs/network/test/http/message_async_ready_test.cpp index 0ffda0aba..f2b2d9534 100644 --- a/libs/network/test/http/message_async_ready_test.cpp +++ b/libs/network/test/http/message_async_ready_test.cpp @@ -1,18 +1,23 @@ // Copyright 2010 Dean Michael Berris. +// Copyright 2016 Google, Inc. // 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) -#define BOOST_TEST_MODULE HTTP Async Response Test -#include +#include #include +#include "tag_types.hpp" namespace http = boost::network::http; -BOOST_AUTO_TEST_CASE(unready_state_response) { - typedef http::basic_response - response; +template +class MessageTest : public ::testing::Test {}; + +TYPED_TEST_CASE(MessageTest, TagTypes); + +TYPED_TEST(MessageTest, UnreadyStateResponseTest) { + using response = http::basic_response; response r; - BOOST_CHECK(!ready(r)); + EXPECT_FALSE(ready(r)); } diff --git a/libs/network/test/http/request_incremental_parser_test.cpp b/libs/network/test/http/request_incremental_parser_test.cpp index 37c860c05..da52f6c33 100644 --- a/libs/network/test/http/request_incremental_parser_test.cpp +++ b/libs/network/test/http/request_incremental_parser_test.cpp @@ -1,11 +1,11 @@ // Copyright 2010 Dean Michael Berris. +// Copyright 2016 Google, Inc. // 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) -#define BOOST_TEST_MODULE HTTP Incremental Request Parser Test +#include #include -#include #include #include #include @@ -29,11 +29,11 @@ namespace logic = boost::logic; namespace fusion = boost::fusion; using namespace boost::network::http; -BOOST_AUTO_TEST_CASE(incremental_parser_constructor) { +TEST(IncrementalRequestParserTest, Constructor) { request_parser p; // default constructible } -BOOST_AUTO_TEST_CASE(incremental_parser_parse_http_method) { +TEST(IncrementalRequestParserTest, ParseMethod) { request_parser p; logic::tribool parsed_ok = false; typedef request_parser request_parser_type; @@ -43,8 +43,8 @@ BOOST_AUTO_TEST_CASE(incremental_parser_parse_http_method) { std::string valid_http_method = "GET "; fusion::tie(parsed_ok, result_range) = p.parse_until(request_parser_type::method_done, valid_http_method); - BOOST_CHECK_EQUAL(parsed_ok, true); - BOOST_CHECK(!boost::empty(result_range)); + EXPECT_TRUE(parsed_ok); + EXPECT_FALSE(boost::empty(result_range)); std::string parsed(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed << " [state:" << p.state() << "] " << std::endl; @@ -53,13 +53,13 @@ BOOST_AUTO_TEST_CASE(incremental_parser_parse_http_method) { p.reset(); fusion::tie(parsed_ok, result_range) = p.parse_until(request_parser_type::method_done, invalid_http_method); - BOOST_CHECK_EQUAL(parsed_ok, false); + EXPECT_EQ(false, parsed_ok); parsed.assign(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed << " [state:" << p.state() << "] " << std::endl; } -BOOST_AUTO_TEST_CASE(incremental_parser_parse_http_uri) { +TEST(IncrementalRequestParserTest, ParseURI) { request_parser p; logic::tribool parsed_ok = false; typedef request_parser request_parser_type; @@ -69,8 +69,8 @@ BOOST_AUTO_TEST_CASE(incremental_parser_parse_http_uri) { std::string valid_http_request = "GET / HTTP/1.1\r\n"; fusion::tie(parsed_ok, result_range) = p.parse_until(request_parser_type::uri_done, valid_http_request); - BOOST_CHECK_EQUAL(parsed_ok, true); - BOOST_CHECK(!boost::empty(result_range)); + EXPECT_EQ(true, parsed_ok); + EXPECT_FALSE(boost::empty(result_range)); std::string parsed(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed << " [state:" << p.state() << "] " << std::endl; @@ -79,13 +79,13 @@ BOOST_AUTO_TEST_CASE(incremental_parser_parse_http_uri) { p.reset(); fusion::tie(parsed_ok, result_range) = p.parse_until(request_parser_type::uri_done, invalid_http_request); - BOOST_CHECK_EQUAL(parsed_ok, false); + EXPECT_EQ(false, parsed_ok); parsed.assign(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed << " [state:" << p.state() << "] " << std::endl; } -BOOST_AUTO_TEST_CASE(incremental_parser_parse_http_version) { +TEST(IncrementalRequestParserTest, ParseHTTPVersion) { request_parser p; logic::tribool parsed_ok = false; typedef request_parser request_parser_type; @@ -95,8 +95,8 @@ BOOST_AUTO_TEST_CASE(incremental_parser_parse_http_version) { std::string valid_http_request = "GET / HTTP/1.1\r\n"; fusion::tie(parsed_ok, result_range) = p.parse_until(request_parser_type::version_done, valid_http_request); - BOOST_CHECK_EQUAL(parsed_ok, true); - BOOST_CHECK(!boost::empty(result_range)); + EXPECT_EQ(true, parsed_ok); + EXPECT_FALSE(boost::empty(result_range)); std::string parsed(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed << " [state:" << p.state() << "] " << std::endl; @@ -105,13 +105,13 @@ BOOST_AUTO_TEST_CASE(incremental_parser_parse_http_version) { p.reset(); fusion::tie(parsed_ok, result_range) = p.parse_until(request_parser_type::version_done, invalid_http_request); - BOOST_CHECK_EQUAL(parsed_ok, false); + EXPECT_EQ(false, parsed_ok); parsed.assign(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed << " [state:" << p.state() << "] " << std::endl; } -BOOST_AUTO_TEST_CASE(incremental_parser_parse_http_headers) { +TEST(IncrementalRequestParserTest, ParseHTTPHeaders) { request_parser p; logic::tribool parsed_ok = false; typedef request_parser request_parser_type; @@ -122,8 +122,8 @@ BOOST_AUTO_TEST_CASE(incremental_parser_parse_http_headers) { "GET / HTTP/1.1\r\nHost: cpp-netlib.org\r\n\r\n"; fusion::tie(parsed_ok, result_range) = p.parse_until(request_parser_type::headers_done, valid_http_request); - BOOST_CHECK_EQUAL(parsed_ok, true); - BOOST_CHECK(!boost::empty(result_range)); + EXPECT_EQ(true, parsed_ok); + EXPECT_FALSE(boost::empty(result_range)); std::string parsed(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed << " [state:" << p.state() << "] " << std::endl; @@ -133,8 +133,8 @@ BOOST_AUTO_TEST_CASE(incremental_parser_parse_http_headers) { p.reset(); fusion::tie(parsed_ok, result_range) = p.parse_until(request_parser_type::headers_done, valid_http_request); - BOOST_CHECK_EQUAL(parsed_ok, true); - BOOST_CHECK(!boost::empty(result_range)); + EXPECT_EQ(true, parsed_ok); + EXPECT_FALSE(boost::empty(result_range)); parsed.assign(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed << " [state:" << p.state() << "] " << std::endl; diff --git a/libs/network/test/http/request_linearize_test.cpp b/libs/network/test/http/request_linearize_test.cpp index f29e1ee0b..8c2cdb3ab 100644 --- a/libs/network/test/http/request_linearize_test.cpp +++ b/libs/network/test/http/request_linearize_test.cpp @@ -1,30 +1,30 @@ // Copyright 2010 Dean Michael Berris. +// Copyright 2016 Google, Inc. // 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) -#define BOOST_TEST_MODULE HTTP Request Linearize Test -#include +#include #include #include #include -#include #include #include +#include "tag_types.hpp" namespace http = boost::network::http; namespace tags = boost::network::http::tags; namespace mpl = boost::mpl; namespace net = boost::network; -typedef mpl::list tag_types; +template +class LinearizeTest : public ::testing::Test {}; -BOOST_AUTO_TEST_CASE_TEMPLATE(linearize_request, T, tag_types) { - http::basic_request request("http://www.boost.org"); +TYPED_TEST_CASE(LinearizeTest, TagTypes); + +TYPED_TEST(LinearizeTest, LinearizeRequest) { + http::basic_request request("http://www.boost.org"); static char http_1_0_output[] = "GET / HTTP/1.0\r\n" "Host: www.boost.org\r\n" @@ -38,17 +38,16 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(linearize_request, T, tag_types) { "Accept-Encoding: identity;q=1.0, *;q=0\r\n" "Connection: Close\r\n" "\r\n"; - typename http::basic_request::string_type output_1_0; + typename http::basic_request::string_type output_1_0; linearize(request, "GET", 1, 0, std::back_inserter(output_1_0)); - BOOST_CHECK_EQUAL(output_1_0, http_1_0_output); - typename http::basic_request::string_type output_1_1; + EXPECT_EQ(http_1_0_output, output_1_0); + typename http::basic_request::string_type output_1_1; linearize(request, "GET", 1, 1, std::back_inserter(output_1_1)); - BOOST_CHECK_EQUAL(output_1_1, http_1_1_output); + EXPECT_EQ(http_1_1_output, output_1_1); } -BOOST_AUTO_TEST_CASE_TEMPLATE(linearize_request_override_headers, T, - tag_types) { - http::basic_request request("http://www.boost.org"); +TYPED_TEST(LinearizeTest, OverrideHeaders) { + http::basic_request request("http://www.boost.org"); // We can override the defaulted headers and test that here. request << net::header("Accept", ""); static char http_1_0_no_accept_output[] = @@ -62,10 +61,10 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(linearize_request_override_headers, T, "Accept-Encoding: identity;q=1.0, *;q=0\r\n" "Connection: Close\r\n" "\r\n"; - typename http::basic_request::string_type output_1_0; + typename http::basic_request::string_type output_1_0; linearize(request, "GET", 1, 0, std::back_inserter(output_1_0)); - BOOST_CHECK_EQUAL(output_1_0, http_1_0_no_accept_output); - typename http::basic_request::string_type output_1_1; + EXPECT_EQ(http_1_0_no_accept_output, output_1_0); + typename http::basic_request::string_type output_1_1; linearize(request, "GET", 1, 1, std::back_inserter(output_1_1)); - BOOST_CHECK_EQUAL(output_1_1, http_1_1_no_accept_output); + EXPECT_EQ(http_1_1_no_accept_output, output_1_1); } diff --git a/libs/network/test/http/response_incremental_parser_test.cpp b/libs/network/test/http/response_incremental_parser_test.cpp index a749cf366..3f29d660b 100644 --- a/libs/network/test/http/response_incremental_parser_test.cpp +++ b/libs/network/test/http/response_incremental_parser_test.cpp @@ -1,12 +1,12 @@ -// Copyright Dean Michael Berris 2010. +// Copyright Dean Michael Berris 2010. +// Copyright 2016 Google, Inc. // 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) +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) -#define BOOST_TEST_MODULE HTTP Incremental Parser Test +#include #include -#include #include #include #include @@ -61,9 +61,9 @@ struct lf { static const std::string literal; }; const std::string lf::literal = "\n"; -typedef boost::mpl::vector eol_types; +using EolTypes = ::testing::Types; -BOOST_AUTO_TEST_CASE(incremental_parser_constructor) { +TEST(IncrementalResponseParserTest, Constructor) { response_parser p; // default constructible } @@ -73,7 +73,7 @@ BOOST_AUTO_TEST_CASE(incremental_parser_constructor) { * we want it to parse until it either finds the HTTP version * or there is an error encountered. */ -BOOST_AUTO_TEST_CASE(incremental_parser_parse_http_version) { +TEST(IncrementalResponseParserTest, ParseHTTPVersion) { response_parser p; // default constructible logic::tribool parsed_ok = false; typedef response_parser response_parser_type; @@ -83,16 +83,16 @@ BOOST_AUTO_TEST_CASE(incremental_parser_parse_http_version) { std::string valid_http_version = "HTTP/1.0 "; fusion::tie(parsed_ok, result_range) = p.parse_until( response_parser_type::http_version_done, valid_http_version); - BOOST_CHECK_EQUAL(parsed_ok, true); - BOOST_CHECK(!boost::empty(result_range)); + EXPECT_EQ(true, parsed_ok); + EXPECT_FALSE(boost::empty(result_range)); std::string parsed(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed << " state=" << p.state() << std::endl; p.reset(); valid_http_version = "HTTP/1.1 "; fusion::tie(parsed_ok, result_range) = p.parse_until( response_parser_type::http_version_done, valid_http_version); - BOOST_CHECK_EQUAL(parsed_ok, true); - BOOST_CHECK(!boost::empty(result_range)); + EXPECT_EQ(true, parsed_ok); + EXPECT_FALSE(boost::empty(result_range)); parsed.assign(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed << " state=" << p.state() << std::endl; @@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE(incremental_parser_parse_http_version) { parsed_ok = logic::indeterminate; fusion::tie(parsed_ok, result_range) = p.parse_until( response_parser_type::http_version_done, invalid_http_version); - BOOST_CHECK_EQUAL(parsed_ok, false); + EXPECT_EQ(false, parsed_ok); parsed.assign(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed << " state=" << p.state() << std::endl; @@ -110,17 +110,22 @@ BOOST_AUTO_TEST_CASE(incremental_parser_parse_http_version) { parsed_ok = logic::indeterminate; fusion::tie(parsed_ok, result_range) = p.parse_until( response_parser_type::http_version_done, valid_http_version); - BOOST_CHECK_EQUAL(parsed_ok, true); + EXPECT_EQ(true, parsed_ok); parsed.assign(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed << " state=" << p.state() << std::endl; } +template +class IncrementalResponseEOLTypeTest : public ::testing::Test {}; + +TYPED_TEST_CASE(IncrementalResponseEOLTypeTest, EolTypes); + /** In this test we then want to check that we can parse a status * string right after the version string. We should expect that * the parser doesn't do any conversions from string to integer * and outsource that part to the user of the parser. */ -BOOST_AUTO_TEST_CASE_TEMPLATE(incremental_parser_parse_status, eol, eol_types) { +TYPED_TEST(IncrementalResponseEOLTypeTest, ParseStatus) { typedef response_parser response_parser_type; typedef boost::iterator_range range_type; // We want to create a parser that has been initialized to a specific @@ -133,7 +138,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(incremental_parser_parse_status, eol, eol_types) { range_type result_range; fusion::tie(parsed_ok, result_range) = p.parse_until(response_parser_type::http_status_done, valid_status); - BOOST_CHECK_EQUAL(parsed_ok, true); + EXPECT_EQ(true, parsed_ok); std::string parsed = std::string(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed << " state=" << p.state() << std::endl; @@ -142,14 +147,14 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(incremental_parser_parse_status, eol, eol_types) { std::string invalid_status = "200x "; fusion::tie(parsed_ok, result_range) = p.parse_until(response_parser_type::http_status_done, invalid_status); - BOOST_CHECK_EQUAL(parsed_ok, false); + EXPECT_EQ(false, parsed_ok); parsed = std::string(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed << " state=" << p.state() << std::endl; - valid_status = "200" + eol::literal; + valid_status = "200" + TypeParam::literal; fusion::tie(parsed_ok, result_range) = p.parse_until(response_parser_type::http_status_done, valid_status); - BOOST_CHECK_EQUAL(parsed_ok, true); + EXPECT_EQ(true, parsed_ok); parsed = std::string(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed << " state=" << p.state() << std::endl; } @@ -157,61 +162,60 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(incremental_parser_parse_status, eol, eol_types) { /** In this test then we get the rest of the first line of the HTTP * Response, and treat it as the status message. */ -BOOST_AUTO_TEST_CASE_TEMPLATE(incremental_parser_parse_status_message, eol, - eol_types) { +TYPED_TEST(IncrementalResponseEOLTypeTest, ParseStatusMessage) { typedef response_parser response_parser_type; typedef boost::iterator_range range_type; response_parser_type p(response_parser_type::http_status_done); - std::string valid_status_message = "OK" + eol::literal + "Server: Foo"; + std::string valid_status_message = "OK" + TypeParam::literal + "Server: Foo"; logic::tribool parsed_ok; range_type result_range; fusion::tie(parsed_ok, result_range) = p.parse_until( response_parser_type::http_status_message_done, valid_status_message); - BOOST_CHECK_EQUAL(parsed_ok, true); + EXPECT_EQ(true, parsed_ok); std::string parsed = std::string(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed << " state=" << p.state() << std::endl; p.reset(response_parser_type::http_status_done); - valid_status_message = "OK" + eol::literal; + valid_status_message = "OK" + TypeParam::literal; fusion::tie(parsed_ok, result_range) = p.parse_until( response_parser_type::http_status_message_done, valid_status_message); - BOOST_CHECK_EQUAL(parsed_ok, true); + EXPECT_EQ(true, parsed_ok); parsed = std::string(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed << " state=" << p.state() << std::endl; p.reset(response_parser_type::http_status_done); - valid_status_message = "Internal Server Error" + eol::literal; + valid_status_message = "Internal Server Error" + TypeParam::literal; fusion::tie(parsed_ok, result_range) = p.parse_until( response_parser_type::http_status_message_done, valid_status_message); - BOOST_CHECK_EQUAL(parsed_ok, true); + EXPECT_EQ(true, parsed_ok); parsed = std::string(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed << " state=" << p.state() << std::endl; p.reset(response_parser_type::http_status_done); - valid_status_message = eol::literal; + valid_status_message = TypeParam::literal; fusion::tie(parsed_ok, result_range) = p.parse_until( response_parser_type::http_status_message_done, valid_status_message); - BOOST_CHECK_EQUAL(parsed_ok, true); + EXPECT_EQ(true, parsed_ok); parsed = std::string(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed << " state=" << p.state() << std::endl; p.reset(response_parser_type::http_status_done); - valid_status_message = "한글메시지" + eol::literal; + valid_status_message = "한글메시지" + TypeParam::literal; fusion::tie(parsed_ok, result_range) = p.parse_until( response_parser_type::http_status_message_done, valid_status_message); - BOOST_CHECK_EQUAL(parsed_ok, true); + EXPECT_EQ(true, parsed_ok); parsed = std::string(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed << " state=" << p.state() << std::endl; } /** This test specifices how one-line-per-header parsing happens incrementally. */ -BOOST_AUTO_TEST_CASE_TEMPLATE(incremental_parser_parse_header_lines, eol, - eol_types) { +TYPED_TEST(IncrementalResponseEOLTypeTest, ParseHTTPHeaders) { typedef response_parser response_parser_type; typedef boost::iterator_range range_type; + using eol = TypeParam; response_parser_type p(response_parser_type::http_status_message_done); std::string valid_headers = "Server: Foo" + eol::literal + @@ -221,7 +225,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(incremental_parser_parse_header_lines, eol, range_type result_range; fusion::tie(parsed_ok, result_range) = p.parse_until(response_parser_type::http_header_line_done, valid_headers); - BOOST_CHECK_EQUAL(parsed_ok, true); + EXPECT_EQ(true, parsed_ok); std::string parsed1 = std::string(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed1 << " state=" << p.state() << std::endl; @@ -230,7 +234,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(incremental_parser_parse_header_lines, eol, valid_headers.assign(boost::end(result_range), end); fusion::tie(parsed_ok, result_range) = p.parse_until(response_parser_type::http_header_line_done, valid_headers); - BOOST_CHECK_EQUAL(parsed_ok, true); + EXPECT_EQ(true, parsed_ok); std::string parsed2 = std::string(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed2 << " state=" << p.state() << std::endl; @@ -238,8 +242,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(incremental_parser_parse_header_lines, eol, p.reset(response_parser_type::http_status_message_done); fusion::tie(parsed_ok, result_range) = p.parse_until(response_parser_type::http_headers_done, valid_headers); - BOOST_CHECK_EQUAL(parsed_ok, true); - BOOST_CHECK(parsed1 != parsed2); + EXPECT_EQ(true, parsed_ok); + EXPECT_NE(parsed1, parsed2); p.reset(response_parser_type::http_status_message_done); valid_headers = " Server: Foo" + eol::literal + @@ -247,7 +251,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(incremental_parser_parse_header_lines, eol, eol::literal; fusion::tie(parsed_ok, result_range) = p.parse_until(response_parser_type::http_header_line_done, valid_headers); - BOOST_CHECK_EQUAL(parsed_ok, true); + EXPECT_EQ(true, parsed_ok); parsed1 = std::string(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed1 << " state=" << p.state() << std::endl; p.reset(response_parser_type::http_status_message_done); @@ -255,15 +259,15 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(incremental_parser_parse_header_lines, eol, valid_headers.assign(boost::end(result_range), end); fusion::tie(parsed_ok, result_range) = p.parse_until(response_parser_type::http_header_line_done, valid_headers); - BOOST_CHECK_EQUAL(parsed_ok, true); + EXPECT_EQ(true, parsed_ok); parsed2 = std::string(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed2 << " state=" << p.state() << std::endl; valid_headers.assign(boost::end(result_range), end); p.reset(response_parser_type::http_status_message_done); fusion::tie(parsed_ok, result_range) = p.parse_until(response_parser_type::http_headers_done, valid_headers); - BOOST_CHECK_EQUAL(parsed_ok, true); - BOOST_CHECK(parsed1 != parsed2); + EXPECT_EQ(true, parsed_ok); + EXPECT_NE(parsed1, parsed2); p.reset(response_parser_type::http_status_message_done); valid_headers = "_Server: Foo" + eol::literal + @@ -271,7 +275,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(incremental_parser_parse_header_lines, eol, eol::literal; fusion::tie(parsed_ok, result_range) = p.parse_until(response_parser_type::http_header_line_done, valid_headers); - BOOST_CHECK_EQUAL(parsed_ok, true); + EXPECT_EQ(true, parsed_ok); parsed1 = std::string(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed1 << " state=" << p.state() << std::endl; p.reset(response_parser_type::http_status_message_done); @@ -279,22 +283,22 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(incremental_parser_parse_header_lines, eol, valid_headers.assign(boost::end(result_range), end); fusion::tie(parsed_ok, result_range) = p.parse_until(response_parser_type::http_header_line_done, valid_headers); - BOOST_CHECK_EQUAL(parsed_ok, true); + EXPECT_EQ(true, parsed_ok); parsed2 = std::string(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed2 << " state=" << p.state() << std::endl; valid_headers.assign(boost::end(result_range), end); p.reset(response_parser_type::http_status_message_done); fusion::tie(parsed_ok, result_range) = p.parse_until(response_parser_type::http_headers_done, valid_headers); - BOOST_CHECK_EQUAL(parsed_ok, true); - BOOST_CHECK(parsed1 != parsed2); + EXPECT_EQ(true, parsed_ok); + EXPECT_NE(parsed1, parsed2); p.reset(response_parser_type::http_status_message_done); valid_headers = "Server: " + eol::literal + "Content-Type: application/json" + eol::literal + eol::literal; fusion::tie(parsed_ok, result_range) = p.parse_until(response_parser_type::http_header_line_done, valid_headers); - BOOST_CHECK_EQUAL(parsed_ok, true); + EXPECT_EQ(true, parsed_ok); parsed1 = std::string(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed1 << " state=" << p.state() << std::endl; p.reset(response_parser_type::http_status_message_done); @@ -302,15 +306,15 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(incremental_parser_parse_header_lines, eol, valid_headers.assign(boost::end(result_range), end); fusion::tie(parsed_ok, result_range) = p.parse_until(response_parser_type::http_header_line_done, valid_headers); - BOOST_CHECK_EQUAL(parsed_ok, true); + EXPECT_EQ(true, parsed_ok); parsed2 = std::string(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed2 << " state=" << p.state() << std::endl; valid_headers.assign(boost::end(result_range), end); p.reset(response_parser_type::http_status_message_done); fusion::tie(parsed_ok, result_range) = p.parse_until(response_parser_type::http_headers_done, valid_headers); - BOOST_CHECK_EQUAL(parsed_ok, true); - BOOST_CHECK(parsed1 != parsed2); + EXPECT_EQ(true, parsed_ok); + EXPECT_NE(parsed1, parsed2); p.reset(response_parser_type::http_status_message_done); valid_headers = "Server: 서버" + eol::literal + @@ -318,7 +322,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(incremental_parser_parse_header_lines, eol, eol::literal; fusion::tie(parsed_ok, result_range) = p.parse_until(response_parser_type::http_header_line_done, valid_headers); - BOOST_CHECK_EQUAL(parsed_ok, true); + EXPECT_EQ(true, parsed_ok); parsed1 = std::string(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed1 << " state=" << p.state() << std::endl; p.reset(response_parser_type::http_status_message_done); @@ -326,22 +330,22 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(incremental_parser_parse_header_lines, eol, valid_headers.assign(boost::end(result_range), end); fusion::tie(parsed_ok, result_range) = p.parse_until(response_parser_type::http_header_line_done, valid_headers); - BOOST_CHECK_EQUAL(parsed_ok, true); + EXPECT_EQ(true, parsed_ok); parsed2 = std::string(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed2 << " state=" << p.state() << std::endl; valid_headers.assign(boost::end(result_range), end); p.reset(response_parser_type::http_status_message_done); fusion::tie(parsed_ok, result_range) = p.parse_until(response_parser_type::http_headers_done, valid_headers); - BOOST_CHECK_EQUAL(parsed_ok, true); - BOOST_CHECK(parsed1 != parsed2); + EXPECT_EQ(true, parsed_ok); + EXPECT_NE(parsed1, parsed2); p.reset(response_parser_type::http_status_message_done); valid_headers = "Content-Type: text/html;" + eol::literal + "charset=utf-8" + eol::literal + eol::literal; fusion::tie(parsed_ok, result_range) = p.parse_until(response_parser_type::http_header_line_done, valid_headers); - BOOST_CHECK_EQUAL(parsed_ok, true); + EXPECT_EQ(true, parsed_ok); parsed1 = std::string(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed1 << " state=" << p.state() << std::endl; p.reset(response_parser_type::http_status_message_done); @@ -349,13 +353,13 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(incremental_parser_parse_header_lines, eol, valid_headers.assign(boost::end(result_range), end); fusion::tie(parsed_ok, result_range) = p.parse_until(response_parser_type::http_header_line_done, valid_headers); - BOOST_CHECK_EQUAL(parsed_ok, true); + EXPECT_EQ(true, parsed_ok); parsed2 = std::string(boost::begin(result_range), boost::end(result_range)); std::cout << "PARSED: " << parsed2 << " state=" << p.state() << std::endl; valid_headers.assign(boost::end(result_range), end); p.reset(response_parser_type::http_status_message_done); fusion::tie(parsed_ok, result_range) = p.parse_until(response_parser_type::http_headers_done, valid_headers); - BOOST_CHECK_EQUAL(parsed_ok, true); - BOOST_CHECK(parsed1 != parsed2); + EXPECT_EQ(true, parsed_ok); + EXPECT_NE(parsed1, parsed2); } diff --git a/libs/network/test/http/server_async.cpp b/libs/network/test/http/server_async.cpp deleted file mode 100644 index e117085f0..000000000 --- a/libs/network/test/http/server_async.cpp +++ /dev/null @@ -1,52 +0,0 @@ - -// Copyright 2010 Dean Michael Berris. -// 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) - -#define BOOST_TEST_MODULE HTTP Asynchronous Server Tests - -#include -#include -#include -#include - -namespace net = boost::network; -namespace http = boost::network::http; -namespace utils = boost::network::utils; - -struct async_hello_world; -typedef http::async_server server; - -struct async_hello_world { - - struct is_content_length { - template - bool operator()(Header const& header) { - return boost::iequals(name(header), "content-length"); - } - }; - - void operator()(server::request const& request, - server::connection_ptr connection) { - static server::response_header headers[] = {{"Connection", "close"}, - {"Content-Type", "text/plain"}, - {"Server", "cpp-netlib/0.9"}, - {"Content-Length", "13"}}; - static std::string hello_world("Hello, World!"); - connection->set_status(server::connection::ok); - connection->set_headers(boost::make_iterator_range(headers, headers + 4)); - connection->write(hello_world); - } -}; - -int main(int argc, char* argv[]) { - utils::thread_pool thread_pool(2); - async_hello_world handler; - std::string port = "8000"; - if (argc > 1) port = argv[1]; - server instance("localhost", port, handler, thread_pool, - http::_reuse_address = true); - instance.run(); - return 0; -} diff --git a/libs/network/test/http/server_async_less_copy.cpp b/libs/network/test/http/server_async_less_copy.cpp deleted file mode 100644 index b4220b1c2..000000000 --- a/libs/network/test/http/server_async_less_copy.cpp +++ /dev/null @@ -1,61 +0,0 @@ - -// Copyright 2010 Dean Michael Berris. -// 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) - -#define BOOST_TEST_MODULE HTTP Asynchronous Server Tests - -#include - -#include -#include -#include -#include -#include - -namespace net = boost::network; -namespace http = boost::network::http; -namespace utils = boost::network::utils; - -struct async_hello_world; -typedef http::async_server server; - -struct async_hello_world { - - struct is_content_length { - template - bool operator()(Header const& header) { - return boost::iequals(name(header), "content-length"); - } - }; - - void operator()(server::request const& request, - server::connection_ptr connection) { - static server::response_header headers[] = {{"Connection", "close"}, - {"Content-Type", "text/plain"}, - {"Server", "cpp-netlib/0.9"}, - {"Content-Length", "13"}}; - static char const* hello_world = "Hello, World!"; - connection->set_status(server::connection::ok); - connection->set_headers(boost::make_iterator_range(headers, headers + 4)); - std::vector iovec; - iovec.push_back(boost::asio::const_buffer(hello_world, 13)); - connection->write(iovec, boost::bind(&async_hello_world::error, this, _1)); - } - - void error(boost::system::error_code const& ec) { - // do nothing here. - } -}; - -int main(int argc, char* argv[]) { - utils::thread_pool thread_pool(2); - async_hello_world handler; - std::string port = "8000"; - if (argc > 1) port = argv[1]; - server instance("127.0.0.1", port, handler, thread_pool, - http::_reuse_address = true); - instance.run(); - return 0; -} diff --git a/libs/network/test/http/server_async_run_stop_concurrency.cpp b/libs/network/test/http/server_async_run_stop_concurrency.cpp index 535111906..43d66f3fc 100644 --- a/libs/network/test/http/server_async_run_stop_concurrency.cpp +++ b/libs/network/test/http/server_async_run_stop_concurrency.cpp @@ -1,10 +1,4 @@ -#define BOOST_TEST_MODULE HTTP Asynchronous Server Tests -#ifdef BOOST_TEST_DYN_LINK -#define BOOST_TEST_NO_MAIN -#endif /* BOOST_TEST_DYN_LINK */ - #include -#include #include namespace http = boost::network::http; @@ -14,8 +8,8 @@ struct dummy_async_handler; typedef http::server async_server; struct dummy_async_handler { - void operator()(async_server::request const& req, - async_server::connection_ptr conn) { + void operator()(async_server::request const&, + async_server::connection_ptr) { // Really, this is just for testing purposes } }; @@ -23,7 +17,7 @@ struct dummy_async_handler { // In this batch of tests we ensure that calling run and stop on an // async_server, in any sequence, is thread safe. -int main(int argc, char* argv[]) { +int main(int, char*[]) { dummy_async_handler async_handler; #define ASYNC_SERVER_TEST_CONFIG \ @@ -149,6 +143,3 @@ int main(int argc, char* argv[]) { return 0; } -#ifdef BOOST_TEST_DYN_LINK -#undef BOOST_TEST_NO_MAIN -#endif /* BOOST_TEST_DYN_LINK */ diff --git a/libs/network/test/http/server_constructor_test.cpp b/libs/network/test/http/server_constructor_test.cpp index 0da83e4bd..a02aaf009 100644 --- a/libs/network/test/http/server_constructor_test.cpp +++ b/libs/network/test/http/server_constructor_test.cpp @@ -1,13 +1,12 @@ // Copyright 2010 Dean Michael Berris. +// Copyright 2016 Google, Inc. // 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) -#define BOOST_TEST_MODULE HTTP Server Construtor Tests - +#include #include -#include namespace http = boost::network::http; namespace util = boost::network::utils; @@ -21,27 +20,26 @@ struct dummy_async_handler { } }; -BOOST_AUTO_TEST_CASE(minimal_constructor) { +TEST(HTTPServerTest, MinimalConstructor) { dummy_async_handler async_handler; async_server::options async_options(async_handler); - BOOST_CHECK_NO_THROW(async_server async_instance( + ASSERT_NO_THROW(async_server async_instance( async_options.address("127.0.0.1").port("80"))); } -BOOST_AUTO_TEST_CASE(with_io_service_parameter) { +TEST(HTTPServerTest, WithIOServiceParameter) { dummy_async_handler async_handler; boost::shared_ptr thread_pool; boost::shared_ptr io_service; async_server::options async_options(async_handler); - BOOST_CHECK_NO_THROW( - async_server async_instance(async_options.address("127.0.0.1") - .port("80") - .io_service(io_service) - .thread_pool(thread_pool))); + ASSERT_NO_THROW(async_server async_instance(async_options.address("127.0.0.1") + .port("80") + .io_service(io_service) + .thread_pool(thread_pool))); } -BOOST_AUTO_TEST_CASE(throws_on_failure) { +TEST(HTTPServerTes, ThrowsOnFailure) { dummy_async_handler async_handler; boost::shared_ptr thread_pool; boost::shared_ptr io_service; @@ -50,5 +48,5 @@ BOOST_AUTO_TEST_CASE(throws_on_failure) { .port("80") .io_service(io_service) .thread_pool(thread_pool)); - BOOST_CHECK_THROW(async_instance.run(), std::runtime_error); + EXPECT_THROW(async_instance.run(), std::runtime_error); } diff --git a/libs/network/test/http/server_header_parser_test.cpp b/libs/network/test/http/server_header_parser_test.cpp index 7bfefbf27..586d76eab 100644 --- a/libs/network/test/http/server_header_parser_test.cpp +++ b/libs/network/test/http/server_header_parser_test.cpp @@ -1,12 +1,12 @@ // Copyright 2013 Rudolfs Bundulis +// Copyright 2016 Google, Inc. // 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) -#define BOOST_TEST_MODULE HTTP Server Header Parser Test +#include #include #include -#include #define BOOST_LOCALE_NO_LIB #include #include @@ -27,7 +27,7 @@ namespace logic = boost::logic; namespace fusion = boost::fusion; using namespace boost::network::http; -BOOST_AUTO_TEST_CASE(async_connection_parse_headers) { +TEST(ServerHeaderParserTest, ParseHeaders) { std::wstring utf16_test_name = L"R\u016bdolfs"; request_header_narrow utf8_header = { "X-Utf8-Test-Header", @@ -48,8 +48,8 @@ BOOST_AUTO_TEST_CASE(async_connection_parse_headers) { } std::wstring utf16_test_name_from_header = boost::locale::conv::utf_to_utf(header_iterator->value); - BOOST_CHECK(header_iterator != headers.end()); - BOOST_CHECK(utf16_test_name_from_header == utf16_test_name); + EXPECT_TRUE(header_iterator != headers.end()); + EXPECT_TRUE(utf16_test_name_from_header == utf16_test_name); std::cout << "utf8 header parsed, name: " << header_iterator->name << ", value: " << header_iterator->value; } diff --git a/libs/network/test/http/server_hello_world.cpp b/libs/network/test/http/server_hello_world.cpp deleted file mode 100644 index 7f9ce8694..000000000 --- a/libs/network/test/http/server_hello_world.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2009 (c) Tarro, Inc. -// Copyright 2009-2010 (c) Dean Michael Berris -// 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) -// - -#include -#include -#include -#include -#include -#include -#include - -namespace http = boost::network::http; -using boost::assign::list_of; -using boost::lexical_cast; -using std::string; -using std::cerr; -using std::endl; - -struct hello_world; -typedef http::server server; - -struct hello_world { - - void operator()(server::request const& request, server::response& response) { - static server::response::header_type header = {"Connection", "close"}; - response = - server::response::stock_reply(server::response::ok, "Hello, World!"); - response.headers.push_back(header); - assert(response.status == server::response::ok); - assert(response.headers.size() == 3); - assert(response.content == "Hello, World!"); - } - - void log(string const& data) { - cerr << data << endl; - abort(); - } -}; - -int main(int argc, char* argv[]) { - hello_world handler; - std::string port = "8000"; - if (argc > 1) port = argv[1]; - server server_("127.0.0.1", port, handler, http::_reuse_address = true); - server_.run(); - return EXIT_SUCCESS; -} diff --git a/libs/network/test/http/server_include_inlined.cpp b/libs/network/test/http/server_include_inlined.cpp deleted file mode 100644 index b4d1b20cc..000000000 --- a/libs/network/test/http/server_include_inlined.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2009 (c) Tarro, Inc. -// Copyright 2009-2010 (c) Dean Michael Berris -// 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) -// - -#include -#include -#define BOOST_NETWORK_NO_LIB -#include -#include -#include -#include -#include -#include - -namespace http = boost::network::http; -using boost::assign::list_of; -using boost::lexical_cast; -using std::string; -using std::cerr; -using std::endl; - -struct hello_world; -typedef http::server server; - -struct hello_world { - - void operator()(server::request const& request, server::response& response) { - static server::response::header_type header = {"Connection", "close"}; - response = - server::response::stock_reply(server::response::ok, "Hello, World!"); - response.headers.push_back(header); - assert(response.status == server::response::ok); - assert(response.headers.size() == 3); - assert(response.content == "Hello, World!"); - } - - void log(string const& data) { - cerr << data << endl; - abort(); - } -}; - -int main(int argc, char* argv[]) { - hello_world handler; - std::string port = "8000"; - if (argc > 1) port = argv[1]; - server server_("127.0.0.1", port, handler, http::_reuse_address = true); - boost::thread runner(boost::bind(&server::run, &server_)); - try { - server_.stop(); - runner.join(); - } - catch (...) { - /* ignore all errors */ - } - return EXIT_SUCCESS; -} diff --git a/libs/network/test/http/tag_types.hpp b/libs/network/test/http/tag_types.hpp index 681a4ae59..d43ec62e6 100644 --- a/libs/network/test/http/tag_types.hpp +++ b/libs/network/test/http/tag_types.hpp @@ -6,14 +6,13 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include +#include #include -namespace http = boost::network::http; - -typedef boost::mpl::vector tag_types; +using TagTypes = + ::testing::Types; #endif /* TAG_TYPES_4NNM8B5T */ diff --git a/libs/network/test/uri/CMakeLists.txt b/libs/network/test/uri/CMakeLists.txt index d4b9334b9..4ea14be9f 100644 --- a/libs/network/test/uri/CMakeLists.txt +++ b/libs/network/test/uri/CMakeLists.txt @@ -1,38 +1,34 @@ -# Copyright (c) Dean Michael Berris 2010. +# Copyright (c) Dean Michael Berris 2010. +# Copyright 2016 Google, Inc. # 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) +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) include_directories(${CPP-NETLIB_SOURCE_DIR}) if (Boost_FOUND) - set( - TESTS - uri_test - uri_builder_test - uri_builder_stream_test - uri_encoding_test - relative_uri_test - ) + set(TESTS uri_test uri_builder_test uri_builder_stream_test + uri_encoding_test relative_uri_test) foreach (test ${TESTS}) if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU) set_source_files_properties(${test}.cpp PROPERTIES COMPILE_FLAGS "-Wall") endif() add_executable(cpp-netlib-${test} ${test}.cpp) - add_dependencies(cpp-netlib-${test} cppnetlib-uri) + add_dependencies(cpp-netlib-${test} cppnetlib-uri gtest_main) target_link_libraries(cpp-netlib-${test} - ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} cppnetlib-uri) + ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} cppnetlib-uri + gtest_main) if (OPENSSL_FOUND) target_link_libraries(cpp-netlib-${test} ${OPENSSL_LIBRARIES}) endif() - if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU AND ${CMAKE_SYSTEM_NAME} MATCHES "Windows") - target_link_libraries(cpp-netlib-${test} ws2_32) - endif() + if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU + AND ${CMAKE_SYSTEM_NAME} MATCHES "Windows") + target_link_libraries(cpp-netlib-${test} ws2_32) + endif() set_target_properties(cpp-netlib-${test} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests) - add_test(cpp-netlib-${test} - ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-${test}) + add_test(cpp-netlib-${test} + ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-${test}) endforeach (test) - endif() diff --git a/libs/network/test/uri/relative_uri_test.cpp b/libs/network/test/uri/relative_uri_test.cpp index b95b4ef59..c6f99cd8a 100644 --- a/libs/network/test/uri/relative_uri_test.cpp +++ b/libs/network/test/uri/relative_uri_test.cpp @@ -1,18 +1,18 @@ -// Copyright (c) Glyn Matthews 2012. +// Copyright (c) Glyn Matthews 2012. +// Copyright 2016 Google, Inc. // 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) +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) -#define BOOST_TEST_MODULE Relative URL Test +#include #include -#include #include #include using namespace boost::network; -BOOST_AUTO_TEST_CASE(relative_uri_test) { +TEST(RelativeURITest, NotSupported) { // don't yet support relative URIs uri::uri instance("example.com"); - BOOST_REQUIRE(!uri::valid(instance)); + ASSERT_FALSE(uri::valid(instance)); } diff --git a/libs/network/test/uri/uri_builder_stream_test.cpp b/libs/network/test/uri/uri_builder_stream_test.cpp index 6b2a920dd..a6ef0a386 100644 --- a/libs/network/test/uri/uri_builder_stream_test.cpp +++ b/libs/network/test/uri/uri_builder_stream_test.cpp @@ -1,121 +1,121 @@ -// Copyright (c) Glyn Matthews 2011. +// Copyright (c) Glyn Matthews 2011. +// Copyright 2016 Google, Inc. // 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) +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) -#define BOOST_TEST_MODULE URI builder stream test +#include #include -#include #include #include #include using namespace boost::network; -BOOST_AUTO_TEST_CASE(builder_test) { +TEST(BuilderTest, Simple) { uri::uri instance; instance << uri::scheme("http") << uri::host("www.example.com") << uri::path("/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL("http://www.example.com/", instance.string()); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("http://www.example.com/", instance.string()); } -BOOST_AUTO_TEST_CASE(full_uri_builder_test) { +TEST(BuilderTest, Full) { uri::uri instance; instance << uri::scheme("http") << uri::user_info("user:password") << uri::host("www.example.com") << uri::port("80") << uri::path("/path") << uri::query("query") << uri::fragment("fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL( + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ( "http://user:password@www.example.com:80/path?query#fragment", instance.string()); } -BOOST_AUTO_TEST_CASE(port_test) { +TEST(BuilderTest, Port) { uri::uri instance; instance << uri::scheme("http") << uri::host("www.example.com") << uri::port(8000) << uri::path("/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL("http://www.example.com:8000/", instance.string()); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("http://www.example.com:8000/", instance.string()); } -BOOST_AUTO_TEST_CASE(encoded_path_test) { +TEST(BuilderTest, EncodedPath) { uri::uri instance; instance << uri::scheme("http") << uri::host("www.example.com") << uri::port(8000) << uri::encoded_path("/Path With (Some) Encoded Characters!"); ; - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL( + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ( "http://www.example.com:8000/" "Path%20With%20%28Some%29%20Encoded%20Characters%21", instance.string()); } -BOOST_AUTO_TEST_CASE(query_test) { +TEST(BuilderTest, Query) { uri::uri instance; instance << uri::scheme("http") << uri::host("www.example.com") << uri::path("/") << uri::query("key", "value"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL("http://www.example.com/?key=value", instance.string()); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("http://www.example.com/?key=value", instance.string()); } -BOOST_AUTO_TEST_CASE(query_2_test) { +TEST(BuilderTest, TwoQueries) { uri::uri instance; instance << uri::scheme("http") << uri::host("www.example.com") << uri::path("/") << uri::query("key1", "value1") << uri::query("key2", "value2"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL("http://www.example.com/?key1=value1&key2=value2", + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("http://www.example.com/?key1=value1&key2=value2", instance.string()); } -BOOST_AUTO_TEST_CASE(fragment_test) { +TEST(BuilderTest, Fragment) { uri::uri instance; instance << uri::scheme("http") << uri::host("www.example.com") << uri::path("/") << uri::fragment("fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL("http://www.example.com/#fragment", instance.string()); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("http://www.example.com/#fragment", instance.string()); } -BOOST_AUTO_TEST_CASE(from_base_test) { +TEST(BuilderTest, FromBase) { uri::uri base_uri("http://www.example.com"); uri::uri instance; instance << base_uri << uri::path("/") << uri::fragment("fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL("http://www.example.com/#fragment", instance.string()); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("http://www.example.com/#fragment", instance.string()); } -BOOST_AUTO_TEST_CASE(scheme_http_test) { +TEST(BuilderTest, Scheme) { uri::uri instance; instance << uri::schemes::http << uri::host("www.example.com") << uri::path("/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL("http://www.example.com/", instance.string()); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("http://www.example.com/", instance.string()); } -BOOST_AUTO_TEST_CASE(scheme_https_test) { +TEST(BuilderTest, HTTPSScheme) { uri::uri instance; instance << uri::schemes::https << uri::host("www.example.com") << uri::path("/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL("https://www.example.com/", instance.string()); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("https://www.example.com/", instance.string()); } -BOOST_AUTO_TEST_CASE(encoded_null_char_test) { +TEST(BuilderTest, EncodedNull) { // there is a potential bug in the way we process ranges if the // strings are null terminated. uri::uri instance; instance << uri::scheme("http") << uri::host("www.example.com") << uri::encoded_path("/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL("http://www.example.com/", instance.string()); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("http://www.example.com/", instance.string()); } -BOOST_AUTO_TEST_CASE(mailto_builder_test) { +TEST(BuilderTest, MailtoScheme) { uri::uri instance; instance << uri::scheme("mailto") << uri::path("cpp-netlib@example.com"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL("mailto:cpp-netlib@example.com", instance.string()); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("mailto:cpp-netlib@example.com", instance.string()); } diff --git a/libs/network/test/uri/uri_builder_test.cpp b/libs/network/test/uri/uri_builder_test.cpp index dd1840f37..c3e841041 100644 --- a/libs/network/test/uri/uri_builder_test.cpp +++ b/libs/network/test/uri/uri_builder_test.cpp @@ -1,25 +1,25 @@ -// Copyright (c) Glyn Matthews 2012. +// Copyright (c) Glyn Matthews 2012. +// Copyright 2016 Google, Inc. // 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) +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) -#define BOOST_TEST_MODULE URI builder test +#include #include -#include #include #include using namespace boost::network; -BOOST_AUTO_TEST_CASE(builder_test) { +TEST(BuilderTest, Simple) { uri::uri instance; uri::builder builder(instance); builder.scheme("http").host("www.example.com").path("/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL("http://www.example.com/", instance.string()); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("http://www.example.com/", instance.string()); } -BOOST_AUTO_TEST_CASE(full_uri_builder_test) { +TEST(BuilderTest, Full) { uri::uri instance; uri::builder builder(instance); builder.scheme("http") @@ -29,42 +29,42 @@ BOOST_AUTO_TEST_CASE(full_uri_builder_test) { .path("/path") .query("query") .fragment("fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL( + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ( "http://user:password@www.example.com:80/path?query#fragment", instance.string()); } -BOOST_AUTO_TEST_CASE(port_test) { +TEST(BuilderTest, Port) { uri::uri instance; uri::builder(instance).scheme("http").host("www.example.com").port(8000).path( "/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL("http://www.example.com:8000/", instance.string()); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("http://www.example.com:8000/", instance.string()); } -BOOST_AUTO_TEST_CASE(encoded_path_test) { +TEST(BuilderTest, EncodedPath) { uri::uri instance; uri::builder builder(instance); builder.scheme("http").host("www.example.com").port(8000).encoded_path( "/Path With (Some) Encoded Characters!"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL( + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ( "http://www.example.com:8000/" "Path%20With%20%28Some%29%20Encoded%20Characters%21", instance.string()); } -BOOST_AUTO_TEST_CASE(query_test) { +TEST(BuilderTest, Query) { uri::uri instance; uri::builder builder(instance); builder.scheme("http").host("www.example.com").path("/").query("key", "value"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL("http://www.example.com/?key=value", instance.string()); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("http://www.example.com/?key=value", instance.string()); } -BOOST_AUTO_TEST_CASE(query_2_test) { +TEST(BuilderTest, TwoQueries) { uri::uri instance; uri::builder builder(instance); builder.scheme("http") @@ -72,55 +72,55 @@ BOOST_AUTO_TEST_CASE(query_2_test) { .path("/") .query("key1", "value1") .query("key2", "value2"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL("http://www.example.com/?key1=value1&key2=value2", + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("http://www.example.com/?key1=value1&key2=value2", instance.string()); } -BOOST_AUTO_TEST_CASE(fragment_test) { +TEST(BuilderTest, Fragment) { uri::uri instance; uri::builder builder(instance); builder.scheme("http").host("www.example.com").path("/").fragment("fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL("http://www.example.com/#fragment", instance.string()); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("http://www.example.com/#fragment", instance.string()); } -BOOST_AUTO_TEST_CASE(from_base_test) { +TEST(BuilderTest, FromBase) { uri::uri instance("http://www.example.com"); uri::builder builder(instance); builder.path("/").fragment("fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL("http://www.example.com/#fragment", instance.string()); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("http://www.example.com/#fragment", instance.string()); } -BOOST_AUTO_TEST_CASE(encoded_null_char_test) { +TEST(BuilderTest, EncodedNull) { // there is a potential bug in the way we process ranges if the // strings are null terminated. uri::uri instance; uri::builder builder(instance); builder.scheme("http").host("www.example.com").encoded_path("/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL("http://www.example.com/", instance.string()); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("http://www.example.com/", instance.string()); } -BOOST_AUTO_TEST_CASE(mailto_builder_test) { +TEST(BuilderTest, MailtoScheme) { uri::uri instance; uri::builder builder(instance); builder.scheme("mailto").path("cpp-netlib@example.com"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL("mailto:cpp-netlib@example.com", instance.string()); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("mailto:cpp-netlib@example.com", instance.string()); } -BOOST_AUTO_TEST_CASE(ipv4_address) { +TEST(BuilderTest, IPv4) { using namespace boost::asio::ip; uri::uri instance; uri::builder builder(instance); builder.scheme("http").host(address_v4::loopback()).path("/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL("http://127.0.0.1/", instance.string()); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("http://127.0.0.1/", instance.string()); } -// BOOST_AUTO_TEST_CASE(ipv6_address) { +// TEST(BuilderTest, IPv6) { // using namespace boost::asio::ip; // uri::uri instance; // uri::builder builder(instance); @@ -129,6 +129,6 @@ BOOST_AUTO_TEST_CASE(ipv4_address) { // .host(address_v6::loopback()) // .path("/") // ; -// BOOST_REQUIRE(uri::valid(instance)); -// BOOST_CHECK_EQUAL("http://[::1]/", instance.string()); +// ASSERT_TRUE(uri::valid(instance)); +// EXPECT_EQ("http://[::1]/", instance.string()); //} diff --git a/libs/network/test/uri/uri_encoding_test.cpp b/libs/network/test/uri/uri_encoding_test.cpp index 2c2ddaaf6..bd11607f7 100644 --- a/libs/network/test/uri/uri_encoding_test.cpp +++ b/libs/network/test/uri/uri_encoding_test.cpp @@ -1,56 +1,56 @@ -// Copyright (c) Glyn Matthews 2011. +// Copyright (c) Glyn Matthews 2011. +// Copyright 2016 Google, Inc. // 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) +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) -#define BOOST_TEST_MODULE URL encoding test +#include #include -#include #include #include #include using namespace boost::network; -BOOST_AUTO_TEST_CASE(encoding_test) { +TEST(URIEncodingTest, Encoding) { const std::string unencoded(" !\"#$%&\'()*"); const std::string encoded("%20%21%22%23%24%25%26%27%28%29%2A"); std::string instance; uri::encode(unencoded, std::back_inserter(instance)); - BOOST_CHECK_EQUAL(instance, encoded); + EXPECT_EQ(instance, encoded); } -BOOST_AUTO_TEST_CASE(decoding_test) { +TEST(URIEncodingTest, Decoding) { const std::string unencoded(" !\"#$%&\'()*"); const std::string encoded("%20%21%22%23%24%25%26%27%28%29%2A"); std::string instance; uri::decode(encoded, std::back_inserter(instance)); - BOOST_CHECK_EQUAL(instance, unencoded); + EXPECT_EQ(instance, unencoded); } -BOOST_AUTO_TEST_CASE(encoding_multibyte_test) { +TEST(URIEncodingTest, EncodingMultibyte) { const std::string unencoded("한글 테스트"); const std::string encoded("%ED%95%9C%EA%B8%80%20%ED%85%8C%EC%8A%A4%ED%8A%B8"); std::string instance; uri::encode(unencoded, std::back_inserter(instance)); - BOOST_CHECK_EQUAL(instance, encoded); + EXPECT_EQ(instance, encoded); } -BOOST_AUTO_TEST_CASE(decoding_multibyte_test) { +TEST(URIEncodingTest, DecodingMultibyte) { const std::string unencoded("한글 테스트"); const std::string encoded("%ED%95%9C%EA%B8%80%20%ED%85%8C%EC%8A%A4%ED%8A%B8"); std::string instance; uri::decode(encoded, std::back_inserter(instance)); - BOOST_CHECK_EQUAL(instance, unencoded); + EXPECT_EQ(instance, unencoded); } -BOOST_AUTO_TEST_CASE(decoding_throw_test) { +TEST(URIEncodingTest, DecodingThrows) { const std::string encoded("%"); std::string instance; - BOOST_CHECK_THROW(uri::decoded(encoded), std::out_of_range); + EXPECT_THROW(uri::decoded(encoded), std::out_of_range); } diff --git a/libs/network/test/uri/uri_test.cpp b/libs/network/test/uri/uri_test.cpp index c6a150763..de6fa748b 100644 --- a/libs/network/test/uri/uri_test.cpp +++ b/libs/network/test/uri/uri_test.cpp @@ -1,12 +1,12 @@ // Copyright 2009, 2010, 2011 Dean Michael Berris, Jeroen Habraken, Glyn // Matthews. +// Copyright 2016 Google, Inc. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt of copy at // http://www.boost.org/LICENSE_1_0.txt) -#define BOOST_TEST_MODULE URL Test +#include #include -#include #include #include #include @@ -18,564 +18,559 @@ using namespace boost::network; -BOOST_AUTO_TEST_CASE(basic_uri_scheme_test) { +TEST(URITest, basic_uri_scheme_test) { uri::uri instance("http://www.example.com/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::scheme(instance), "http"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("http", uri::scheme(instance)); } -BOOST_AUTO_TEST_CASE(basic_uri_user_info_test) { +TEST(URITest, basic_uri_user_info_test) { uri::uri instance("http://www.example.com/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::user_info(instance), ""); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("", uri::user_info(instance)); } -BOOST_AUTO_TEST_CASE(basic_uri_host_test) { +TEST(URITest, basic_uri_host_test) { uri::uri instance("http://www.example.com/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::host(instance), "www.example.com"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("www.example.com", uri::host(instance)); } -BOOST_AUTO_TEST_CASE(basic_uri_port_test) { +TEST(URITest, basic_uri_port_test) { uri::uri instance("http://www.example.com/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::port(instance), ""); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("", uri::port(instance)); } -BOOST_AUTO_TEST_CASE(basic_uri_path_test) { +TEST(URITest, basic_uri_path_test) { uri::uri instance("http://www.example.com/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::path(instance), "/"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("/", uri::path(instance)); } -BOOST_AUTO_TEST_CASE(basic_uri_query_test) { +TEST(URITest, basic_uri_query_test) { uri::uri instance("http://www.example.com/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::query(instance), ""); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("", uri::query(instance)); } -BOOST_AUTO_TEST_CASE(basic_uri_fragment_test) { +TEST(URITest, basic_uri_fragment_test) { uri::uri instance("http://www.example.com/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::fragment(instance), ""); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("", uri::fragment(instance)); } -BOOST_AUTO_TEST_CASE(basic_uri_value_semantics_test) { +TEST(URITest, basic_uri_value_semantics_test) { uri::uri original; uri::uri assigned; assigned = original; - BOOST_CHECK(original == assigned); + EXPECT_TRUE(original == assigned); assigned = "http://www.example.com/"; - BOOST_CHECK(original != assigned); + EXPECT_TRUE(original != assigned); uri::uri copy(assigned); - BOOST_CHECK(copy == assigned); + EXPECT_TRUE(copy == assigned); } -BOOST_AUTO_TEST_CASE(basic_uri_range_scheme_test) { +TEST(URITest, basic_uri_range_scheme_test) { uri::uri instance("http://www.example.com/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK(instance.scheme_range()); - BOOST_CHECK(instance.begin() == boost::begin(instance.scheme_range())); - BOOST_CHECK(boost::equal(instance.scheme_range(), boost::as_literal("http"))); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_TRUE(instance.scheme_range()); + EXPECT_TRUE(instance.begin() == boost::begin(instance.scheme_range())); + EXPECT_TRUE(boost::equal(instance.scheme_range(), boost::as_literal("http"))); } -BOOST_AUTO_TEST_CASE(basic_uri_range_user_info_test) { +TEST(URITest, basic_uri_range_user_info_test) { uri::uri instance("http://www.example.com/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK(!instance.user_info_range()); - BOOST_CHECK(boost::begin(instance.host_range()) == + ASSERT_TRUE(uri::valid(instance)); + EXPECT_TRUE(!instance.user_info_range()); + EXPECT_TRUE(boost::begin(instance.host_range()) == boost::begin(instance.user_info_range())); - BOOST_CHECK(boost::begin(instance.host_range()) == + EXPECT_TRUE(boost::begin(instance.host_range()) == boost::end(instance.user_info_range())); } -BOOST_AUTO_TEST_CASE(basic_uri_range_host_test) { +TEST(URITest, basic_uri_range_host_test) { uri::uri instance("http://www.example.com/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK(instance.host_range()); - BOOST_CHECK(boost::equal(instance.host_range(), + ASSERT_TRUE(uri::valid(instance)); + EXPECT_TRUE(instance.host_range()); + EXPECT_TRUE(boost::equal(instance.host_range(), boost::as_literal("www.example.com"))); } -BOOST_AUTO_TEST_CASE(basic_uri_range_port_test) { +TEST(URITest, basic_uri_range_port_test) { uri::uri instance("http://www.example.com/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK(!instance.port_range()); - BOOST_CHECK(boost::end(instance.host_range()) == + ASSERT_TRUE(uri::valid(instance)); + EXPECT_TRUE(!instance.port_range()); + EXPECT_TRUE(boost::end(instance.host_range()) == boost::begin(instance.port_range())); - BOOST_CHECK(boost::end(instance.host_range()) == + EXPECT_TRUE(boost::end(instance.host_range()) == boost::end(instance.port_range())); } -BOOST_AUTO_TEST_CASE(basic_uri_range_path_test) { +TEST(URITest, basic_uri_range_path_test) { uri::uri instance("http://www.example.com/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK(instance.path_range()); - BOOST_CHECK(boost::equal(instance.path_range(), boost::as_literal("/"))); - BOOST_CHECK(instance.end() == boost::end(instance.path_range())); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_TRUE(instance.path_range()); + EXPECT_TRUE(boost::equal(instance.path_range(), boost::as_literal("/"))); + EXPECT_TRUE(instance.end() == boost::end(instance.path_range())); } -BOOST_AUTO_TEST_CASE(basic_uri_range_query_test) { +TEST(URITest, basic_uri_range_query_test) { uri::uri instance("http://www.example.com/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK(!instance.query_range()); - BOOST_CHECK(instance.end() == boost::begin(instance.query_range())); - BOOST_CHECK(instance.end() == boost::end(instance.query_range())); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_TRUE(!instance.query_range()); + EXPECT_TRUE(instance.end() == boost::begin(instance.query_range())); + EXPECT_TRUE(instance.end() == boost::end(instance.query_range())); } -BOOST_AUTO_TEST_CASE(basic_uri_range_fragment_test) { +TEST(URITest, basic_uri_range_fragment_test) { uri::uri instance("http://www.example.com/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK(!instance.fragment_range()); - BOOST_CHECK(instance.end() == boost::begin(instance.fragment_range())); - BOOST_CHECK(instance.end() == boost::end(instance.fragment_range())); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_TRUE(!instance.fragment_range()); + EXPECT_TRUE(instance.end() == boost::begin(instance.fragment_range())); + EXPECT_TRUE(instance.end() == boost::end(instance.fragment_range())); } -BOOST_AUTO_TEST_CASE(full_uri_scheme_test) { +TEST(URITest, full_uri_scheme_test) { uri::uri instance( "http://user:password@www.example.com:80/path?query#fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::scheme(instance), "http"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("http", uri::scheme(instance)); } -BOOST_AUTO_TEST_CASE(full_uri_user_info_test) { +TEST(URITest, full_uri_user_info_test) { uri::uri instance( "http://user:password@www.example.com:80/path?query#fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::user_info(instance), "user:password"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("user:password", uri::user_info(instance)); } -BOOST_AUTO_TEST_CASE(full_uri_host_test) { +TEST(URITest, full_uri_host_test) { uri::uri instance( "http://user:password@www.example.com:80/path?query#fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::host(instance), "www.example.com"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("www.example.com", uri::host(instance)); } -BOOST_AUTO_TEST_CASE(full_uri_port_test) { +TEST(URITest, full_uri_port_test) { uri::uri instance( "http://user:password@www.example.com:80/path?query#fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::port(instance), "80"); - BOOST_CHECK(uri::port_us(instance)); - BOOST_CHECK_EQUAL(uri::port_us(instance).get(), 80); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("80", uri::port(instance)); + EXPECT_TRUE(uri::port_us(instance)); + EXPECT_EQ(80, uri::port_us(instance).get()); } -BOOST_AUTO_TEST_CASE(full_uri_path_test) { +TEST(URITest, full_uri_path_test) { uri::uri instance( "http://user:password@www.example.com:80/path?query#fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::path(instance), "/path"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("/path", uri::path(instance)); } -BOOST_AUTO_TEST_CASE(full_uri_query_test) { +TEST(URITest, full_uri_query_test) { uri::uri instance( "http://user:password@www.example.com:80/path?query#fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::query(instance), "query"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("query", uri::query(instance)); } -BOOST_AUTO_TEST_CASE(full_uri_fragment_test) { +TEST(URITest, full_uri_fragment_test) { uri::uri instance( "http://user:password@www.example.com:80/path?query#fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::fragment(instance), "fragment"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("fragment", uri::fragment(instance)); } -BOOST_AUTO_TEST_CASE(full_uri_range_scheme_test) { +TEST(URITest, full_uri_range_scheme_test) { uri::uri instance( "http://user:password@www.example.com:80/path?query#fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK(instance.scheme_range()); - BOOST_CHECK(instance.begin() == boost::begin(instance.scheme_range())); - BOOST_CHECK(boost::equal(instance.scheme_range(), boost::as_literal("http"))); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_TRUE(instance.scheme_range()); + EXPECT_TRUE(instance.begin() == boost::begin(instance.scheme_range())); + EXPECT_TRUE(boost::equal(instance.scheme_range(), boost::as_literal("http"))); } -BOOST_AUTO_TEST_CASE(full_uri_range_user_info_test) { +TEST(URITest, full_uri_range_user_info_test) { uri::uri instance( "http://user:password@www.example.com:80/path?query#fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK(instance.user_info_range()); - BOOST_CHECK(boost::equal(instance.user_info_range(), + ASSERT_TRUE(uri::valid(instance)); + EXPECT_TRUE(instance.user_info_range()); + EXPECT_TRUE(boost::equal(instance.user_info_range(), boost::as_literal("user:password"))); } -BOOST_AUTO_TEST_CASE(full_uri_range_host_test) { +TEST(URITest, full_uri_range_host_test) { uri::uri instance( "http://user:password@www.example.com:80/path?query#fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK(instance.host_range()); - BOOST_CHECK(boost::equal(instance.host_range(), + ASSERT_TRUE(uri::valid(instance)); + EXPECT_TRUE(instance.host_range()); + EXPECT_TRUE(boost::equal(instance.host_range(), boost::as_literal("www.example.com"))); } -BOOST_AUTO_TEST_CASE(full_uri_range_port_test) { +TEST(URITest, full_uri_range_port_test) { uri::uri instance( "http://user:password@www.example.com:80/path?query#fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK(instance.port_range()); - BOOST_CHECK(boost::equal(instance.port_range(), boost::as_literal("80"))); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_TRUE(instance.port_range()); + EXPECT_TRUE(boost::equal(instance.port_range(), boost::as_literal("80"))); } -BOOST_AUTO_TEST_CASE(full_uri_range_path_test) { +TEST(URITest, full_uri_range_path_test) { uri::uri instance( "http://user:password@www.example.com:80/path?query#fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK(instance.path_range()); - BOOST_CHECK(boost::equal(instance.path_range(), boost::as_literal("/path"))); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_TRUE(instance.path_range()); + EXPECT_TRUE(boost::equal(instance.path_range(), boost::as_literal("/path"))); } -BOOST_AUTO_TEST_CASE(full_uri_range_query_test) { +TEST(URITest, full_uri_range_query_test) { uri::uri instance( "http://user:password@www.example.com:80/path?query#fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK(instance.query_range()); - BOOST_CHECK(boost::equal(instance.query_range(), boost::as_literal("query"))); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_TRUE(instance.query_range()); + EXPECT_TRUE(boost::equal(instance.query_range(), boost::as_literal("query"))); } -BOOST_AUTO_TEST_CASE(full_uri_range_fragment_test) { +TEST(URITest, full_uri_range_fragment_test) { uri::uri instance( "http://user:password@www.example.com:80/path?query#fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK(instance.fragment_range()); - BOOST_CHECK( + ASSERT_TRUE(uri::valid(instance)); + EXPECT_TRUE(instance.fragment_range()); + EXPECT_TRUE( boost::equal(instance.fragment_range(), boost::as_literal("fragment"))); - BOOST_CHECK(instance.end() == boost::end(instance.fragment_range())); + EXPECT_TRUE(instance.end() == boost::end(instance.fragment_range())); } -BOOST_AUTO_TEST_CASE(mailto_test) { +TEST(URITest, mailto_test) { uri::uri instance("mailto:john.doe@example.com"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::scheme(instance), "mailto"); - BOOST_CHECK_EQUAL(uri::path(instance), "john.doe@example.com"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("mailto", uri::scheme(instance)); + EXPECT_EQ("john.doe@example.com", uri::path(instance)); } -BOOST_AUTO_TEST_CASE(file_test) { +TEST(URITest, file_test) { uri::uri instance("file:///bin/bash"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::scheme(instance), "file"); - BOOST_CHECK_EQUAL(uri::path(instance), "/bin/bash"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("file", uri::scheme(instance)); + EXPECT_EQ("/bin/bash", uri::path(instance)); } -BOOST_AUTO_TEST_CASE(xmpp_test) { +TEST(URITest, xmpp_test) { uri::uri instance( "xmpp:example-node@example.com?message;subject=Hello%20World"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::scheme(instance), "xmpp"); - BOOST_CHECK_EQUAL(uri::path(instance), "example-node@example.com"); - BOOST_CHECK_EQUAL(uri::query(instance), "message;subject=Hello%20World"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("xmpp", uri::scheme(instance)); + EXPECT_EQ("example-node@example.com", uri::path(instance)); + EXPECT_EQ("message;subject=Hello%20World", uri::query(instance)); } -BOOST_AUTO_TEST_CASE(ipv4_address_test) { +TEST(URITest, ipv4_address_test) { uri::uri instance("http://129.79.245.252/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::scheme(instance), "http"); - BOOST_CHECK_EQUAL(uri::host(instance), "129.79.245.252"); - BOOST_CHECK_EQUAL(uri::path(instance), "/"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("http", uri::scheme(instance)); + EXPECT_EQ("129.79.245.252", uri::host(instance)); + EXPECT_EQ("/", uri::path(instance)); } -BOOST_AUTO_TEST_CASE(ipv4_loopback_test) { +TEST(URITest, ipv4_loopback_test) { uri::uri instance("http://127.0.0.1/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::scheme(instance), "http"); - BOOST_CHECK_EQUAL(uri::host(instance), "127.0.0.1"); - BOOST_CHECK_EQUAL(uri::path(instance), "/"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("http", uri::scheme(instance)); + EXPECT_EQ("127.0.0.1", uri::host(instance)); + EXPECT_EQ("/", uri::path(instance)); } -BOOST_AUTO_TEST_CASE(ipv6_address_test_1) { +TEST(URITest, ipv6_address_test_1) { uri::uri instance("http://[1080:0:0:0:8:800:200C:417A]/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::scheme(instance), "http"); - BOOST_CHECK_EQUAL(uri::host(instance), "[1080:0:0:0:8:800:200C:417A]"); - BOOST_CHECK_EQUAL(uri::path(instance), "/"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("http", uri::scheme(instance)); + EXPECT_EQ("[1080:0:0:0:8:800:200C:417A]", uri::host(instance)); + EXPECT_EQ("/", uri::path(instance)); } -BOOST_AUTO_TEST_CASE(ipv6_address_test_2) { +TEST(URITest, ipv6_address_test_2) { uri::uri instance("http://[2001:db8:85a3:8d3:1319:8a2e:370:7348]/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::scheme(instance), "http"); - BOOST_CHECK_EQUAL(uri::host(instance), - "[2001:db8:85a3:8d3:1319:8a2e:370:7348]"); - BOOST_CHECK_EQUAL(uri::path(instance), "/"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("http", uri::scheme(instance)); + EXPECT_EQ("[2001:db8:85a3:8d3:1319:8a2e:370:7348]", uri::host(instance)); + EXPECT_EQ("/", uri::path(instance)); } -// BOOST_AUTO_TEST_CASE(ipv6_loopback_test) { +// TEST(URITest, ipv6_loopback_test) { // uri::uri instance("http://[::1]/"); -// BOOST_REQUIRE(uri::valid(instance)); -// BOOST_CHECK_EQUAL(uri::scheme(instance), "http"); -// BOOST_CHECK_EQUAL(uri::host(instance), "[::1]"); -// BOOST_CHECK_EQUAL(uri::path(instance), "/"); +// ASSERT_TRUE(uri::valid(instance)); +// EXPECT_EQ("http", uri::scheme(instance)); +// EXPECT_EQ("[::1]", uri::host(instance)); +// EXPECT_EQ("/", uri::path(instance)); //} -BOOST_AUTO_TEST_CASE(ftp_test) { +TEST(URITest, ftp_test) { uri::uri instance("ftp://john.doe@ftp.example.com/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::scheme(instance), "ftp"); - BOOST_CHECK_EQUAL(uri::user_info(instance), "john.doe"); - BOOST_CHECK_EQUAL(uri::host(instance), "ftp.example.com"); - BOOST_CHECK_EQUAL(uri::path(instance), "/"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("ftp", uri::scheme(instance)); + EXPECT_EQ("john.doe", uri::user_info(instance)); + EXPECT_EQ("ftp.example.com", uri::host(instance)); + EXPECT_EQ("/", uri::path(instance)); } -BOOST_AUTO_TEST_CASE(news_test) { +TEST(URITest, news_test) { uri::uri instance("news:comp.infosystems.www.servers.unix"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::scheme(instance), "news"); - BOOST_CHECK_EQUAL(uri::path(instance), "comp.infosystems.www.servers.unix"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("news", uri::scheme(instance)); + EXPECT_EQ("comp.infosystems.www.servers.unix", uri::path(instance)); } -BOOST_AUTO_TEST_CASE(tel_test) { +TEST(URITest, tel_test) { uri::uri instance("tel:+1-816-555-1212"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::scheme(instance), "tel"); - BOOST_CHECK_EQUAL(uri::path(instance), "+1-816-555-1212"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("tel", uri::scheme(instance)); + EXPECT_EQ("+1-816-555-1212", uri::path(instance)); } -BOOST_AUTO_TEST_CASE(encoded_uri_test) { +TEST(URITest, encoded_uri_test) { uri::uri instance( "http://www.example.com/" "Path%20With%20%28Some%29%20Encoded%20Characters%21"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::scheme(instance), "http"); - BOOST_CHECK_EQUAL(uri::host(instance), "www.example.com"); - BOOST_CHECK_EQUAL(uri::path(instance), - "/Path%20With%20%28Some%29%20Encoded%20Characters%21"); - BOOST_CHECK_EQUAL(uri::decoded_path(instance), - "/Path With (Some) Encoded Characters!"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("http", uri::scheme(instance)); + EXPECT_EQ("www.example.com", uri::host(instance)); + EXPECT_EQ("/Path%20With%20%28Some%29%20Encoded%20Characters%21", uri::path(instance)); + EXPECT_EQ("/Path With (Some) Encoded Characters!",uri::decoded_path(instance)); } -BOOST_AUTO_TEST_CASE(copy_constructor_test) { +TEST(URITest, copy_constructor_test) { uri::uri instance("http://www.example.com/"); uri::uri copy = instance; - BOOST_CHECK_EQUAL(instance, copy); + EXPECT_EQ(instance, copy); } -BOOST_AUTO_TEST_CASE(assignment_test) { +TEST(URITest, assignment_test) { uri::uri instance("http://www.example.com/"); uri::uri copy; copy = instance; - BOOST_CHECK_EQUAL(instance, copy); + EXPECT_EQ(instance, copy); } -BOOST_AUTO_TEST_CASE(swap_test) { +TEST(URITest, swap_test) { uri::uri instance("http://www.example.com/"); uri::uri copy("http://www.example.org/"); uri::swap(instance, copy); - BOOST_CHECK_EQUAL(instance.string(), "http://www.example.org/"); - BOOST_CHECK_EQUAL(copy.string(), "http://www.example.com/"); + EXPECT_EQ("http://www.example.org/", instance.string()); + EXPECT_EQ("http://www.example.com/", copy.string()); } -BOOST_AUTO_TEST_CASE(equality_test) { +TEST(URITest, equality_test) { uri::uri uri_1("http://www.example.com/"); uri::uri uri_2("http://www.example.com/"); - BOOST_CHECK(uri_1 == uri_2); + EXPECT_TRUE(uri_1 == uri_2); } -BOOST_AUTO_TEST_CASE(equality_test_1) { +TEST(URITest, equality_test_1) { uri::uri uri_1("http://www.example.com/"); std::string uri_2("http://www.example.com/"); - BOOST_CHECK(uri_1 == uri_2); + EXPECT_TRUE(uri_1 == uri_2); } -BOOST_AUTO_TEST_CASE(equality_test_2) { +TEST(URITest, equality_test_2) { std::string uri_1("http://www.example.com/"); uri::uri uri_2("http://www.example.com/"); - BOOST_CHECK(uri_1 == uri_2); + EXPECT_TRUE(uri_1 == uri_2); } -BOOST_AUTO_TEST_CASE(equality_test_3) { +TEST(URITest, equality_test_3) { uri::uri uri_1("http://www.example.com/"); std::string uri_2("http://www.example.com/"); - BOOST_CHECK(uri_1 == uri_2.c_str()); + EXPECT_TRUE(uri_1 == uri_2.c_str()); } -BOOST_AUTO_TEST_CASE(equality_test_4) { +TEST(URITest, equality_test_4) { std::string uri_1("http://www.example.com/"); uri::uri uri_2("http://www.example.com/"); - BOOST_CHECK(uri_1.c_str() == uri_2); + EXPECT_TRUE(uri_1.c_str() == uri_2); } -BOOST_AUTO_TEST_CASE(inequality_test) { +TEST(URITest, inequality_test) { uri::uri uri_1("http://www.example.com/"); uri::uri uri_2("http://www.example.com/"); - BOOST_CHECK(!(uri_1 != uri_2)); + EXPECT_TRUE(!(uri_1 != uri_2)); } -BOOST_AUTO_TEST_CASE(less_than_test) { +TEST(URITest, less_than_test) { // uri_1 is lexicographically less than uri_2 uri::uri uri_1("http://www.example.com/"); uri::uri uri_2("http://www.example.org/"); - BOOST_CHECK(uri_1 < uri_2); + EXPECT_TRUE(uri_1 < uri_2); } -BOOST_AUTO_TEST_CASE(username_test) { +TEST(URITest, username_test) { uri::uri instance("ftp://john.doe@ftp.example.com/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::username(instance), "john.doe"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("john.doe", uri::username(instance)); } -BOOST_AUTO_TEST_CASE(pasword_test) { +TEST(URITest, pasword_test) { uri::uri instance("ftp://john.doe:password@ftp.example.com/"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::password(instance), "password"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("password", uri::password(instance)); } -BOOST_AUTO_TEST_CASE(hierarchical_part_test) { +TEST(URITest, hierarchical_part_test) { uri::uri instance( "http://user:password@www.example.com:80/path?query#fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::hierarchical_part(instance), - "user:password@www.example.com:80/path"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("user:password@www.example.com:80/path", uri::hierarchical_part(instance)); } -BOOST_AUTO_TEST_CASE(partial_hierarchical_part_test) { +TEST(URITest, partial_hierarchical_part_test) { uri::uri instance("http://www.example.com?query#fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::hierarchical_part(instance), "www.example.com"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("www.example.com", uri::hierarchical_part(instance)); } -BOOST_AUTO_TEST_CASE(authority_test) { +TEST(URITest, authority_test) { uri::uri instance( "http://user:password@www.example.com:80/path?query#fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::authority(instance), - "user:password@www.example.com:80"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("user:password@www.example.com:80", uri::authority(instance)); } -BOOST_AUTO_TEST_CASE(partial_authority_test) { +TEST(URITest, partial_authority_test) { uri::uri instance("http://www.example.com/path?query#fragment"); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK_EQUAL(uri::authority(instance), "www.example.com"); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_EQ("www.example.com", uri::authority(instance)); } -BOOST_AUTO_TEST_CASE(http_query_map_test) { +TEST(URITest, http_query_map_test) { uri::uri instance( "http://user:password@www.example.com:80/path?query=something#fragment"); - BOOST_REQUIRE(uri::valid(instance)); + ASSERT_TRUE(uri::valid(instance)); std::map queries; uri::query_map(instance, queries); - BOOST_REQUIRE_EQUAL(queries.size(), std::size_t(1)); - BOOST_CHECK_EQUAL(queries.begin()->first, "query"); - BOOST_CHECK_EQUAL(queries.begin()->second, "something"); + ASSERT_EQ(queries.size(), std::size_t(1)); + EXPECT_EQ("query", queries.begin()->first); + EXPECT_EQ("something", queries.begin()->second); } -BOOST_AUTO_TEST_CASE(xmpp_query_map_test) { +TEST(URITest, xmpp_query_map_test) { uri::uri instance( "xmpp:example-node@example.com?message;subject=Hello%20World"); - BOOST_REQUIRE(uri::valid(instance)); + ASSERT_TRUE(uri::valid(instance)); std::map queries; uri::query_map(instance, queries); - BOOST_REQUIRE_EQUAL(queries.size(), std::size_t(2)); - BOOST_CHECK_EQUAL(queries.begin()->first, "message"); - BOOST_CHECK_EQUAL(queries.begin()->second, ""); - BOOST_CHECK_EQUAL((++queries.begin())->first, "subject"); - BOOST_CHECK_EQUAL((++queries.begin())->second, "Hello%20World"); + ASSERT_EQ(queries.size(), std::size_t(2)); + EXPECT_EQ("message", queries.begin()->first); + EXPECT_EQ("", queries.begin()->second); + EXPECT_EQ("subject", (++queries.begin())->first); + EXPECT_EQ("Hello%20World", (++queries.begin())->second); } -BOOST_AUTO_TEST_CASE(range_test) { +TEST(URITest, range_test) { const std::string url("http://www.example.com/"); uri::uri instance(url); - BOOST_REQUIRE(uri::valid(instance)); - BOOST_CHECK(boost::equal(instance, url)); + ASSERT_TRUE(uri::valid(instance)); + EXPECT_TRUE(boost::equal(instance, url)); } -BOOST_AUTO_TEST_CASE(issue_67_test) { +TEST(URITest, issue_67_test) { // https://github.com/cpp-netlib/cpp-netlib/issues/67 const std::string site_name("http://www.google.com"); uri::uri bar0; uri::uri bar1 = site_name; bar0 = site_name; - BOOST_CHECK(uri::is_valid(bar0)); - BOOST_CHECK(uri::is_valid(bar1)); + EXPECT_TRUE(uri::is_valid(bar0)); + EXPECT_TRUE(uri::is_valid(bar1)); } -BOOST_AUTO_TEST_CASE(from_parts_1) { - BOOST_CHECK_EQUAL(uri::uri("http://www.example.com/path?query#fragment"), +TEST(URITest, from_parts_1) { + EXPECT_EQ(uri::uri("http://www.example.com/path?query#fragment"), uri::from_parts(uri::uri("http://www.example.com"), "/path", "query", "fragment")); } -BOOST_AUTO_TEST_CASE(from_parts_2) { - BOOST_CHECK_EQUAL( +TEST(URITest, from_parts_2) { + EXPECT_EQ( uri::uri("http://www.example.com/path?query#fragment"), uri::from_parts("http://www.example.com", "/path", "query", "fragment")); } -BOOST_AUTO_TEST_CASE(from_parts_3) { - BOOST_CHECK_EQUAL( +TEST(URITest, from_parts_3) { + EXPECT_EQ( uri::uri("http://www.example.com/path?query"), uri::from_parts("http://www.example.com", "/path", "query")); } -BOOST_AUTO_TEST_CASE(from_parts_4) { - BOOST_CHECK_EQUAL(uri::uri("http://www.example.com/path"), +TEST(URITest, from_parts_4) { + EXPECT_EQ(uri::uri("http://www.example.com/path"), uri::from_parts("http://www.example.com", "/path")); } -BOOST_AUTO_TEST_CASE(from_file) { +TEST(URITest, from_file) { boost::filesystem::path path("/a/path/to/a/file.txt"); - BOOST_CHECK_EQUAL(uri::uri("file:///a/path/to/a/file.txt"), + EXPECT_EQ(uri::uri("file:///a/path/to/a/file.txt"), uri::from_file(path)); } -BOOST_AUTO_TEST_CASE(issue_104_test) { +TEST(URITest, issue_104_test) { // https://github.com/cpp-netlib/cpp-netlib/issues/104 boost::scoped_ptr instance(new uri::uri("http://www.example.com/")); uri::uri copy = *instance; instance.reset(); - BOOST_CHECK_EQUAL(uri::scheme(copy), "http"); + EXPECT_EQ("http", uri::scheme(copy)); } -BOOST_AUTO_TEST_CASE(uri_set_test) { +TEST(URITest, uri_set_test) { std::set uri_set; uri_set.insert(uri::uri("http://www.example.com/")); - BOOST_REQUIRE(!uri_set.empty()); - BOOST_CHECK_EQUAL((*uri_set.begin()), uri::uri("http://www.example.com/")); + ASSERT_TRUE(!uri_set.empty()); + EXPECT_EQ(uri::uri("http://www.example.com/"), (*uri_set.begin())); } -BOOST_AUTO_TEST_CASE(uri_unordered_set_test) { +TEST(URITest, uri_unordered_set_test) { boost::unordered_set uri_set; uri_set.insert(uri::uri("http://www.example.com/")); - BOOST_REQUIRE(!uri_set.empty()); - BOOST_CHECK_EQUAL((*uri_set.begin()), uri::uri("http://www.example.com/")); + ASSERT_TRUE(!uri_set.empty()); + EXPECT_EQ(uri::uri("http://www.example.com/"), (*uri_set.begin())); } -BOOST_AUTO_TEST_CASE(issue_161_test) { +TEST(URITest, issue_161_test) { uri::uri instance( "http://www.example.com/" "path?param1=-¶m2=some+plus+encoded+text¶m3=~"); - BOOST_REQUIRE(uri::valid(instance)); + ASSERT_TRUE(uri::valid(instance)); std::map queries; uri::query_map(instance, queries); - BOOST_REQUIRE_EQUAL(queries.size(), std::size_t(3)); - BOOST_CHECK_EQUAL(queries["param1"], "-"); - BOOST_CHECK_EQUAL(queries["param2"], "some+plus+encoded+text"); - BOOST_CHECK_EQUAL(queries["param3"], "~"); - BOOST_CHECK_EQUAL(uri::decoded(queries["param2"]), "some plus encoded text"); + ASSERT_EQ(3, queries.size()); + EXPECT_EQ("-", queries["param1"]); + EXPECT_EQ("some+plus+encoded+text", queries["param2"]); + EXPECT_EQ("~", queries["param3"]); + EXPECT_EQ("some plus encoded text", uri::decoded(queries["param2"])); } -BOOST_AUTO_TEST_CASE(issue_364_test) { +TEST(URITest, issue_364_test) { uri::uri instance; uri::schemes::http(instance) << uri::host("my.awesome.server.com"); - BOOST_CHECK_EQUAL("my.awesome.server.com", uri::authority(instance)); + EXPECT_EQ("my.awesome.server.com", uri::authority(instance)); } -BOOST_AUTO_TEST_CASE(issue_447_test) { +TEST(URITest, issue_447_test) { uri::uri instance("http://[www.foo.com/"); - BOOST_REQUIRE(!uri::valid(instance)); + ASSERT_TRUE(!uri::valid(instance)); } -BOOST_AUTO_TEST_CASE(issue_499_test) { +TEST(URITest, issue_499_test) { uri::uri instance( "http://www.example.com/path?param1¶m2=¶m3=value"); - BOOST_REQUIRE(uri::valid(instance)); + ASSERT_TRUE(uri::valid(instance)); std::map queries; uri::query_map(instance, queries); - BOOST_REQUIRE_EQUAL(queries.size(), std::size_t(3)); - BOOST_CHECK_EQUAL(queries["param1"], ""); - BOOST_CHECK_EQUAL(queries["param2"], ""); - BOOST_CHECK_EQUAL(queries["param3"], "value"); + ASSERT_EQ(3, queries.size()); + EXPECT_EQ("", queries["param1"]); + EXPECT_EQ("", queries["param2"]); + EXPECT_EQ("value", queries["param3"]); } From 550adae5e73506e42c599f81435fa55d76055561 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Thu, 7 Jan 2016 21:41:23 +1100 Subject: [PATCH 056/123] Revert to CMake 2.8 --- CMakeLists.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7052ac1e7..37746106a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,10 @@ -# Copyright (c) Dean Michael Berris 2010. +# Copyright (c) Dean Michael Berris 2010. +# Copyright 2016 Google, Inc. # 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) +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 2.8) project(CPP-NETLIB) option( CPP-NETLIB_BUILD_SHARED_LIBS "Build cpp-netlib as shared libraries." OFF ) From 86146c3f4fd8f75dbf68998b21265d0140d3de9a Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Sun, 10 Jan 2016 02:02:32 +1100 Subject: [PATCH 057/123] Doxygen+Sphinx+Breathe = Inline Documentation This is the initial attempt at getting inline documentation in the project implementation into the sphinx-generated documentation. The way we achieve this is by doing the following: - Add michaeljones/breathe as a submodule, making it simpler to generate the documentation with just Sphinx installed on the developer machine. - Define a Doxyfile configuration which generates HTML and XML documentation. The generated XML files are needed by Breathe to generate the HTML as part of the Sphinx docs generation process. - Update the documentation for the client type. This is a starting point showing how the generated docs are in-lined in the RST docs via breathe. - Wire up the documentation generation in the Sphinx configuration. To generate the documentation now, we need two things installed on the machine generating the docs: Sphinx and Doxygen. The steps involved are: 1. cd cpp-netlib && doxygen 2. cd libs/network/doc/ && make html The results should be in libs/network/doc/_build/html, and the generated HTML for the HTTP Client reference page should include the doxygen-generated docs. --- .gitignore | 2 + .gitmodules | 3 + Doxyfile | 2384 +++++++++++++++++ boost/network/protocol/http/client.hpp | 39 +- boost/network/protocol/http/client/facade.hpp | 179 +- .../network/protocol/http/client/options.hpp | 3 +- boost/network/protocol/http/client/pimpl.hpp | 2 +- libs/network/doc/_ext/breathe | 1 + libs/network/doc/conf.py | 14 +- libs/network/doc/reference/http_client.rst | 18 + 10 files changed, 2611 insertions(+), 34 deletions(-) create mode 100644 Doxyfile create mode 160000 libs/network/doc/_ext/breathe diff --git a/.gitignore b/.gitignore index 5781679f5..e6d440e03 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ libs/mime/test/mime-roundtrip _build /.project build/ +libs/network/doc/doxygen/ +.DS_Store diff --git a/.gitmodules b/.gitmodules index c65b6b312..67c959090 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "deps/googlemock"] path = deps/googlemock url = https://github.com/google/googlemock.git +[submodule "libs/network/doc/_ext/breathe"] + path = libs/network/doc/_ext/breathe + url = https://github.com/michaeljones/breathe.git diff --git a/Doxyfile b/Doxyfile new file mode 100644 index 000000000..008562384 --- /dev/null +++ b/Doxyfile @@ -0,0 +1,2384 @@ +# Doxyfile 1.8.10 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv +# for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = cppnetlib + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "Modern C++ network programming libraries." + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = "libs/network/doc/doxygen" + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = YES + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 2 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: +# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: +# Fortran. In the later case the parser tries to guess whether the code is fixed +# or free formatted code, this is the default for Fortran type files), VHDL. For +# instance to make doxygen treat .inc files as Fortran files (default is PHP), +# and .f files as C (default is Fortran), use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = YES + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO, these declarations will be +# included in the documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES, upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +INPUT = boost/ + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, +# *.vhdl, *.ucf, *.qsf, *.as and *.js. + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# function all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see http://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = NO + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the master .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- +# folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# http://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from http://www.mathjax.org before deployment. +# The default value is: http://cdn.mathjax.org/mathjax/latest. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /