aboutsummaryrefslogtreecommitdiff
path: root/zencore/httpserver.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-05-12 09:25:39 +0200
committerStefan Boberg <[email protected]>2021-05-12 09:25:39 +0200
commit6a74449307c699172dc4c93e1a0e8ecfbaced675 (patch)
tree1ea3433a4a2c3f1ed1bc92608396797e46edaff5 /zencore/httpserver.cpp
parentImplemented basic support for marshaling attachments out-of-band with the pac... (diff)
downloadzen-6a74449307c699172dc4c93e1a0e8ecfbaced675.tar.xz
zen-6a74449307c699172dc4c93e1a0e8ecfbaced675.zip
Added chunking to HttpSysServerRequest::ReadPayload to deal with large payloads better
Diffstat (limited to 'zencore/httpserver.cpp')
-rw-r--r--zencore/httpserver.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/zencore/httpserver.cpp b/zencore/httpserver.cpp
index 52389a11b..22cba4d75 100644
--- a/zencore/httpserver.cpp
+++ b/zencore/httpserver.cpp
@@ -1044,15 +1044,19 @@ public:
// Call http.sys API to receive the remaining data
+ static const uint64_t kMaxBytesPerApiCall = 1 * 1024 * 1024;
+
while (BytesToRead)
{
ULONG BytesRead = 0;
+ const uint64_t BytesToReadThisCall = zen::Min(BytesToRead, kMaxBytesPerApiCall);
+
ULONG ApiResult = HttpReceiveRequestEntityBody(m_HttpTx.RequestQueueHandle(),
HttpReq->RequestId,
0, /* Flags */
ReadPointer,
- (ULONG)BytesToRead,
+ gsl::narrow<ULONG>(BytesToReadThisCall),
&BytesRead,
NULL /* Overlapped */
);