Skip to content

Commit 6ec03b6

Browse files
committed
[http_refactor] Updated sources and build scripts to ensure full compilation on Linux (GCC 4.6)
1 parent 822b9fc commit 6ec03b6

26 files changed

+252
-153
lines changed

CMakeLists.txt

+12
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ if (OPENSSL_FOUND)
2020
add_definitions(-DBOOST_NETWORK_ENABLE_HTTPS)
2121
endif()
2222

23+
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
24+
INCLUDE(CheckCXXCompilerFlag)
25+
CHECK_CXX_COMPILER_FLAG(-std=c++0x HAVE_STD0X)
26+
CHECK_CXX_COMPILER_FLAG(-std=c++11 HAVE_STD11)
27+
28+
if (NOT HAVE_STD0X)
29+
if (NOT HAVE_STD11)
30+
message(FATAL_ERROR "No advanced standard C++ support (-std=c++0x and -std=c++11 not defined).")
31+
endif()
32+
endif()
33+
endif()
34+
2335
if (Boost_FOUND)
2436
if (MSVC)
2537
add_definitions(-D_SCL_SECURE_NO_WARNINGS)

boost/network/message/message_base.hpp

-4
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,4 @@ struct message_base {
4040

4141
} /* boost */
4242

43-
#ifdef BOOST_NETWORK_NO_LIB
44-
#include <boost/network/message_base.ipp>
45-
#endif
46-
4743
#endif /* BOOST_NETWORK_MESSAGE_BASE_HPP_20110910 */

boost/network/protocol/http/client/connection/simple_connection_factory.ipp

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include <boost/network/protocol/http/client/options.hpp>
1515
#include <boost/network/detail/debug.hpp>
1616
#ifdef BOOST_NETWORK_DEBUG
17-
#include <boost/network/uri/uri_io.hpp>
17+
#include <network/uri_io.hpp>
1818
#endif
1919
#include <boost/algorithm/string/case_conv.hpp>
2020

@@ -35,9 +35,9 @@ struct simple_connection_factory_pimpl {
3535
request_base const & request,
3636
client_options const & options) {
3737
BOOST_NETWORK_MESSAGE("simple_connection_factory_pimpl::create_connection(...)");
38-
uri::uri uri_ = http::uri(request);
38+
::network::uri uri_ = http::uri(request);
3939
BOOST_NETWORK_MESSAGE("destination: " << uri_);
40-
bool https = to_lower_copy(scheme(uri_)) == "https";
40+
bool https = to_lower_copy(::network::scheme(uri_)) == "https";
4141
shared_ptr<client_connection> conn_;
4242
conn_.reset(new (std::nothrow) http_async_connection(
4343
res_delegate_factory_->create_resolver_delegate(service, options.cache_resolved()),
@@ -83,9 +83,9 @@ simple_connection_factory::~simple_connection_factory() {
8383
}
8484

8585
} /* http */
86-
86+
8787
} /* network */
88-
88+
8989
} /* boost */
9090

9191
#endif /* BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_SIMPLE_CONNECTION_FACTORY_20111120 */

boost/network/protocol/http/impl/request.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <boost/fusion/sequence/intrinsic/at_key.hpp>
1616
#include <boost/fusion/sequence/intrinsic/value_at_key.hpp>
1717

18-
#include <boost/network/uri/uri.hpp>
18+
#include <network/uri/uri.hpp>
1919
#include <boost/network/traits/vector.hpp>
2020
#include <boost/network/constants.hpp>
2121

@@ -51,7 +51,7 @@ namespace http {
5151
struct basic_request : public basic_message<Tag>
5252
{
5353

54-
mutable boost::network::uri::uri uri_;
54+
mutable network::uri uri_;
5555
typedef basic_message<Tag> base_type;
5656

5757
public:
@@ -63,15 +63,15 @@ namespace http {
6363
: uri_(uri_)
6464
{ }
6565

66-
explicit basic_request(boost::network::uri::uri const & uri_)
66+
explicit basic_request(network::uri const & uri_)
6767
: uri_(uri_)
6868
{ }
6969

7070
void uri(string_type const & new_uri) {
7171
uri_ = new_uri;
7272
}
7373

74-
void uri(boost::network::uri::uri const & new_uri) {
74+
void uri(network::uri const & new_uri) {
7575
uri_ = new_uri;
7676
}
7777

@@ -130,7 +130,7 @@ namespace http {
130130
uri_ = new_uri;
131131
}
132132

133-
boost::network::uri::uri const & uri() const {
133+
network::uri const & uri() const {
134134
return uri_;
135135
}
136136

boost/network/protocol/http/message/modifiers/uri.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ inline void uri(request_base & request, std::string const & value) {
1616
request.set_uri(value);
1717
}
1818

19-
inline void uri(request_base & request, uri::uri const & value) {
19+
inline void uri(request_base & request, ::network::uri const & value) {
2020
request.set_uri(value);
2121
}
2222

boost/network/protocol/http/message/wrappers/anchor.ipp

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
// http://www.boost.org/LICENSE_1_0.txt)
99

1010
#include <boost/network/protocol/http/message/wrappers/anchor.hpp>
11-
#include <boost/network/uri/uri.hpp>
11+
#include <network/uri.hpp>
1212

1313
namespace boost { namespace network { namespace http {
1414

1515
anchor_wrapper::anchor_wrapper(request_base const & request)
1616
: request_(request) {}
1717

1818
anchor_wrapper::operator std::string () const {
19-
uri::uri uri_;
19+
::network::uri uri_;
2020
request_.get_uri(uri_);
2121
return fragment(uri_);
2222
}

boost/network/protocol/http/message/wrappers/host.ipp

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
// http://www.boost.org/LICENSE_1_0.txt)
99

1010
#include <boost/network/protocol/http/message/wrappers/host.hpp>
11-
#include <boost/network/uri/uri.hpp>
11+
#include <network/uri.hpp>
1212

1313
namespace boost { namespace network { namespace http {
1414

1515
host_wrapper::host_wrapper(request_base const & request)
1616
: request_(request) {}
1717

1818
host_wrapper::operator std::string () const {
19-
uri::uri uri_;
19+
::network::uri uri_;
2020
request_.get_uri(uri_);
2121
return host(uri_);
2222
}

boost/network/protocol/http/message/wrappers/path.ipp

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
// http://www.boost.org/LICENSE_1_0.txt)
99

1010
#include <boost/network/protocol/http/message/wrappers/path.hpp>
11-
#include <boost/network/uri/uri.hpp>
11+
#include <network/uri.hpp>
1212

1313
namespace boost { namespace network { namespace http {
1414

1515
path_wrapper::path_wrapper(request_base const & request)
1616
: request_(request) {}
1717

1818
path_wrapper::operator std::string () const {
19-
uri::uri uri_;
19+
::network::uri uri_;
2020
request_.get_uri(uri_);
2121
return path(uri_);
2222
}

boost/network/protocol/http/message/wrappers/port.ipp

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
// http://www.boost.org/LICENSE_1_0.txt)
99

1010
#include <boost/network/protocol/http/message/wrappers/port.hpp>
11-
#include <boost/network/uri/uri.hpp>
11+
#include <network/uri.hpp>
1212

1313
namespace boost { namespace network { namespace http {
1414

1515
port_wrapper::port_wrapper(request_base const & request)
1616
: request_(request) {}
1717

1818
port_wrapper::operator boost::uint16_t () const {
19-
uri::uri uri_;
19+
::network::uri uri_;
2020
request_.get_uri(uri_);
2121
optional<boost::uint16_t> optional_port = port_us(uri_);
2222
if (!optional_port) {
@@ -31,7 +31,7 @@ port_wrapper::operator boost::uint16_t () const {
3131
}
3232

3333
port_wrapper::operator optional<boost::uint16_t> () const {
34-
uri::uri uri_;
34+
::network::uri uri_;
3535
request_.get_uri(uri_);
3636
return port_us(uri_);
3737
}

boost/network/protocol/http/message/wrappers/query.ipp

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
// http://www.boost.org/LICENSE_1_0.txt)
99

1010
#include <boost/network/protocol/http/message/wrappers/query.hpp>
11-
#include <boost/network/uri/uri.hpp>
11+
#include <network/uri.hpp>
1212

1313
namespace boost { namespace network { namespace http {
1414

1515
query_wrapper::query_wrapper(request_base const & request)
1616
: request_(request) {}
1717

1818
query_wrapper::operator std::string () const {
19-
uri::uri uri_;
19+
::network::uri uri_;
2020
request_.get_uri(uri_);
2121
return query(uri_);
2222
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
// (See accompanying file LICENSE_1_0.txt or copy at
88
// http://www.boost.org/LICENSE_1_0.txt)
99

10-
#include <boost/network/uri/uri.hpp>
10+
#include <network/uri/uri.hpp>
1111
#include <boost/network/protocol/http/request/request_base.hpp>
1212

1313
namespace boost { namespace network { namespace http {
1414

1515
struct uri_wrapper {
1616
explicit uri_wrapper(request_base const & request_);
1717
operator std::string() const;
18-
operator boost::network::uri::uri() const;
18+
operator ::network::uri() const;
1919
private:
2020
request_base const & request_;
2121
};

boost/network/protocol/http/message/wrappers/uri.ipp

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ uri_wrapper::operator std::string() const {
2222
return uri;
2323
}
2424

25-
uri_wrapper::operator boost::network::uri::uri() const {
26-
boost::network::uri::uri uri;
25+
uri_wrapper::operator ::network::uri() const {
26+
::network::uri uri;
2727
request_.get_uri(uri);
2828
return uri;
2929
}

boost/network/protocol/http/request/request.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// http://www.boost.org/LICENSE_1_0.txt)
99

1010
#include <boost/network/protocol/http/request/request_base.hpp>
11-
#include <boost/network/uri/uri.hpp>
11+
#include <network/uri.hpp>
1212
#include <boost/network/protocol/http/message/directives/major_version.hpp>
1313
#include <boost/network/protocol/http/message/directives/minor_version.hpp>
1414
#include <boost/scoped_ptr.hpp>
@@ -21,7 +21,7 @@ struct request : request_base {
2121
// We support full value semantics.
2222
request();
2323
explicit request(std::string const & url);
24-
explicit request(uri::uri const & url);
24+
explicit request(::network::uri const & url);
2525
request(request const &);
2626
request& operator=(request);
2727
void swap(request & other);
@@ -54,12 +54,12 @@ struct request : request_base {
5454
virtual void set_status_message(std::string const & status_message);
5555
virtual void set_body_writer(function<void(char*, size_t)> writer);
5656
virtual void set_uri(std::string const &uri);
57-
virtual void set_uri(network::uri::uri const &uri);
57+
virtual void set_uri(::network::uri const &uri);
5858
virtual void set_version_major(unsigned short major_version);
5959
virtual void set_version_minor(unsigned short minor_version);
6060

6161
// Getters
62-
virtual void get_uri(network::uri::uri &uri) const;
62+
virtual void get_uri(::network::uri &uri) const;
6363
virtual void get_uri(std::string &uri) const;
6464
virtual void get_method(std::string & method) const;
6565
virtual void get_status(std::string & status) const;

boost/network/protocol/http/request/request.ipp

+17-5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ struct request_pimpl {
3434
, headers_()
3535
{}
3636

37+
explicit request_pimpl(::network::uri const & url)
38+
: uri_(url)
39+
, read_offset_(0)
40+
, source_()
41+
, destination_()
42+
, headers_()
43+
{}
44+
3745
request_pimpl* clone() const {
3846
return new (std::nothrow) request_pimpl(*this);
3947
}
@@ -42,15 +50,15 @@ struct request_pimpl {
4250
uri_ = uri;
4351
}
4452

45-
void set_uri(uri::uri const & uri) {
53+
void set_uri(::network::uri const & uri) {
4654
uri_ = uri;
4755
}
4856

4957
void get_uri(std::string &uri) {
5058
uri = uri_.string();
5159
}
5260

53-
void get_uri(uri::uri &uri) {
61+
void get_uri(::network::uri &uri) {
5462
uri = uri_;
5563
}
5664

@@ -136,7 +144,7 @@ struct request_pimpl {
136144
private:
137145
typedef std::multimap<std::string, std::string> headers_type;
138146

139-
uri::uri uri_;
147+
::network::uri uri_;
140148
size_t read_offset_;
141149
std::string source_, destination_;
142150
headers_type headers_;
@@ -163,6 +171,10 @@ request::request(std::string const & url)
163171
: pimpl_(new (std::nothrow) request_pimpl(url))
164172
{}
165173

174+
request::request(::network::uri const & url)
175+
: pimpl_(new (std::nothrow) request_pimpl(url))
176+
{}
177+
166178
request::request(request const &other)
167179
: pimpl_(other.pimpl_->clone())
168180
{}
@@ -266,7 +278,7 @@ void request::set_uri(std::string const &uri) {
266278
pimpl_->set_uri(uri);
267279
}
268280

269-
void request::set_uri(network::uri::uri const &uri) {
281+
void request::set_uri(::network::uri const &uri) {
270282
pimpl_->set_uri(uri);
271283
}
272284

@@ -279,7 +291,7 @@ void request::set_version_minor(unsigned short minor_version) {
279291
}
280292

281293
// Getters
282-
void request::get_uri(network::uri::uri &uri) const {
294+
void request::get_uri(::network::uri &uri) const {
283295
pimpl_->get_uri(uri);
284296
}
285297

boost/network/protocol/http/request/request_base.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#endif
1313

1414
#include <boost/network/message/message_base.hpp>
15-
#include <boost/network/uri/uri.hpp>
15+
#include <network/uri.hpp>
1616

1717
namespace boost { namespace network { namespace http {
1818

@@ -46,10 +46,10 @@ struct request_base : message_base, request_storage_base {
4646
virtual void set_status_message(std::string const & status_message) = 0;
4747
virtual void set_body_writer(function<void(char*, size_t)> writer) = 0;
4848
virtual void set_uri(std::string const &uri) = 0;
49-
virtual void set_uri(network::uri::uri const &uri) = 0;
49+
virtual void set_uri(::network::uri const &uri) = 0;
5050

5151
// Getters
52-
virtual void get_uri(network::uri::uri &uri) const = 0;
52+
virtual void get_uri(::network::uri &uri) const = 0;
5353
virtual void get_uri(std::string &uri) const = 0;
5454
virtual void get_method(std::string & method) const = 0;
5555
virtual void get_status(std::string & status) const = 0;
@@ -60,9 +60,9 @@ struct request_base : message_base, request_storage_base {
6060
};
6161

6262
} /* http */
63-
63+
6464
} /* network */
65-
65+
6666
} /* boost */
6767

6868
#endif /* BOOST_NETWORK_PROTOCOL_HTTP_REQUEST_BASE_HPP_20111008 */

0 commit comments

Comments
 (0)