forked from boostorg/beast
Rework HTTP concepts (API Change):
fix #139, fix #140 * Writer uses write instead of operator() * Refactor traits to use void_t * Remove is_ReadableBody, is_WritableBody * Add has_reader, has_writer, is_Reader, is_Writer * More friendly compile errors on failed concept checks
This commit is contained in:
1 parent
f110e51dd1
commit
056d6b94c2
15 files changed
+333
-186
No files matched your search
@@ -58,14 +58,15 @@ struct file_body
|
||||
}
|
||||
|
||||
std::uint64_t
|
||||
content_length() const
|
||||
content_length() const noexcept
|
||||
{
|
||||
return size_;
|
||||
}
|
||||
|
||||
template<class Write>
|
||||
template<class WriteFunction>
|
||||
boost::tribool
|
||||
operator()(resume_context&&, error_code&, Write&& write)
|
||||
write(resume_context&&, error_code&,
|
||||
WriteFunction&& wf) noexcept
|
||||
{
|
||||
if(size_ - offset_ < sizeof(buf_))
|
||||
buf_len_ = static_cast<std::size_t>(
|
||||
@@ -75,7 +76,7 @@ struct file_body
|
||||
auto const nread = fread(buf_, 1, sizeof(buf_), file_);
|
||||
(void)nread;
|
||||
offset_ += buf_len_;
|
||||
write(boost::asio::buffer(buf_, buf_len_));
|
||||
wf(boost::asio::buffer(buf_, buf_len_));
|
||||
return offset_ >= size_;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user