Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit30de417

Browse files
committed
Merge branch 'master' of git://github.com/mikhailberis/cpp-netlib
2 parentsd7254c3 +190cfe1 commit30de417

File tree

16 files changed

+213
-106
lines changed

16 files changed

+213
-106
lines changed

‎CMakeLists.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ if (Boost_FOUND)
1313
endif()
1414
enable_testing()
1515
add_subdirectory(libs/network/test)
16+
add_subdirectory(libs/mime/test)
17+

‎Jamroot‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ use-project /boost : $(BOOST_ROOT) ;
1212

1313
using testing ;
1414

15-
build-project libs/network/test ;
15+
build-project libs/network/test ;
16+
build-project libs/mime/test ;
17+

‎boost/network/detail/wrapper_base.hpp‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,29 @@ namespace boost { namespace network { namespace detail {
1111

1212
template<classTag>
1313
structwrapper_base {
14-
typedef Tag tag;
15-
explicitwrapper_base(basic_message<tag> & message_)
14+
explicitwrapper_base(basic_message<Tag> & message_)
1615
: _message(message_)
17-
{};
16+
{};
1817

1918
protected:
20-
virtual~wrapper_base()
21-
{ };// for extending only
19+
~wrapper_base() {};// for extending only
2220

23-
mutablebasic_message<tag> & _message;
21+
basic_message<Tag> & _message;
2422
};
2523

24+
template<classTag>
25+
structwrapper_base_const {
26+
explicitwrapper_base_const(basic_message<Tag>const & message_)
27+
: _message(message_)
28+
{}
29+
30+
protected:
31+
~wrapper_base_const() {};// for extending only
32+
33+
basic_message<Tag>const & _message;
34+
};
35+
36+
2637
}// namespace detail
2738

2839
}// namespace network

‎boost/network/message.hpp‎

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,49 +44,65 @@ namespace boost { namespace network {
4444

4545
typedef Tag tag;
4646

47-
typedeftypename headers_container<tag>::type headers_container_type;
48-
typedeftypename string<tag>::type string_type;
47+
typedeftypename headers_container<Tag>::type headers_container_type;
48+
typedeftypename string<Tag>::type string_type;
4949

5050
basic_message()
5151
: _headers(), _body(), _source(), _destination()
52-
{ };
52+
{ }
5353

5454
basic_message(const basic_message & other)
5555
: _headers(other._headers), _body(other._body), _source(other._source), _destination(other._destination)
56-
{ };
56+
{ }
5757

58-
basic_message &operator=(basic_message<tag> rhs) {
58+
basic_message &operator=(basic_message<Tag> rhs) {
5959
rhs.swap(*this);
6060
return *this;
61-
};
61+
}
6262

63-
voidswap(basic_message<tag> & other) {
63+
voidswap(basic_message<Tag> & other) {
6464
other._headers.swap(_headers);
6565
other._body.swap(_body);
6666
other._source.swap(_source);
6767
other._destination.swap(_destination);
68-
};
68+
}
6969

7070
headers_container_type &headers() {
7171
return _headers;
72-
};
72+
}
73+
74+
headers_container_typeheaders()const {
75+
return _headers;
76+
}
7377

7478
string_type &body() {
7579
return _body;
76-
};
80+
}
81+
82+
string_typebody()const {
83+
return _body;
84+
}
7785

7886
string_type &source() {
7987
return _source;
80-
};
88+
}
89+
90+
string_typesource()const {
91+
return _source;
92+
}
8193

8294
string_type &destination() {
8395
return _destination;
84-
};
96+
}
97+
98+
string_typedestination()const {
99+
return _destination;
100+
}
85101

86102
private:
87103

88-
friendstructdetail::directive_base<tag> ;
89-
friendstructdetail::wrapper_base<tag> ;
104+
friendstructdetail::directive_base<Tag> ;
105+
friendstructdetail::wrapper_base<Tag> ;
90106

91107
headers_container_type _headers;
92108
string_type _body;

‎boost/network/message/message_concept.hpp‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@ struct Message
2727
M message_;
2828
swap(message, message_);
2929

30-
headers_container_type &headers_ = message.headers();
31-
string_type &body_ = message.body();
32-
string_type &source_ = message.source();
33-
string_type &destination_ = message.destination();
30+
headers_container_type headers_ =headers(message);
31+
string_type body_ =body(message);
32+
string_type source_ =source(message);
33+
string_type destination_ =destination(message);
34+
35+
message <<source(string_type())
36+
<<destination(string_type())
37+
<<header(string_type(),string_type())
38+
<<body(string_type());
3439

3540
(void)headers_;
3641
(void)body_;

‎boost/network/message/wrappers/body.hpp‎

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,32 @@ namespace boost { namespace network {
1616
namespaceimpl {
1717
template<classTag>
1818
structbody_wrapper :publicdetail::wrapper_base<Tag> {
19-
typedef Tag tag;
20-
typedef basic_message<tag> message_type;
19+
typedef basic_message<Tag> message_type;
2120
typedeftypename string<Tag>::type string_type;
2221

23-
explicitbody_wrapper(basic_message<tag> & message_)
24-
: detail::wrapper_base<tag>(message_)
22+
explicitbody_wrapper(basic_message<Tag> & message_)
23+
: detail::wrapper_base<Tag>(message_)
2524
{ };
2625

2726
operatorstring_type ()const {
2827
returnstring_type(detail::wrapper_base<Tag>::_message.body());
2928
};
3029
};
30+
31+
template<classTag>
32+
structbody_wrapper_const :publicdetail::wrapper_base_const<Tag> {
33+
typedef basic_message<Tag> message_type;
34+
typedeftypename string<Tag>::type string_type;
35+
36+
explicitbody_wrapper_const(basic_message<Tag>const & message_)
37+
: detail::wrapper_base_const<Tag>(message_)
38+
{};
39+
40+
operatorstring_type ()const {
41+
returnstring_type(detail::wrapper_base_const<Tag>::_message.body());
42+
}
43+
};
44+
3145
}// namespace impl
3246

3347
template<classTag>
@@ -36,6 +50,12 @@ namespace boost { namespace network {
3650
return impl::body_wrapper<Tag>(message_);
3751
}
3852

53+
template<classTag>
54+
inlinetypename string<Tag>::type
55+
body(basic_message<Tag>const & message_) {
56+
return impl::body_wrapper_const<Tag>(message_);
57+
}
58+
3959
}// namespace network
4060

4161
}// namespace boost

‎boost/network/message/wrappers/headers.hpp‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ namespace boost { namespace network {
3434
* headers_range<basic_message<tag> >::type
3535
* Which allows for full range support.
3636
*
37+
* The type is also convertible to a
38+
* headers_container<Tag>::type
39+
* Which copies the headers from the wrapped message.
40+
*
3741
*/
3842
namespaceimpl {
3943
template<classTag>
@@ -70,6 +74,10 @@ namespace boost { namespace network {
7074
returnmake_iterator_range(headers_wrapper<Tag>::_message.headers().begin(), headers_wrapper<Tag>::_message.headers().end());
7175
};
7276

77+
operatorheaders_container_type () {
78+
return headers_wrapper<Tag>::_message.headers();
79+
}
80+
7381
};
7482
}// namespace impl
7583

‎boost/network/protocol/http/client.hpp‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,11 @@ namespace boost { namespace network { namespace http {
9191
returnsync_request_skeleton(request_,"POST",true);
9292
};
9393

94-
responseconstpost (requestconst & request_, string_typeconst & content_type, string_typeconst & body_) {
95-
request request_copy = request_;
96-
request_copy <<body(body_)
94+
responseconstpost (request request_, string_typeconst & content_type, string_typeconst & body_) {
95+
request_ <<body(body_)
9796
<<header("Content-Type", content_type)
9897
<<header("Content-Length", boost::lexical_cast<string_type>(body_.size()));
99-
returnpost(request_copy);
98+
returnpost(request_);
10099
};
101100

102101
responseconstpost (requestconst & request_, string_typeconst & body_) {
@@ -111,12 +110,11 @@ namespace boost { namespace network { namespace http {
111110
returnput(request_,"x-application/octet-stream", body_);
112111
};
113112

114-
responseconstput (requestconst & request_, string_typeconst & content_type, string_typeconst & body_) {
115-
request request_copy = request_;
116-
request_copy <<body(body_)
113+
responseconstput (request request_, string_typeconst & content_type, string_typeconst & body_) {
114+
request_ <<body(body_)
117115
<<header("Content-Type", content_type)
118116
<<header("Content-Length", boost::lexical_cast<string_type>(body_.size()));
119-
returnput(request_copy);
117+
returnput(request_);
120118
};
121119

122120
responseconstdelete_ (requestconst & request_) {
@@ -137,7 +135,7 @@ namespace boost { namespace network { namespace http {
137135

138136
};
139137

140-
typedef basic_client<tags::http_default_8bit_tcp_resolve,1,0> client;
138+
typedef basic_client<tags::http_default_8bit_udp_resolve,1,0> client;
141139

142140
}// namespace http
143141

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp