mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd::resource: Make response head buffer size a named const; fix comment.
This commit is contained in:
parent
6fc078395b
commit
74bb040b8c
2 changed files with 12 additions and 4 deletions
|
@ -143,6 +143,8 @@ struct ircd::resource::response
|
|||
{
|
||||
struct chunked;
|
||||
|
||||
static const size_t HEAD_BUF_SZ;
|
||||
|
||||
response(client &, const http::code &, const string_view &content_type, const size_t &content_length, const string_view &headers = {});
|
||||
response(client &, const string_view &str, const string_view &content_type, const http::code &, const vector_view<const http::header> &);
|
||||
response(client &, const string_view &str, const string_view &content_type, const http::code & = http::OK, const string_view &headers = {});
|
||||
|
|
|
@ -740,6 +740,14 @@ catch(...)
|
|||
// resource::response
|
||||
//
|
||||
|
||||
// A buffer of this size will be passed to the socket and sent
|
||||
// out and must be on stack.
|
||||
decltype(ircd::resource::response::HEAD_BUF_SZ)
|
||||
ircd::resource::response::HEAD_BUF_SZ
|
||||
{
|
||||
4_KiB
|
||||
};
|
||||
|
||||
ircd::resource::response::response(client &client,
|
||||
const http::code &code)
|
||||
:response{client, json::object{json::empty_object}, code}
|
||||
|
@ -960,9 +968,7 @@ ircd::resource::response::response(client &client,
|
|||
"%zd$us", request_time
|
||||
};
|
||||
|
||||
// This buffer will be passed to the socket and sent out;
|
||||
// cannot be static/tls.
|
||||
char head_buf[4_KiB];
|
||||
char head_buf[HEAD_BUF_SZ];
|
||||
window_buffer head{head_buf};
|
||||
http::response
|
||||
{
|
||||
|
@ -977,7 +983,7 @@ ircd::resource::response::response(client &client,
|
|||
},
|
||||
};
|
||||
|
||||
// Maximum size is is realistically ok but ideally a small
|
||||
// Maximum size is realistically ok but ideally a small
|
||||
// maximum; this exception should hit the developer in testing.
|
||||
if(unlikely(!head.remaining()))
|
||||
throw assertive
|
||||
|
|
Loading…
Reference in a new issue