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

Commit9956721

Browse files
committed
Fixescpp-netlib#56 -- caches asynchronously fetched headers.
1 parent233b0f1 commit9956721

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,15 @@ namespace boost { namespace network { namespace http {
9191
destination_ = future;
9292
}
9393

94-
headers_container_typeconstheaders()const {
94+
headers_container_typeconst &headers()const {
95+
if (retrieved_headers_)return *retrieved_headers_;
9596
headers_container_type raw_headers = headers_.get();
9697
raw_headers.insert(added_headers.begin(), added_headers.end());
9798
BOOST_FOREACH(string_typeconst & key, removed_headers) {
9899
raw_headers.erase(key);
99100
}
100-
return raw_headers;
101+
retrieved_headers_ = raw_headers;
102+
return *retrieved_headers_;
101103
}
102104

103105
voidheaders(boost::shared_future<headers_container_type>const & future)const {
@@ -144,6 +146,7 @@ namespace boost { namespace network { namespace http {
144146
mutable headers_container_type added_headers;
145147
mutable std::set<string_type> removed_headers;
146148
mutable boost::shared_future<string_type> body_;
149+
mutable boost::optional<headers_container_type> retrieved_headers_;
147150

148151
friendstructboost::network::http::impl::ready_wrapper<Tag>;
149152
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp