Skip to content

Commit e86a2fe

Browse files
committed
Merge branch 'bug-56-message-header-crash' into 0.9-devel
2 parents 8643537 + 922dcc1 commit e86a2fe

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

boost/network/protocol/http/message/async_message.hpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
// Copyright 2010 (c) Dean Michael Berris
55
// Copyright 2010 (c) Sinefunc, Inc.
6+
// Copyright 2011 Dean Michael Berris ([email protected]).
7+
// Copyright 2011 Google, Inc.
68
// Distributed under the Boost Software License, Version 1.0.
79
// (See accompanying file LICENSE_1_0.txt or copy at
810
// http://www.boost.org/LICENSE_1_0.txt)
@@ -91,13 +93,15 @@ namespace boost { namespace network { namespace http {
9193
destination_ = future;
9294
}
9395

94-
headers_container_type const headers() const {
96+
headers_container_type const & headers() const {
97+
if (retrieved_headers_) return *retrieved_headers_;
9598
headers_container_type raw_headers = headers_.get();
9699
raw_headers.insert(added_headers.begin(), added_headers.end());
97100
BOOST_FOREACH(string_type const & key, removed_headers) {
98101
raw_headers.erase(key);
99102
}
100-
return raw_headers;
103+
retrieved_headers_ = raw_headers;
104+
return *retrieved_headers_;
101105
}
102106

103107
void headers(boost::shared_future<headers_container_type> const & future) const {
@@ -144,6 +148,7 @@ namespace boost { namespace network { namespace http {
144148
mutable headers_container_type added_headers;
145149
mutable std::set<string_type> removed_headers;
146150
mutable boost::shared_future<string_type> body_;
151+
mutable boost::optional<headers_container_type> retrieved_headers_;
147152

148153
friend struct boost::network::http::impl::ready_wrapper<Tag>;
149154
};

0 commit comments

Comments
 (0)