-
Notifications
You must be signed in to change notification settings - Fork 11
Update cpp-netlib to the latest (540ed7622be3f9534709036522f86bde1e84829f). #78
Conversation
bmoyles0117
left a comment
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.
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.
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.
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this being set to delete?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) { ?
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.
And here.
| // 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra spaces at the beginning and end of the invocation. Are these intentional?
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.
And here.
| } | ||
| } | ||
| // TODO set the destination value somewhere! | ||
| // TODO(dberris): set the destination value somewhere! |
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.
Is dberris actually going to help here? If not, can we assign the todo to someone who will?
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.
And here.
igorpeshansky
left a comment
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here.
| } | ||
| } | ||
| // TODO set the destination value somewhere! | ||
| // TODO(dberris): set the destination value somewhere! |
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.
And here.
| int timeout_; | ||
| boost::asio::deadline_timer timer_; | ||
| int64_t timeout_; | ||
| bool remove_chunk_markers_; |
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.
And here.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hpp -> ipp
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.
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.
Choose a reason for hiding this comment
The 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"
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Since all names start with local_ it sounded like they were all copies.
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The 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.
| @@ -1,6 +1,10 @@ | |||
| #ifndef BOOST_NETWORK_PROTOCOL_HTTP_IMPL_LOCAL_ASYNC_CONNECTION_BASE_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.
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. |
supriyagarg
left a comment
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.
LGTM
igorpeshansky
left a comment
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. local_ refers to "local sockets" (a.k.a., Unix domain sockets), rather than a "local copy".
bmoyles0117
left a comment
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.
LGTM
No description provided.