forgot to add httprequestbody code
This commit is contained in:
parent
0e2d0a2d7e
commit
fc43f006a9
|
@ -9,6 +9,7 @@ namespace Tesses::Framework::Http
|
|||
public:
|
||||
virtual void HandleHeaders(HttpDictionary& dict);
|
||||
virtual void Write(Tesses::Framework::Streams::Stream* strm)=0;
|
||||
virtual ~HttpRequestBody();
|
||||
};
|
||||
|
||||
class StreamHttpRequestBody : public HttpRequestBody {
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "TextStreams/StreamReader.hpp"
|
||||
#include "TextStreams/StreamWriter.hpp"
|
||||
#include "Threading/Thread.hpp"
|
||||
#include "Threading/Mutex.hpp"
|
||||
#include "Filesystem/LocalFS.hpp"
|
||||
#include "Filesystem/SubdirFilesystem.hpp"
|
||||
#include "Filesystem/NullFilesystem.hpp"
|
||||
|
|
|
@ -15,6 +15,40 @@ using BufferedStream = Tesses::Framework::Streams::BufferedStream;
|
|||
using HttpStream = Tesses::Framework::Http::HttpStream;
|
||||
namespace Tesses::Framework::Http
|
||||
{
|
||||
|
||||
|
||||
void HttpRequestBody::HandleHeaders(HttpDictionary& dict)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
HttpRequestBody::~HttpRequestBody()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
StreamHttpRequestBody::StreamHttpRequestBody(Stream* strm, bool owns, std::string mimeType)
|
||||
{
|
||||
this->strm = strm;
|
||||
this->owns = owns;
|
||||
this->mimeType = mimeType;
|
||||
}
|
||||
void StreamHttpRequestBody::HandleHeaders(HttpDictionary& dict)
|
||||
{
|
||||
dict.AddValue("Content-Type",this->mimeType);
|
||||
auto len = this->strm->GetLength();
|
||||
if(len > -1) dict.AddValue("Content-Length",std::to_string(len));
|
||||
|
||||
}
|
||||
void StreamHttpRequestBody::Write(Tesses::Framework::Streams::Stream* strm)
|
||||
{
|
||||
strm->CopyTo(this->strm);
|
||||
}
|
||||
StreamHttpRequestBody::~StreamHttpRequestBody()
|
||||
{
|
||||
if(this->owns)
|
||||
delete this->strm;
|
||||
}
|
||||
HttpRequest::HttpRequest()
|
||||
{
|
||||
this->body=nullptr;
|
||||
|
|
Loading…
Reference in New Issue