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

Commit5b11931

Browse files
committed
Fixing response concept, adding the notion of modifiers as an extension point for messages.
1 parent87a2d55 commit5b11931

File tree

6 files changed

+146
-3
lines changed

6 files changed

+146
-3
lines changed

‎boost/network/message/message_concept.hpp‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// Copyright (c) Glyn Matthews 2010.
2+
// Copyright 2010 (c) Dean Michael Berris.
3+
// Copyright 2010 (c) Sinefunc, Inc.
24
// Distributed under the Boost Software License, Version 1.0.
35
// (See accompanying file LICENSE_1_0.txt or copy at
46
// http://www.boost.org/LICENSE_1_0.txt)
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_STATUS_HPP_20100608
2+
#defineBOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_STATUS_HPP_20100608
3+
4+
// Copyright 2010 (c) Dean Michael Berris
5+
// Copyright 2010 (c) Sinefunc, Inc.
6+
// Distributed under the Boost Software License, Version 1.0.
7+
// (See accompanying file LICENSE_1_0.txt or copy at
8+
// http://www.boost.org/LICENSE_1_0.txt)
9+
10+
#include<boost/network/support/is_async.hpp>
11+
#include<boost/thread/future.hpp>
12+
13+
namespaceboost {namespacenetwork {namespacehttp {
14+
15+
template<classTag>
16+
structbasic_response;
17+
18+
namespaceimpl {
19+
20+
template<classTag,classT>
21+
voidstatus(basic_response<Tag> & response, Tconst & value, mpl::false_const &) {
22+
response <<boost::network::http::status(value);
23+
}
24+
25+
template<classTag,classT>
26+
voidstatus(basic_response<Tag> & response, boost::shared_future<T> future, mpl::true_const &) {
27+
response.status() = future;
28+
}
29+
30+
}// namespace impl
31+
32+
template<classTag,classT>
33+
voidstatus(basic_response<Tag> & response, Tconst & value) {
34+
impl::status(response, value, is_async<Tag>());
35+
}
36+
37+
}// namespace http
38+
39+
}// namespace network
40+
41+
}// namespace boost
42+
43+
#endif// BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_STATUS_HPP_20100608
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_STATUS_MESSAGE_HPP_20100608
2+
#defineBOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_STATUS_MESSAGE_HPP_20100608
3+
4+
// Copyright 2010 (c) Dean Michael Berris
5+
// Copyright 2010 (c) Sinefunc, Inc.
6+
// Distributed under the Boost Software License, Version 1.0.
7+
// (See accompanying file LICENSE_1_0.txt or copy at
8+
// http://www.boost.org/LICENSE_1_0.txt)
9+
10+
#include<boost/network/support/is_async.hpp>
11+
#include<boost/thread/future.hpp>
12+
13+
namespaceboost {namespacenetwork {namespacehttp {
14+
15+
template<classTag>
16+
structbasic_response;
17+
18+
namespaceimpl {
19+
20+
template<classTag,classT>
21+
voidstatus_message(basic_response<Tag> & response, Tconst & value, mpl::false_const &) {
22+
response <<boost::network::http::status_message(value);
23+
}
24+
25+
template<classTag,classT>
26+
voidstatus_message(basic_response<Tag> & response, boost::shared_future<T> future, mpl::true_const &) {
27+
response.status_message() = future;
28+
}
29+
30+
}// namespace impl
31+
32+
template<classTag,classT>
33+
voidstatus_message(basic_response<Tag> & response, Tconst & value) {
34+
impl::status_message(response, value, is_async<Tag>());
35+
}
36+
37+
}// namespace http
38+
39+
}// namespace network
40+
41+
}// namespace boost
42+
43+
#endif// BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_STATUS_MESSAGE_HPP_20100608
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_VERSION_HPP_20100608
2+
#defineBOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_VERSION_HPP_20100608
3+
4+
// Copyright 2010 (c) Dean Michael Berris
5+
// Copyright 2010 (c) Sinefunc, Inc.
6+
// Distributed under the Boost Software License, Version 1.0.
7+
// (See accompanying file LICENSE_1_0.txt or copy at
8+
// http://www.boost.org/LICENSE_1_0.txt)
9+
10+
#include<boost/network/support/is_async.hpp>
11+
12+
namespaceboost {namespacenetwork {namespacehttp {
13+
14+
template<classTag>
15+
structbasic_response;
16+
17+
namespaceimpl {
18+
19+
template<classTag,classT>
20+
voidversion(basic_response<Tag> & response, Tconst & value, mpl::false_const &) {
21+
response <<boost::network::http::version(value);
22+
}
23+
24+
template<classTag,classT>
25+
voidversion(basic_response<Tag> & response, Tconst & future, mpl::true_const &) {
26+
response.version(future);
27+
}
28+
29+
}// namespace impl
30+
31+
template<classTag,classT>
32+
voidversion(basic_response<Tag> & response, Tconst & value) {
33+
impl::version(response, value, is_async<Tag>());
34+
}
35+
36+
}// namespace http
37+
38+
}// namespace network
39+
40+
}// namespace boost
41+
42+
#endif// BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_MODIFIERS_VERSION_HPP_20100608

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,25 @@
1313
#include<boost/cstdint.hpp>
1414
#include<boost/network/protocol/http/response_concept.hpp>
1515

16+
#include<boost/network/protocol/http/message/message_base.hpp>
17+
1618
namespaceboost {namespacenetwork {namespacehttp {
1719

1820
template<classTag>
19-
structbasic_response :publicmessage_impl<Tag> {
21+
structbasic_response :publicmessage_base<Tag>::type {
22+
23+
typedeftypename string<Tag>::type string_type;
24+
2025
private:
21-
typedefmessage_impl<Tag> base_type;
26+
typedeftypename message_base<Tag>::type base_type;
2227

2328
mutable string_type version_;
2429
mutable boost::uint16_t status_;
2530
mutable string_type status_message_;
31+
2632
public:
2733

2834
typedef Tag tag;
29-
typedeftypename string<Tag>::type string_type;
3035

3136
basic_response()
3237
: base_type(), version_(), status_(0u), status_message_()
@@ -104,4 +109,8 @@ namespace boost { namespace network { namespace http {
104109
#include<boost/network/protocol/http/message/wrappers/status.hpp>
105110
#include<boost/network/protocol/http/message/wrappers/status_message.hpp>
106111

112+
#include<boost/network/protocol/http/message/modifiers/version.hpp>
113+
#include<boost/network/protocol/http/message/modifiers/status.hpp>
114+
#include<boost/network/protocol/http/message/modifiers/status_message.hpp>
115+
107116
#endif// BOOST_NETWORK_PROTOCOL_HTTP_RESPONSE_HPP

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ namespace boost { namespace network { namespace http {
2828
<<status_message("OK")// status_message directive
2929
;
3030

31+
version(response,"HTTP/1.0");
32+
status(response,200u);
33+
status_message(response,"OK");
34+
3135
string_type version_ =version(response);
3236
boost::uint16_t status_ =status(response);
3337
string_type status_message_ =status_message(response);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp