aboutsummaryrefslogtreecommitdiff
path: root/zenhttp/httpsys.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'zenhttp/httpsys.cpp')
-rw-r--r--zenhttp/httpsys.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/zenhttp/httpsys.cpp b/zenhttp/httpsys.cpp
index 737cee509..9ee004c5c 100644
--- a/zenhttp/httpsys.cpp
+++ b/zenhttp/httpsys.cpp
@@ -1010,9 +1010,18 @@ HttpSysTransaction::InvokeRequestHandler(HttpService& Service, IoBuffer Payload)
m_PackageHandler = Service.HandlePackageRequest(ThisRequest);
+ // TODO: this should really be done in a streaming fashion, currently this emulates
+ // the intended flow from an API perspective
+
if (m_PackageHandler)
{
- CbPackage Package = ParsePackageMessage(ThisRequest.ReadPayload());
+ m_PackageHandler->OnRequestBegin();
+
+ auto CreateBuffer = [&](const IoHash& Cid, uint64_t Size) -> IoBuffer { return m_PackageHandler->CreateTarget(Cid, Size); };
+
+ CbPackage Package = ParsePackageMessage(ThisRequest.ReadPayload(), CreateBuffer);
+
+ m_PackageHandler->OnRequestComplete();
}
}
}
@@ -1313,7 +1322,8 @@ InitialRequestHandler::HandleCompletion(ULONG IoResult, ULONG_PTR NumberOfBytesT
{
if (m_IsInitialRequest)
{
- m_ContentLength = GetContentLength(HttpReq);
+ m_ContentLength = GetContentLength(HttpReq);
+ const HttpContentType ContentType = GetContentType(HttpReq);
if (m_ContentLength)
{
@@ -1321,8 +1331,6 @@ InitialRequestHandler::HandleCompletion(ULONG IoResult, ULONG_PTR NumberOfBytesT
// into our embedded request buffer
m_PayloadBuffer = IoBuffer(m_ContentLength);
-
- HttpContentType ContentType = GetContentType(HttpReq);
m_PayloadBuffer.SetContentType(ContentType);
uint64_t BytesToRead = m_ContentLength;