Skip to content

Commit d4ebe01

Browse files
committed
I made some changes to the code to make sure that everything compiles on MSVC 2010 (using C++11 features). Not all HTTP tests run successfully on Windows.
1 parent bc2fbde commit d4ebe01

File tree

8 files changed

+15
-6
lines changed

8 files changed

+15
-6
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 2.8)
77
project(CPP-NETLIB)
88
set(Boost_USE_STATIC_LIBS ON)
99
set(Boost_USE_MULTI_THREADED ON)
10-
find_package( Boost 1.45.0 REQUIRED unit_test_framework system regex date_time thread filesystem program_options )
10+
find_package( Boost 1.45.0 REQUIRED unit_test_framework system regex date_time thread chrono filesystem program_options )
1111
find_package( OpenSSL )
1212
find_package( Threads )
1313
set(CMAKE_VERBOSE_MAKEFILE true)

boost/network/protocol/http/algorithms/linearize.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,8 @@ namespace boost { namespace network { namespace http {
151151
boost::copy(crlf, oi);
152152
}
153153
boost::copy(crlf, oi);
154-
boost::iterator_range<std::string::const_iterator> body_data =
155-
boost::network::body(request);
156-
return boost::copy(body_data, oi);
154+
auto body_data = boost::network::body(request);
155+
return std::copy(body_data.begin(), body_data.end(), oi);
157156
}
158157

159158
} /* http */

boost/network/protocol/http/client/client_connection.ipp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ client_connection * client_connection::clone() const {
2222
BOOST_NETWORK_MESSAGE("client_connection::clone()");
2323
// For exposition only.
2424
BOOST_ASSERT(false && "This should not ever be called.");
25+
return 0;
2526
}
2627

2728

boost/network/protocol/http/message/wrappers/status_message.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// (See accompanying file LICENSE_1_0.txt or copy at
88
// http://www.boost.org/LICENSE_1_0.txt)
99

10+
#include <boost/optional.hpp>
1011
#include <boost/network/protocol/http/response/response_base.hpp>
1112

1213
namespace boost { namespace network { namespace http {

boost/network/protocol/http/message/wrappers/version.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// (See accompanying file LICENSE_1_0.txt or copy at
99
// http://www.boost.org/LICENSE_1_0.txt)
1010

11+
#include <boost/optional.hpp>
1112
#include <boost/network/protocol/http/response/response_base.hpp>
1213

1314
namespace boost { namespace network { namespace http {

boost/network/protocol/http/server/connection/async.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <boost/thread/locks.hpp>
3030
#include <boost/thread/recursive_mutex.hpp>
3131
#include <boost/utility/enable_if.hpp>
32+
#include <boost/enable_shared_from_this.hpp>
3233
#include <list>
3334
#include <vector>
3435
#include <iterator>

boost/network/protocol/http/server/connection/sync.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,10 @@ class sync_server_connection : public boost::enable_shared_from_this<sync_server
282282
<< constants::crlf();
283283
segmented_write(status_line.str());
284284
std::ostringstream header_stream;
285-
for (auto const &header : headers) {
285+
auto it = std::begin(headers), end = std::end(headers);
286+
for (; it != end; ++it) {
287+
const auto &header = *it;
288+
//for (auto const &header : headers) {
286289
header_stream << header.first << constants::colon() << constants::space()
287290
<< header.second << constants::crlf();
288291
}
@@ -293,7 +296,7 @@ class sync_server_connection : public boost::enable_shared_from_this<sync_server
293296
buffer_type buffer;
294297
response_.get_body([&done, &buffer](iterator_range<char const *> data) {
295298
if (boost::empty(data)) done = true;
296-
else std::copy(begin(data), end(data), buffer.begin());
299+
else std::copy(std::begin(data), std::end(data), buffer.begin());
297300
}, buffer.size());
298301
if (!done) output_buffers_.emplace_back(std::move(buffer));
299302
}

libs/network/example/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@ add_executable(hello_world_client http/hello_world_client.cpp)
2323
set(BOOST_CLIENT_LIBS
2424
${Boost_PROGRAM_OPTIONS_LIBRARY}
2525
${Boost_THREAD_LIBRARY}
26+
${Boost_CHRONO_LIBRARY}
2627
${Boost_DATE_TIME_LIBRARY}
2728
${Boost_REGEX_LIBRARY}
29+
${Boost_FILESYSTEM_LIBRARY}
2830
${Boost_SYSTEM_LIBRARY})
2931

3032
set(BOOST_SERVER_LIBS
3133
${Boost_THREAD_LIBRARY}
34+
${Boost_CHRONO_LIBRARY}
3235
${Boost_SYSTEM_LIBRARY}
3336
${Boost_DATE_TIME_LIBRARY}
3437
${Boost_PROGRAM_OPTIONS_LIBRARY})

0 commit comments

Comments
 (0)