Initial quantum compute and cleaning up win server.
This commit is contained in:
parent
af50eea208
commit
5362b694e0
45 changed files with 884 additions and 429 deletions
34
src/network/server/win32/Win32WebResponse.cpp
Normal file
34
src/network/server/win32/Win32WebResponse.cpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
#include "Win32WebResponse.h"
|
||||
|
||||
#include "HttpResponse.h"
|
||||
|
||||
Win32WebResponse::Win32WebResponse(const HttpResponse& response)
|
||||
{
|
||||
RtlZeroMemory((&mResponse), sizeof(*(&mResponse)));
|
||||
mResponse.StatusCode = response.getStatusCode();
|
||||
|
||||
std::string reason = response.getResponseReason();
|
||||
mResponse.pReason = reason.c_str();
|
||||
mResponse.ReasonLength = (USHORT)strlen(reason.c_str());
|
||||
|
||||
const std::string content_type = "text / html";
|
||||
mResponse.Headers.KnownHeaders[HttpHeaderContentType].pRawValue = content_type.c_str();
|
||||
mResponse.Headers.KnownHeaders[HttpHeaderContentType].RawValueLength = (USHORT)strlen(content_type.c_str());
|
||||
|
||||
auto body = response.getBody();
|
||||
if (!body.empty())
|
||||
{
|
||||
HTTP_DATA_CHUNK dataChunk;
|
||||
dataChunk.DataChunkType = HttpDataChunkFromMemory;
|
||||
dataChunk.FromMemory.pBuffer = body.data();
|
||||
dataChunk.FromMemory.BufferLength = (ULONG)strlen(body.data());
|
||||
|
||||
mResponse.EntityChunkCount = 1;
|
||||
mResponse.pEntityChunks = &dataChunk;
|
||||
}
|
||||
}
|
||||
|
||||
HTTP_RESPONSE& Win32WebResponse::getResponse()
|
||||
{
|
||||
return mResponse;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue