mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 13:42:10 +02:00
http: reuse HTTPHeaders to parse chunked trailer
Chunked transfer trailers are just headers that are included at the end of the request. We can parse and validate them with code we already use to read headers. In a future commit we will also be able to use one MAX_HEADERS_SIZE limit to cover both sections. Even though we parse and validate, we ignore these data.
This commit is contained in:
@@ -104,13 +104,15 @@ public:
|
||||
*/
|
||||
void RemoveAll(std::string_view key);
|
||||
/**
|
||||
* @param[in] reader A LineReader instance initialized with the client's receive buffer.
|
||||
* @param[in] write Whether or not to write the parsed data to the object after validation.
|
||||
* @returns false if LineReader hits the end of the buffer before reading an
|
||||
* \n, meaning that we are still waiting on more data from the client.
|
||||
* true after reading an entire HTTP headers section, terminated
|
||||
* by an empty line and \n.
|
||||
* @throws on exceeded read limit and on bad headers syntax (e.g. no ":" in a line)
|
||||
*/
|
||||
bool Read(util::LineReader& reader);
|
||||
bool Read(util::LineReader& reader, bool write = true);
|
||||
std::string Stringify() const;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user