diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2021-09-10 09:04:56 -0400 |
---|---|---|
committer | Ashod Nakashian <Ashod@users.noreply.github.com> | 2021-09-26 17:02:01 -0400 |
commit | 347fd43f7c792841f7fdc98aeb76f7bf49a7ede2 (patch) | |
tree | f5360c96f4bee4433dbd98e81e660b651286e78c /net | |
parent | wsd: verify that the last-editing-session can save (diff) | |
download | online-347fd43f7c792841f7fdc98aeb76f7bf49a7ede2.tar.gz online-347fd43f7c792841f7fdc98aeb76f7bf49a7ede2.zip |
wsd: chunked transfer and tests
Change-Id: I07f7f126891f4d6b5137b45bf91cbcaa11796cda
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 866cb8f2f25e958f834adc51e2191fb60e2e85b9)
Diffstat (limited to 'net')
-rw-r--r-- | net/HttpRequest.hpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/net/HttpRequest.hpp b/net/HttpRequest.hpp index a2ac23cf39..f106d665b8 100644 --- a/net/HttpRequest.hpp +++ b/net/HttpRequest.hpp @@ -301,7 +301,7 @@ public: { for (const auto& pair : _headers) { - if (pair.first == key) + if (Util::iequal(pair.first, key)) return true; } @@ -316,7 +316,7 @@ public: // probably not be faster but would add complexity. for (const auto& pair : _headers) { - if (pair.first == key) + if (Util::iequal(pair.first, key)) return pair.second; } @@ -778,6 +778,14 @@ public: _header.setContentType(std::move(contentType)); } + /// Append a chunk to the body. Must have Transfer-Encoding: chunked. + void appendChunk(const std::string& chunk) + { + std::stringstream ss; + ss << std::hex << chunk.size() << "\r\n" << chunk << "\r\n"; + _body.append(ss.str()); + } + /// Handles incoming data (from the Server) in the Client. /// Returns the number of bytes consumed, or -1 for error /// and/or to interrupt transmission. |