Skip to content
This repository was archived by the owner on Aug 19, 2019. It is now read-only.

Conversation

@igorpeshansky
Copy link
Contributor

No description provided.

Copy link
Contributor

@bmoyles0117 bmoyles0117 left a 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());
Copy link
Contributor

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?

Copy link
Contributor Author

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;
Copy link
Contributor

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?

Copy link
Contributor Author

@igorpeshansky igorpeshansky Mar 14, 2018

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_;
Copy link
Contributor

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) { ?

Copy link
Contributor Author

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 )
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// 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 );
Copy link
Contributor

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?

Copy link
Contributor Author

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!
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here.

Copy link
Contributor Author

@igorpeshansky igorpeshansky left a 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());
Copy link
Contributor Author

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;
Copy link
Contributor Author

@igorpeshansky igorpeshansky Mar 14, 2018

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 )
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// 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 );
Copy link
Contributor Author

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!
Copy link
Contributor Author

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_;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here.

@igorpeshansky igorpeshansky force-pushed the igorp-cpp-netlib-latest branch 2 times, most recently from 2d72119 to e89a162 Compare March 15, 2018 00:15
@igorpeshansky igorpeshansky force-pushed the igorp-cpp-netlib-latest branch from e89a162 to f9b63f3 Compare March 15, 2018 00:25
@igorpeshansky
Copy link
Contributor Author

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)
Copy link
Contributor

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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hpp -> ipp

Copy link
Contributor Author

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
Copy link
Contributor

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"

Copy link
Contributor Author

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.

Copy link
Contributor

@supriyagarg supriyagarg Mar 16, 2018

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.

Copy link
Contributor Author

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".

Copy link
Contributor Author

@igorpeshansky igorpeshansky left a 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,
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

@igorpeshansky igorpeshansky changed the title Update cpp-netlib to the latest (e80404ec3222b0bd516ea4ad475c66c7222a4350). Update cpp-netlib to the latest (540ed7622be3f9534709036522f86bde1e84829f). Mar 15, 2018
@igorpeshansky
Copy link
Contributor Author

Updated to incorporate the latest fixes. PTAL.

Copy link
Contributor

@supriyagarg supriyagarg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor Author

@igorpeshansky igorpeshansky left a 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
Copy link
Contributor Author

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".

Copy link
Contributor

@bmoyles0117 bmoyles0117 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants