0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-01-16 17:46:54 +01: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 std::string
ircd::http::strung(const vector_view<const header> &headers) ircd::http::strung(const vector_view<const header> &headers)
{ {
std::string ret(serialized(headers), char{}); return ircd::string(serialized(headers), [&]
window_buffer out{ret}; (window_buffer out)
{
write(out, headers); write(out, headers);
assert(out.consumed() <= ret.size()); return out.consumed();
ret.resize(out.consumed()); });
assert(out.consumed() == ret.size());
return ret;
} }
/// Indicates the buffer size required to write these headers. This size /// Indicates the buffer size required to write these headers. This size