summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2021-09-10 09:04:56 -0400
committerAshod Nakashian <Ashod@users.noreply.github.com>2021-09-26 17:02:01 -0400
commit347fd43f7c792841f7fdc98aeb76f7bf49a7ede2 (patch)
treef5360c96f4bee4433dbd98e81e660b651286e78c /net
parentwsd: verify that the last-editing-session can save (diff)
downloadonline-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.hpp12
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.