mirror of
https://github.com/boostorg/beast.git
synced 2025-07-30 12:57:31 +02:00
finish(error_code&) is a BodyReader requirement (API Change)
This commit is contained in:
@ -11,6 +11,7 @@ API Changes:
|
|||||||
* Remove `opcode` from `read`, `async_read`
|
* Remove `opcode` from `read`, `async_read`
|
||||||
* `read_frame` returns `bool` fin
|
* `read_frame` returns `bool` fin
|
||||||
* `opcode` is private
|
* `opcode` is private
|
||||||
|
* finish(error_code&) is a BodyReader requirement
|
||||||
|
|
||||||
Actions Required:
|
Actions Required:
|
||||||
|
|
||||||
|
@ -91,6 +91,14 @@ In this table:
|
|||||||
or `false` if the buffer returned on this call is the last
|
or `false` if the buffer returned on this call is the last
|
||||||
buffer representing the body.
|
buffer representing the body.
|
||||||
]
|
]
|
||||||
|
][
|
||||||
|
[`a.finish(ec)`]
|
||||||
|
[]
|
||||||
|
[
|
||||||
|
This function is called after the reader indicates there
|
||||||
|
are no more buffers remaining.
|
||||||
|
If `ec` is set, the error will be propagated to the caller.
|
||||||
|
]
|
||||||
][
|
][
|
||||||
[`is_body_reader<B>`]
|
[`is_body_reader<B>`]
|
||||||
[`std::true_type`]
|
[`std::true_type`]
|
||||||
@ -155,9 +163,18 @@ public:
|
|||||||
A value of `false` means there is no more body data.
|
A value of `false` means there is no more body data.
|
||||||
|
|
||||||
@li If `ec` contains an error code, the return value is ignored.
|
@li If `ec` contains an error code, the return value is ignored.
|
||||||
|
|
||||||
|
@param ec Set to the error, if any occurred.
|
||||||
*/
|
*/
|
||||||
boost::optional<std::pair<const_buffers_type, bool>>
|
boost::optional<std::pair<const_buffers_type, bool>>
|
||||||
get(error_code& ec);
|
get(error_code& ec);
|
||||||
|
|
||||||
|
/** Called after `get` indicates there are no more buffers.
|
||||||
|
|
||||||
|
@param ec Set to the error, if any occurred.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
finish(error_code& ec);
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -90,6 +90,11 @@ struct file_body
|
|||||||
offset_ += nread;
|
offset_ += nread;
|
||||||
return {{const_buffers_type{buf_, nread}, offset_ < size_}};
|
return {{const_buffers_type{buf_, nread}, offset_ < size_}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
finish(error_code&)
|
||||||
|
{
|
||||||
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -137,6 +137,11 @@ struct buffer_body
|
|||||||
ec = error::need_buffer;
|
ec = error::need_buffer;
|
||||||
return boost::none;
|
return boost::none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
finish(error_code&)
|
||||||
|
{
|
||||||
|
}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -70,6 +70,11 @@ struct basic_dynamic_body
|
|||||||
{
|
{
|
||||||
return {{body_.data(), false}};
|
return {{body_.data(), false}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
finish(error_code&)
|
||||||
|
{
|
||||||
|
}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -72,6 +72,11 @@ struct empty_body
|
|||||||
{
|
{
|
||||||
return boost::none;
|
return boost::none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
finish(error_code&)
|
||||||
|
{
|
||||||
|
}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -250,6 +250,10 @@ get(error_code& ec, Visit&& visit)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
go_complete:
|
go_complete:
|
||||||
|
if(rd_)
|
||||||
|
rd_->finish(ec);
|
||||||
|
if(ec)
|
||||||
|
return;
|
||||||
s_ = do_complete;
|
s_ = do_complete;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -73,6 +73,11 @@ struct string_body
|
|||||||
return {{const_buffers_type{
|
return {{const_buffers_type{
|
||||||
body_.data(), body_.size()}, false}};
|
body_.data(), body_.size()}, false}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
finish(error_code&)
|
||||||
|
{
|
||||||
|
}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -83,6 +83,7 @@ struct is_body_reader<T, beast::detail::void_t<
|
|||||||
std::declval<boost::optional<std::pair<
|
std::declval<boost::optional<std::pair<
|
||||||
typename T::reader::const_buffers_type, bool>>&>() =
|
typename T::reader::const_buffers_type, bool>>&>() =
|
||||||
std::declval<typename T::reader>().get(std::declval<error_code&>()),
|
std::declval<typename T::reader>().get(std::declval<error_code&>()),
|
||||||
|
std::declval<typename T::reader&>().finish(std::declval<error_code&>()),
|
||||||
(void)0)>> : std::integral_constant<bool,
|
(void)0)>> : std::integral_constant<bool,
|
||||||
is_const_buffer_sequence<
|
is_const_buffer_sequence<
|
||||||
typename T::reader::const_buffers_type>::value &&
|
typename T::reader::const_buffers_type>::value &&
|
||||||
|
@ -65,6 +65,11 @@ public:
|
|||||||
return {{const_buffers_type{
|
return {{const_buffers_type{
|
||||||
body_.data(), body_.size()}, false}};
|
body_.data(), body_.size()}, false}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
finish(error_code&)
|
||||||
|
{
|
||||||
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -115,6 +120,11 @@ public:
|
|||||||
std::integral_constant<bool, isFinalEmpty>{});
|
std::integral_constant<bool, isFinalEmpty>{});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
finish(error_code&)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
boost::optional<std::pair<const_buffers_type, bool>>
|
boost::optional<std::pair<const_buffers_type, bool>>
|
||||||
get(
|
get(
|
||||||
@ -253,6 +263,12 @@ public:
|
|||||||
return {{const_buffers_type{
|
return {{const_buffers_type{
|
||||||
body_.s_.data() + n_++, 1}, true}};
|
body_.s_.data() + n_++, 1}, true}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
finish(error_code& ec)
|
||||||
|
{
|
||||||
|
body_.fc_.fail(ec);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user