0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-27 07:54:05 +01:00

ircd::http: Response ctor content_length=-1 is chunked encoding.

This commit is contained in:
Jason Volk 2018-03-22 00:37:16 -07:00
parent ef0a3d6e6c
commit 51714d2b67

View file

@ -352,7 +352,7 @@ ircd::http::response::response(window_buffer &out,
}; };
}); });
if(code != NO_CONTENT && content_length != std::numeric_limits<size_t>::max()) if(code != NO_CONTENT && content_length != size_t(-1))
writeline(out, [&content_length](const mutable_buffer &out) -> size_t writeline(out, [&content_length](const mutable_buffer &out) -> size_t
{ {
return fmt::sprintf return fmt::sprintf
@ -361,6 +361,12 @@ ircd::http::response::response(window_buffer &out,
}; };
}); });
if(content_length == size_t(-1))
writeline(out, [&content_length](const mutable_buffer &out) -> size_t
{
return copy(out, "Transfer-Encoding: chunked"_sv);
});
if(!headers_string.empty()) if(!headers_string.empty())
out([&headers_string](const mutable_buffer &out) out([&headers_string](const mutable_buffer &out)
{ {