Update cpp-netlib to the latest (540ed7622be3f9534709036522f86bde1e84829f).#78
Update cpp-netlib to the latest (540ed7622be3f9534709036522f86bde1e84829f).#78igorpeshansky merged 8 commits intomasterfrom
Conversation
bmoyles0117
left a comment
There was a problem hiding this comment.
A lot to chew on here. Is there a way of compartmentalizing the changes between the changes in the server implementation, and the change in the watch implementation? The server implementation updates are nice and easy to digest.
| else { | ||
| //LOG(ERROR) << "async_resolve() " << o->query_.host_name(); | ||
| std::string path = boost::network::uri::decoded(o->query_.host_name()); | ||
| std::string path = ::network::detail::decode(o->query_.host_name()); |
There was a problem hiding this comment.
Nooby question, can you point me to docs that explain the :: prefix?
There was a problem hiding this comment.
| boost::enable_shared_from_this< | ||
| std::enable_shared_from_this< | ||
| http_async_connection<Tag, version_major, version_minor> > { | ||
| http_async_connection(http_async_connection const&) = delete; |
There was a problem hiding this comment.
Why is this being set to delete?
There was a problem hiding this comment.
This file is effectively a copy of boost/network/protocol/http/client/connection/async_normal.hpp -- I just pulled in the changes from the original. Let me move such changes out into a separate commit, for ease of reviewing. Stay tuned.
| int timeout_; | ||
| boost::asio::deadline_timer timer_; | ||
| int64_t timeout_; | ||
| bool remove_chunk_markers_; |
There was a problem hiding this comment.
I'm not sure how much value this flag provides. Can you expand on why you're using it, instead of just leaving the conditional checks as if (this->is_chunk_encoding) { ?
| // 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(""); | ||
| if ( callback ) |
There was a problem hiding this comment.
Remove extra spacing around callback? Also, this is the first time I've noticed a single condition if without using the braces. If the readability guidelines are "choose what's best for you" around this, can we keep the braces? Single line conditionals have burned me so many times in the past.
There was a problem hiding this comment.
Ditto here -- this is copied from boost/network/protocol/http/client/connection/async_normal.hpp.
| // body (in the case of a HEAD request). | ||
| this->body_promise.set_value(""); | ||
| if ( callback ) | ||
| callback( boost::iterator_range<typename std::array<typename char_<Tag>::type, 1024>::const_iterator>(), boost::asio::error::eof ); |
There was a problem hiding this comment.
Extra spaces at the beginning and end of the invocation. Are these intentional?
| } | ||
| } | ||
| // TODO set the destination value somewhere! | ||
| // TODO(dberris): set the destination value somewhere! |
There was a problem hiding this comment.
Is dberris actually going to help here? If not, can we assign the todo to someone who will?
igorpeshansky
left a comment
There was a problem hiding this comment.
Sorry, realized that the context of these "copy-to-specialize" hacks keeps getting lost over time. I'll pull those out into a separate commit to help in reviewing. Will ping this PR when it's ready again.
| else { | ||
| //LOG(ERROR) << "async_resolve() " << o->query_.host_name(); | ||
| std::string path = boost::network::uri::decoded(o->query_.host_name()); | ||
| std::string path = ::network::detail::decode(o->query_.host_name()); |
There was a problem hiding this comment.
| boost::enable_shared_from_this< | ||
| std::enable_shared_from_this< | ||
| http_async_connection<Tag, version_major, version_minor> > { | ||
| http_async_connection(http_async_connection const&) = delete; |
There was a problem hiding this comment.
This file is effectively a copy of boost/network/protocol/http/client/connection/async_normal.hpp -- I just pulled in the changes from the original. Let me move such changes out into a separate commit, for ease of reviewing. Stay tuned.
| // 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(""); | ||
| if ( callback ) |
There was a problem hiding this comment.
Ditto here -- this is copied from boost/network/protocol/http/client/connection/async_normal.hpp.
| // body (in the case of a HEAD request). | ||
| this->body_promise.set_value(""); | ||
| if ( callback ) | ||
| callback( boost::iterator_range<typename std::array<typename char_<Tag>::type, 1024>::const_iterator>(), boost::asio::error::eof ); |
| } | ||
| } | ||
| // TODO set the destination value somewhere! | ||
| // TODO(dberris): set the destination value somewhere! |
| int timeout_; | ||
| boost::asio::deadline_timer timer_; | ||
| int64_t timeout_; | ||
| bool remove_chunk_markers_; |
2d72119 to
e89a162
Compare
e89a162 to
f9b63f3
Compare
|
Ok, I've just split out the commit to change the replicas (as well as added comments to ensure this relationship is documented). PTAL. |
| http::client client( | ||
| http::client::options().openssl_certificate(SecretPath("ca.crt"))); | ||
| http::client::options() | ||
| .remove_chunk_markers(false) |
There was a problem hiding this comment.
why is remove_chunk_markers set to false here?
| #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, |
There was a problem hiding this comment.
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.
| @@ -1,6 +1,10 @@ | |||
| #ifndef BOOST_NETWORK_PROTOCOL_HTTP_IMPL_LOCAL_ASYNC_CONNECTION_BASE_20170307 | |||
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I see. Since all names start with local_ it sounded like they were all copies.
There was a problem hiding this comment.
Yeah. local_ refers to "local sockets" (a.k.a., Unix domain sockets), rather than a "local copy".
igorpeshansky
left a comment
There was a problem hiding this comment.
@supriyagarg I couldn't respond to your comment in kubernetes.cc because you asked the question on a stale commit. We set remove_chunk_markers to false in WatchMaster because we currently have our own chunked encoding parser. I intend to remove that in a future PR and use the built-in functionality.
PTAL.
| #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, |
There was a problem hiding this comment.
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.
| @@ -1,6 +1,10 @@ | |||
| #ifndef BOOST_NETWORK_PROTOCOL_HTTP_IMPL_LOCAL_ASYNC_CONNECTION_BASE_20170307 | |||
There was a problem hiding this comment.
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.
|
Updated to incorporate the latest fixes. PTAL. |
igorpeshansky
left a comment
There was a problem hiding this comment.
Thanks for the review.
| @@ -1,6 +1,10 @@ | |||
| #ifndef BOOST_NETWORK_PROTOCOL_HTTP_IMPL_LOCAL_ASYNC_CONNECTION_BASE_20170307 | |||
There was a problem hiding this comment.
Yeah. local_ refers to "local sockets" (a.k.a., Unix domain sockets), rather than a "local copy".
No description provided.