mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 00:32:35 +01:00
ircd::http: Utils to read and write chunk size line.
This commit is contained in:
parent
9723eec4e8
commit
daae800cc1
2 changed files with 21 additions and 0 deletions
|
@ -32,6 +32,8 @@ namespace ircd::http
|
|||
void write(window_buffer &, const vector_view<const header> &);
|
||||
size_t serialized(const vector_view<const header> &);
|
||||
std::string strung(const vector_view<const header> &);
|
||||
void writechunk(window_buffer &, const size_t &size);
|
||||
const_buffer writechunk(const mutable_buffer &, const size_t &size);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
19
ircd/http.cc
19
ircd/http.cc
|
@ -570,6 +570,25 @@ ircd::http::parser::content_length(const string_view &str)
|
|||
return ret;
|
||||
}
|
||||
|
||||
ircd::const_buffer
|
||||
ircd::http::writechunk(const mutable_buffer &buf,
|
||||
const size_t &chunk_size)
|
||||
{
|
||||
window_buffer wb{buf};
|
||||
writechunk(wb, chunk_size);
|
||||
return wb.completed();
|
||||
}
|
||||
|
||||
void
|
||||
ircd::http::writechunk(window_buffer &buf,
|
||||
const size_t &chunk_size)
|
||||
{
|
||||
writeline(buf, [&chunk_size](const mutable_buffer &out) -> size_t
|
||||
{
|
||||
return ::snprintf(data(out), size(out), "%lx", chunk_size);
|
||||
});
|
||||
}
|
||||
|
||||
std::string
|
||||
ircd::http::strung(const vector_view<const header> &headers)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue