Skip to content

Commit cfb1714

Browse files
committed
Finalized changes to std-ification.
1 parent d14bfe2 commit cfb1714

File tree

7 files changed

+14
-10
lines changed

7 files changed

+14
-10
lines changed

CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ else()
2424
endif()
2525
set(Boost_USE_MULTITHREADED ON)
2626
if(CPP-NETLIB_BUILD_TESTS)
27-
set(Boost_COMPONENTS unit_test_framework system regex date_time thread chrono filesystem program_options )
27+
set(Boost_COMPONENTS unit_test_framework system regex date_time filesystem program_options )
2828
else()
29-
set(Boost_COMPONENTS system regex date_time thread chrono filesystem program_options )
29+
set(Boost_COMPONENTS system regex date_time filesystem program_options )
3030
endif()
3131
find_package( Boost 1.51 REQUIRED ${Boost_COMPONENTS} )
3232
find_package( OpenSSL )

include/network/include/http/server.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#ifndef NETWORK_INCLUDE_HTTP_SERVER_HPP_
1010
#define NETWORK_INCLUDE_HTTP_SERVER_HPP_
1111

12-
#include <asio/io_service.hpp>
12+
#include <boost/asio/io_service.hpp>
1313
#include <network/protocol/http/server.hpp>
1414
#include <network/utils/thread_pool.hpp>
1515
#include <network/detail/debug.hpp>

include/network/protocol/http/client/macros.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#ifndef NETWORK_HTTP_BODY_CALLBACK
1414
#define NETWORK_HTTP_BODY_CALLBACK(function_name, range_name, error_name) \
15-
void function_name (boost::iterator_range<const char*> const & range_name, asio::error_code const & error_name)
15+
void function_name (boost::iterator_range<const char*> const & range_name, boost::system::error_code const & error_name)
1616
#endif
1717

1818
#endif /* NETWORK_PROTOCOL_HTTP_CLIENT_MACROS_HPP_20110430 */

include/network/protocol/http/request/request.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
#ifndef NETWORK_PROTOCOL_HTTP_REQUEST_REQUEST_HPP_20111021
88
#define NETWORK_PROTOCOL_HTTP_REQUEST_REQUEST_HPP_20111021
99

10+
#ifndef NETWORK_DEFAULT_CHUNK_SIZE
11+
#define NETWORK_DEFAULT_CHUNK_SIZE 4096
12+
#endif // NETWORK_DEFAULT_CHUNK_SIZE
13+
1014
#include <network/protocol/http/request/request_base.hpp>
1115
#include <network/uri.hpp>
1216
#include <network/protocol/http/message/directives/major_version.hpp>

include/network/protocol/http/request/request.ipp

+4
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,10 @@ void request::get_body(std::function<void(std::string::const_iterator, size_t)>
246246
chunk_reader(local_buffer.cbegin(), bytes_read);
247247
}
248248

249+
void request::get_body(std::function<void(std::string::const_iterator, size_t)> chunk_reader) const {
250+
this->get_body(chunk_reader, NETWORK_DEFAULT_CHUNK_SIZE);
251+
}
252+
249253
// From request_base...
250254
// Setters
251255
void request::set_method(std::string const & method) {

libs/network/example/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,17 @@ add_executable(hello_world_client http/hello_world_client.cpp)
2020
# add_executable(fileserver http/fileserver.cpp)
2121
#endif (UNIX)
2222
set(BOOST_CLIENT_LIBS
23-
${Boost_CHRONO_LIBRARY}
2423
${Boost_DATE_TIME_LIBRARY}
2524
${Boost_SYSTEM_LIBRARY}
2625
${Boost_FILESYSTEM_LIBRARY}
2726
${Boost_PROGRAM_OPTIONS_LIBRARY}
2827
${Boost_REGEX_LIBRARY}
29-
${Boost_THREAD_LIBRARY}
3028
)
3129
set(BOOST_SERVER_LIBS
32-
${Boost_CHRONO_LIBRARY}
3330
${Boost_DATE_TIME_LIBRARY}
3431
${Boost_SYSTEM_LIBRARY}
3532
${Boost_FILESYSTEM_LIBRARY}
3633
${Boost_PROGRAM_OPTIONS_LIBRARY}
37-
${Boost_THREAD_LIBRARY}
3834
)
3935

4036
target_link_libraries(uri_builder

libs/network/test/http/request_base_test.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(request_storage_flow) {
4545
static char data[] =
4646
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus vitae ante sed nunc dapibus convallis in at neque. Vestibulum sed congue nunc. Sed tempus lorem non dui ultrices porttitor porta ligula venenatis. Sed a orci gravida tellus condimentum laoreet. Vivamus pulvinar, tortor eu adipiscing tempus, dolor urna tincidunt enim, id pretium eros ante quis dui. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In hac habitasse platea dictumst. Maecenas mattis metus.";
4747
simple.append(data, sizeof(data));
48-
char output[sizeof(data)];
48+
std::string output;
4949
size_t bytes_read = simple.read(output, 0, sizeof(data));
5050
BOOST_CHECK_EQUAL(bytes_read, sizeof(data));
5151
std::string flattened;
@@ -60,7 +60,7 @@ BOOST_AUTO_TEST_CASE(request_storage_copy) {
6060
request_test original(64);
6161
static char quick_brown[] = "The quick brown fox jumps over the lazy dog.";
6262
original.append(quick_brown, sizeof(quick_brown));
63-
char output[sizeof(quick_brown)];
63+
std::string output;
6464
request_test copy(original);
6565
size_t bytes_read = copy.read(output, 0, sizeof(quick_brown));
6666
BOOST_CHECK_EQUAL(bytes_read, sizeof(quick_brown));

0 commit comments

Comments
 (0)