Add server content data and mountableserver

This commit is contained in:
2025-01-12 19:32:19 -06:00
parent c80a5c503a
commit 4ce3526047
11 changed files with 265 additions and 19 deletions

View File

@@ -379,10 +379,23 @@ namespace Tesses::Framework::Http
{
if(strm == nullptr) return;
SendStream(*strm);
}
ServerContext::~ServerContext()
{
for(auto item : this->data)
{
delete item.second;
}
}
ServerContextData::~ServerContextData()
{
}
void ServerContext::SendStream(Stream& strm)
{
if(sent) return;
if(!strm.CanRead()) throw TextException("Cannot read from stream");
if(strm.EndOfStream()) throw TextException("End of stream");
if(strm.CanSeek())
{
int64_t len=strm.GetLength();
@@ -666,6 +679,11 @@ namespace Tesses::Framework::Http
{
ctx.SendException(ex);
}
catch(...)
{
TextException ex("An unknown error occurred");
ctx.SendException(ex);
}
if(ctx.version != "HTTP/1.1" ) return;