mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 18:22:50 +01:00
ircd::http: Cleanup cruft; remove old chunking.
This commit is contained in:
parent
2872a94b38
commit
9723eec4e8
2 changed files with 2 additions and 84 deletions
|
@ -20,7 +20,6 @@ namespace ircd::http
|
|||
struct query;
|
||||
struct header;
|
||||
struct headers;
|
||||
struct content;
|
||||
struct request;
|
||||
struct response;
|
||||
|
||||
|
@ -29,9 +28,8 @@ namespace ircd::http
|
|||
|
||||
void writeline(window_buffer &);
|
||||
void writeline(window_buffer &, const window_buffer::closure &);
|
||||
|
||||
void write(window_buffer &out, const header &);
|
||||
void write(window_buffer &out, const vector_view<const header> &);
|
||||
void write(window_buffer &, const header &);
|
||||
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> &);
|
||||
}
|
||||
|
@ -225,8 +223,6 @@ struct ircd::http::request
|
|||
{
|
||||
struct head;
|
||||
|
||||
using proffer = std::function<void (const head &)>;
|
||||
|
||||
// compose a request into buffer
|
||||
request(window_buffer &,
|
||||
const string_view &host,
|
||||
|
@ -264,10 +260,6 @@ struct ircd::http::request::head
|
|||
struct ircd::http::response
|
||||
{
|
||||
struct head;
|
||||
struct chunked;
|
||||
|
||||
using write_closure = std::function<void (const ilist<const const_buffer> &)>;
|
||||
using proffer = std::function<void (const head &)>;
|
||||
|
||||
// compose a response into buffer
|
||||
response(window_buffer &,
|
||||
|
@ -281,26 +273,6 @@ struct ircd::http::response
|
|||
response() = default;
|
||||
};
|
||||
|
||||
struct ircd::http::response::chunked
|
||||
:response
|
||||
{
|
||||
struct chunk;
|
||||
|
||||
write_closure closure;
|
||||
|
||||
chunked(const code &,
|
||||
const write_closure &,
|
||||
const vector_view<const header> &headers);
|
||||
|
||||
chunked(const chunked &) = delete;
|
||||
~chunked() noexcept;
|
||||
};
|
||||
|
||||
struct ircd::http::response::chunked::chunk
|
||||
{
|
||||
chunk(chunked &, const const_buffer &);
|
||||
};
|
||||
|
||||
/// Represents an HTTP response head. This is for receiving responses only.
|
||||
///
|
||||
struct ircd::http::response::head
|
||||
|
|
54
ircd/http.cc
54
ircd/http.cc
|
@ -367,60 +367,6 @@ ircd::http::response::response(window_buffer &out,
|
|||
writeline(out);
|
||||
}
|
||||
|
||||
ircd::http::response::chunked::chunked(const code &code,
|
||||
const write_closure &closure,
|
||||
const vector_view<const header> &user_headers)
|
||||
:closure{closure}
|
||||
{
|
||||
const auto num_headers
|
||||
{
|
||||
user_headers.size() + 1
|
||||
};
|
||||
|
||||
header headers[num_headers]
|
||||
{
|
||||
{ "Transfer-Encoding", "chunked" }
|
||||
};
|
||||
|
||||
std::copy(begin(user_headers), end(user_headers), headers + 1);
|
||||
|
||||
//TODO: bitrot
|
||||
assert(0);
|
||||
/*
|
||||
response
|
||||
{
|
||||
code, {}, closure, { headers, headers + num_headers }
|
||||
};
|
||||
*/
|
||||
}
|
||||
|
||||
ircd::http::response::chunked::~chunked()
|
||||
noexcept
|
||||
{
|
||||
chunk(*this, null_buffer);
|
||||
}
|
||||
|
||||
ircd::http::response::chunked::chunk::chunk(chunked &chunked,
|
||||
const const_buffer &buffer)
|
||||
{
|
||||
char size_buf[16];
|
||||
const auto size_size
|
||||
{
|
||||
snprintf(size_buf, sizeof(size_buf), "%lx", size(buffer))
|
||||
};
|
||||
|
||||
const ilist<const const_buffer> iov
|
||||
{
|
||||
{ size_buf, size_t(size_size) },
|
||||
{ "\r\n", 2 },
|
||||
{ buffer },
|
||||
{ "\r\n", 2 },
|
||||
};
|
||||
|
||||
assert(bool(chunked.closure));
|
||||
chunked.closure(iov);
|
||||
}
|
||||
|
||||
ircd::http::response::head::head(parse::capstan &pc,
|
||||
const headers::closure &c)
|
||||
:line::response{pc}
|
||||
|
|
Loading…
Reference in a new issue