0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-29 15:28:20 +02:00

ircd::http: Modernize the header vector string generator.

This commit is contained in:
Jason Volk 2018-03-04 23:45:23 -08:00
parent ab9e9d698b
commit 3b1cc75f10

View file

@ -750,13 +750,12 @@ ircd::http::parser::content_length(const string_view &str)
std::string
ircd::http::strung(const vector_view<const header> &headers)
{
std::string ret(serialized(headers), char{});
window_buffer out{ret};
write(out, headers);
assert(out.consumed() <= ret.size());
ret.resize(out.consumed());
assert(out.consumed() == ret.size());
return ret;
return ircd::string(serialized(headers), [&]
(window_buffer out)
{
write(out, headers);
return out.consumed();
});
}
/// Indicates the buffer size required to write these headers. This size