File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,10 @@ main(int argc, char *argv[]) {
24
24
auto future_response = client.head (request);
25
25
auto response = future_response.get ();
26
26
27
+ std::cout << " HTTP version: " << response.version () << std::endl;
28
+ std::cout << " HTTP status: " << static_cast <int >(response.status ()) << std::endl;
29
+ std::cout << " HTTP status message: " << response.status_message () << std::endl;
30
+ std::cout << std::endl;
27
31
for (auto header : response.headers ()) {
28
32
std::cout << header.first << " : " << header.second << std::endl;
29
33
}
Original file line number Diff line number Diff line change 6
6
#include < future>
7
7
#include < boost/asio/strand.hpp>
8
8
#include < boost/algorithm/string/trim.hpp>
9
- #include < boost/algorithm/string/split.hpp>
10
9
#include < boost/algorithm/string/predicate.hpp>
10
+ #include < boost/range/algorithm/find_first_of.hpp>
11
11
#include < network/uri.hpp>
12
12
#include < network/config.hpp>
13
13
#include < network/http/v2/client/client.hpp>
@@ -179,9 +179,11 @@ namespace network {
179
179
std::istream is (&response_);
180
180
string_type header;
181
181
while (std::getline (is, header) && (header != " \r " )) {
182
- std::vector<string_type> kvp;
183
- boost::split (kvp, header, boost::is_any_of (" :" ));
184
- res->add_header (kvp[0 ], boost::trim_copy (kvp[1 ]));
182
+ auto delim = boost::find_first_of (header, " :" );
183
+ string_type key (std::begin (header), delim);
184
+ while (*++delim == ' ' ) { }
185
+ string_type value (delim, std::end (header));
186
+ res->add_header (key, value);
185
187
}
186
188
187
189
connection_->async_read (response_,
You can’t perform that action at this time.
0 commit comments