-
Notifications
You must be signed in to change notification settings - Fork 11
Update cpp-netlib to the latest (540ed7622be3f9534709036522f86bde1e84829f). #78
Changes from all commits
cc0eac6
b418949
e2450d2
a69fe53
e108693
f9b63f3
c528649
d6ef6a3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,10 @@ | ||
| #ifndef BOOST_NETWORK_PROTOCOL_HTTP_IMPL_LOCAL_ASYNC_CONNECTION_BASE_20170307 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this commit only comments on 6 out of the 10 files under src/http. Please add the provenance comments to the remaining 4 files, including "src/http/traits/local_resolver.hpp"
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The files that don't have the comments aren't replicas -- they are complete reimplementations that don't share enough code with the originals. The reason these files needed to be copied is because they weren't designed to be specialized -- I'll fix that upstream in a separate refactoring.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. Since all names start with
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah. |
||
| #define BOOST_NETWORK_PROTOCOL_HTTP_IMPL_LOCAL_ASYNC_CONNECTION_BASE_20170307 | ||
|
|
||
| // Note: This file is mostly a copy of | ||
| // boost/network/protocol/http/client/connection/async_base.hpp, | ||
| // except for the specialized bits. | ||
|
|
||
| // Copyright 2017 Igor Peshansky (igorp@google.com). | ||
| // Copyright 2013-2017 Google, Inc. | ||
| // Copyright 2010 Dean Michael Berris <dberris@google.com> | ||
|
|
@@ -9,18 +13,18 @@ | |
| // (See accompanying file LICENSE_1_0.txt or copy at | ||
| // http://www.boost.org/LICENSE_1_0.txt) | ||
|
|
||
| #include <boost/network/traits/string.hpp> | ||
| #include <boost/network/protocol/http/response.hpp> | ||
| #include <boost/network/protocol/http/traits/delegate_factory.hpp> | ||
| #include "traits/local_resolver.hpp" | ||
| #include <boost/network/protocol/http/traits/resolver_policy.hpp> | ||
| #include <boost/network/traits/string.hpp> | ||
|
|
||
| namespace boost { | ||
| namespace network { | ||
| namespace http { | ||
| namespace impl { | ||
|
|
||
| template<class Tag, unsigned int version_major, unsigned int version_minor> | ||
| template <class Tag, unsigned version_major, unsigned version_minor> | ||
| struct async_connection_base; | ||
|
|
||
| template<class Tag, unsigned int version_major, unsigned int version_minor> | ||
|
|
@@ -32,30 +36,32 @@ struct http_async_connection; | |
|
|
||
| template<> struct async_connection_base<Tag, version_major, version_minor> { | ||
| typedef async_connection_base<Tag, version_major, version_minor> this_type; | ||
| typedef resolver_policy<Tag>::type resolver_base; | ||
| typedef resolver_base::resolver_type resolver_type; | ||
| typedef resolver_base::resolve_function resolve_function; | ||
| typedef string<Tag>::type string_type; | ||
| typedef typename resolver_policy<Tag>::type resolver_base; | ||
| typedef typename resolver_base::resolver_type resolver_type; | ||
| typedef typename resolver_base::resolve_function resolve_function; | ||
| typedef typename string<Tag>::type string_type; | ||
| typedef basic_request<Tag> request; | ||
| typedef basic_response<Tag> response; | ||
| typedef iterator_range<char const *> char_const_range; | ||
| typedef function<void(char_const_range const &, system::error_code const &)> | ||
| typedef typename std::array<typename char_<Tag>::type, 1024>::const_iterator const_iterator; | ||
| typedef iterator_range<const_iterator> char_const_range; | ||
| typedef std::function<void(char_const_range const &, boost::system::error_code const &)> | ||
| body_callback_function_type; | ||
| typedef function<bool(string_type &)> body_generator_function_type; | ||
| typedef shared_ptr<this_type> connection_ptr; | ||
| typedef std::function<bool(string_type &)> body_generator_function_type; | ||
| typedef std::shared_ptr<this_type> 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, | ||
| bool remove_chunk_markers, | ||
| optional<string_type> certificate_filename = optional<string_type>(), | ||
| optional<string_type> const &verify_path = optional<string_type>(), | ||
| optional<string_type> certificate_file = optional<string_type>(), | ||
| optional<string_type> private_key_file = optional<string_type>(), | ||
| optional<string_type> ciphers = optional<string_type>(), | ||
| optional<string_type> sni_hostname = optional<string_type>(), | ||
| long ssl_options = 0); | ||
|
|
||
| // This is the pure virtual entry-point for all asynchronous | ||
|
|
@@ -64,19 +70,16 @@ template<> struct async_connection_base<Tag, version_major, version_minor> { | |
| bool get_body, body_callback_function_type callback, | ||
| body_generator_function_type generator) = 0; | ||
|
|
||
| virtual ~async_connection_base() {} | ||
| virtual ~async_connection_base() = default; | ||
| }; | ||
|
|
||
| #undef version_minor | ||
| #undef version_major | ||
| #undef Tag | ||
|
|
||
| } // namespace impl | ||
|
|
||
| } // namespace http | ||
|
|
||
| } // namespace network | ||
|
|
||
| } // namespace boost | ||
|
|
||
| #endif // BOOST_NETWORK_PROTOCOL_HTTP_IMPL_LOCAL_ASYNC_CONNECTION_BASE_20170307 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,10 @@ | ||
| #ifndef BOOST_NETWORK_PROTOCOL_HTTP_IMPL_LOCAL_ASYNC_CONNECTION_BASE_IPP_20170307 | ||
| #define BOOST_NETWORK_PROTOCOL_HTTP_IMPL_LOCAL_ASYNC_CONNECTION_BASE_IPP_20170307 | ||
|
|
||
| // Note: This file is mostly a copy of | ||
| // boost/network/protocol/http/client/connection/async_base.hpp, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hpp -> ipp
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, hpp is correct. The upstream library only has a single file. For various linker-related reasons, we had to split out the specialized function into its own implementation file. |
||
| // except for the specialized bits. | ||
|
|
||
| // Copyright 2017 Igor Peshansky (igorp@google.com). | ||
| // Copryight 2013-2017 Google, Inc. | ||
| // Copyright 2010 Dean Michael Berris <dberris@google.com> | ||
|
|
@@ -27,23 +31,25 @@ using acb = async_connection_base<Tag, version_major, version_minor>; | |
| acb::connection_ptr acb::new_connection( | ||
| acb::resolve_function resolve, acb::resolver_type &resolver, | ||
| bool follow_redirect, bool always_verify_peer, bool https, int timeout, | ||
| bool remove_chunk_markers, | ||
| optional<acb::string_type> certificate_filename, | ||
| optional<acb::string_type> const &verify_path, | ||
| optional<acb::string_type> certificate_file, | ||
| optional<acb::string_type> private_key_file, | ||
| optional<acb::string_type> ciphers, | ||
| optional<string_type> sni_hostname, | ||
| long ssl_options) { | ||
| typedef http_async_connection<Tag, version_major, version_minor> | ||
| async_connection; | ||
| typedef typename delegate_factory<Tag>::type delegate_factory_type; | ||
| connection_ptr temp; | ||
| temp.reset(new async_connection( | ||
| resolver, resolve, follow_redirect, timeout, | ||
| delegate_factory_type::new_connection_delegate( | ||
| resolver.get_io_service(), https, always_verify_peer, | ||
| certificate_filename, verify_path, certificate_file, | ||
| private_key_file, ciphers, ssl_options))); | ||
| BOOST_ASSERT(temp.get() != 0); | ||
| auto delegate = delegate_factory_type::new_connection_delegate( | ||
| resolver.get_io_service(), https, always_verify_peer, | ||
| certificate_filename, verify_path, certificate_file, private_key_file, | ||
| ciphers, sni_hostname, ssl_options); | ||
| auto temp = std::make_shared<async_connection>( | ||
| resolver, resolve, follow_redirect, timeout, remove_chunk_markers, | ||
| std::move(delegate)); | ||
| BOOST_ASSERT(temp != nullptr); | ||
| return temp; | ||
| } | ||
|
|
||
|
|
@@ -52,11 +58,8 @@ acb::connection_ptr acb::new_connection( | |
| #undef Tag | ||
|
|
||
| } // namespace impl | ||
|
|
||
| } // namespace http | ||
|
|
||
| } // namespace network | ||
|
|
||
| } // namespace boost | ||
|
|
||
| #endif // BOOST_NETWORK_PROTOCOL_HTTP_IMPL_LOCAL_ASYNC_CONNECTION_BASE_IPP_20170307 | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nooby question, can you point me to docs that explain the
::prefix?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
http://en.cppreference.com/w/cpp/language/namespace#Using-declarations and http://en.cppreference.com/w/cpp/language/unqualified_lookup.