File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed
boost/network/protocol/http Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 13
13
#include < boost/network/protocol/http/request_concept.hpp>
14
14
#include < boost/network/constants.hpp>
15
15
#include < boost/concept/requires.hpp>
16
+ #include < boost/optional.hpp>
16
17
#include < boost/range/algorithm/copy.hpp>
17
18
18
19
namespace boost { namespace network { namespace http {
@@ -95,6 +96,12 @@ namespace boost { namespace network { namespace http {
95
96
*oi = consts::colon_char ();
96
97
*oi = consts::space_char ();
97
98
boost::copy (request.host (), oi);
99
+ boost::optional<boost::uint16_t > port_ = port (request);
100
+ if (port_) {
101
+ string_type port_str = boost::lexical_cast<string_type>(*port_);
102
+ *oi = consts::colon_char ();
103
+ boost::copy (port_str, oi);
104
+ }
98
105
boost::copy (crlf, oi);
99
106
boost::copy (accept, oi);
100
107
*oi = consts::colon_char ();
Original file line number Diff line number Diff line change 7
7
// (See accompanying file LICENSE_1_0.txt or copy at
8
8
// http://www.boost.org/LICENSE_1_0.txt)
9
9
10
+ #include < boost/optional.hpp>
11
+
10
12
namespace boost { namespace network { namespace http {
11
13
12
14
template <class Tag >
@@ -26,6 +28,10 @@ namespace boost { namespace network { namespace http {
26
28
operator port_type () {
27
29
return message_.port ();
28
30
}
31
+
32
+ operator boost::optional<boost::uint16_t > () {
33
+ return port (message_.uri ());
34
+ }
29
35
};
30
36
31
37
} // namespace impl
Original file line number Diff line number Diff line change 7
7
// (See accompanying file LICENSE_1_0.txt or copy at
8
8
// http://www.boost.org/LICENSE_1_0.txt)
9
9
10
+ #include < boost/network/uri/http/uri.hpp>
11
+
10
12
namespace boost { namespace network { namespace http {
11
13
12
14
template <class Tag >
@@ -22,6 +24,9 @@ namespace boost { namespace network { namespace http {
22
24
operator string_type () {
23
25
return message_.uri ().raw ();
24
26
}
27
+ operator boost::network::uri::basic_uri<tags::http_default_8bit_tcp_resolve> () {
28
+ return message_.uri ();
29
+ }
25
30
};
26
31
}
27
32
You can’t perform that action at this time.
0 commit comments