Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a370594
Run clang-tidy with all checks.
deanberris Oct 28, 2015
44bd36b
Manual changes to update style and fix breakages
deanberris Oct 28, 2015
5f6e9ee
Changes to make things build
deanberris Oct 31, 2015
7b88a41
Reintroduce missing code for parsing query maps
deanberris Oct 31, 2015
6349c11
clang-tidy modernize-.* all the things
deanberris Nov 2, 2015
6d8879c
Upgrade travis config
deanberris Nov 2, 2015
65a0e6e
Fix typo in URL
deanberris Nov 2, 2015
feec209
Fix another typo on the URL.
deanberris Nov 2, 2015
4847865
Make travis wait for a Boost build to finish
deanberris Nov 2, 2015
e19af74
Change level of travis_wait call; chmod +x .sh files
deanberris Nov 2, 2015
abe68b4
Only support Boost 1.59 for now.
deanberris Nov 2, 2015
b10dfbb
Only produce shared+multithreaded debug & release boost libs
deanberris Nov 2, 2015
8cb4c16
Looks like we need static libs too
deanberris Nov 2, 2015
198dd07
Integrate travis; Use Boost 1.57 at least; Always use shared libs fro…
deanberris Nov 2, 2015
f6c7ee6
Use the dynamic version of Boost.Test always.
deanberris Nov 2, 2015
de7c710
Use v4 again instead of just address
deanberris Nov 4, 2015
39a2705
v4() for real this time
deanberris Nov 4, 2015
2e3340f
Change test to fetch different targets
deanberris Nov 12, 2015
7e0f93e
Simplify http test
deanberris Nov 12, 2015
552401b
Use ninja-build
deanberris Nov 12, 2015
19beafb
Update cmake
deanberris Nov 12, 2015
99f6168
Use updated cmake to support ninja-build
deanberris Nov 12, 2015
937d589
Travis cannot handle ninja builds yet, probably to lack of resources …
deanberris Nov 12, 2015
d5ec24e
j4 is too much. :(
deanberris Nov 12, 2015
d661fcc
Check with the sanitizers
deanberris Nov 12, 2015
5751338
Honor the CMAKE_CXX_FLAGS environment variable
deanberris Nov 12, 2015
511dd04
Print latest log properly
deanberris Nov 12, 2015
9fbc300
Fix some issues with the (deprecated) synchronous client implementati…
deanberris Nov 16, 2015
2f2239c
Only use libc++ if in OS X
deanberris Nov 16, 2015
4be4eae
Issue identified with memory sanitizer
deanberris Nov 16, 2015
600daff
Fix unsafe usage of boost::as_literal, caught by memory sanitiser
deanberris Nov 16, 2015
03870ca
Force use of size_t in distance calculation
deanberris Nov 16, 2015
9bad07c
Removing noexcept from defaulted move constructor
deanberris Nov 18, 2015
2f2c021
Track origins for memsan runs
deanberris Nov 18, 2015
7f70dac
Exclude msan builds from g++
deanberris Nov 18, 2015
8a8279a
Do not use msan yet; Boost seems to be not msan-clean
deanberris Nov 18, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change test to fetch different targets
  • Loading branch information
deanberris committed Nov 12, 2015
commit 2e3340f07d3c86b32719173db0ea6b00e262c9a9
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ libs/mime/test/mime-roundtrip
*.a
_build
/.project
build/
42 changes: 19 additions & 23 deletions boost/mime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
#ifndef _BOOST_MIME_HPP
#define _BOOST_MIME_HPP

#include <iosfwd>
#include <list>
#include <string>
#include <vector>
#include <iosfwd>

#include <boost/spirit/include/qi.hpp>
#include <boost/fusion/adapted/struct.hpp>
#include <boost/fusion/include/std_pair.hpp>
#include <boost/spirit/include/phoenix.hpp> // pulls in all of Phoenix
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/support_istream_iterator.hpp>
#include <boost/fusion/adapted/struct.hpp>

#include <boost/shared_ptr.hpp>
#include <boost/format.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/format.hpp>
#include <boost/shared_ptr.hpp>

// #define DUMP_MIME_DATA 1

Expand Down Expand Up @@ -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<char>(std::cout));
Expand Down Expand Up @@ -381,11 +382,7 @@ static boost::shared_ptr<basic_mime<traits> > parse_mime(
template <class traits = detail::default_types>
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<std::string, string_type> headerEntry;
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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)
Expand All @@ -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()));
}
}
Expand Down Expand Up @@ -764,12 +758,14 @@ static boost::shared_ptr<basic_mime<traits> > 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<typename mime_part::bodyContainer,
Iterator>(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
Expand Down
10 changes: 5 additions & 5 deletions boost/network/protocol/http/client/async_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ struct async_client
async_client(bool cache_resolved, bool follow_redirect,
bool always_verify_peer, int timeout,
boost::shared_ptr<boost::asio::io_service> service,
optional<string_type> certificate_filename,
optional<string_type> verify_path,
optional<string_type> certificate_file,
optional<string_type> private_key_file,
optional<string_type> ciphers, long ssl_options)
optional<string_type> certificate_filename,
optional<string_type> verify_path,
optional<string_type> certificate_file,
optional<string_type> private_key_file,
optional<string_type> ciphers, long ssl_options)
: connection_base(cache_resolved, follow_redirect, timeout),
service_ptr(service.get()
? service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ struct http_async_connection
protected http_async_protocol_handler<Tag, version_major, version_minor>,
boost::enable_shared_from_this<
http_async_connection<Tag, version_major, version_minor> > {

http_async_connection(http_async_connection const&) = delete;

typedef async_connection_base<Tag, version_major, version_minor> base;
typedef http_async_protocol_handler<Tag, version_major, version_minor>
protocol_base;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
12 changes: 7 additions & 5 deletions boost/network/protocol/http/client/connection/sync_normal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <boost/asio/deadline_timer.hpp>
#include <boost/network/protocol/http/algorithms/linearize.hpp>
#include <boost/network/protocol/http/response.hpp>
#include <boost/network/protocol/http/traits/resolver_policy.hpp>
#include <boost/network/traits/string.hpp>
#include <iterator>

#include <boost/asio/deadline_timer.hpp>

namespace boost {
namespace network {
namespace http {
Expand Down Expand Up @@ -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<Tag> const& request_,
body_generator_function_type generator) {
boost::asio::streambuf request_buffer;
Expand Down Expand Up @@ -130,7 +132,7 @@ struct http_sync_connection
};

} // namespace impl
} // namespace http
} // namespace http
} // namespace network
} // namespace boost

Expand Down
28 changes: 18 additions & 10 deletions libs/network/test/http/client_get_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<typename client::response>::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<typename client::response>::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
Expand Down