ChunkedBufferBody.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/web/protocol/http/outgoing/ChunkedBufferBody.hpp"

ChunkedBufferBody

Implementation of oatpp::web::protocol::http::outgoing::Body class. Implements functionality to use :oatpp::data::stream::ChunkedBuffer as data source for http body.

namespace oatpp { namespace web { namespace protocol { namespace http { namespace outgoing { 
  class ChunkedBufferBody : public oatpp::base::Countable, public Body, public std::enable_shared_from_this<ChunkedBufferBody> {}
}}}}}

Methods

Return Type Name Summary
[none] ChunkedBufferBody Constructor.
std::shared_ptr<ChunkedBufferBody> createShared Create shared ChunkedBufferBody.
void declareHeaders Add Transfer-Encoding: chunked header if chunked option was set to true.
void writeToStream Write body data to stream.
oatpp::async::CoroutineStarter writeToStreamAsync Start ChunkedBufferBody::WriteToStreamCoroutine to write buffer data to stream.

ChunkedBufferBody::ChunkedBufferBody

Constructor.

  • @param buffer - :oatpp::data::stream::ChunkedBuffer.
  • @param chunked - set true to send using HTTP chunked transfer encoding. Set false to send as body with specified Content-Length header.

ChunkedBufferBody(const std::shared_ptr<oatpp::data::stream::ChunkedBuffer>& buffer, bool chunked = false)

ChunkedBufferBody::createShared

Create shared ChunkedBufferBody.

  • @param buffer - :oatpp::data::stream::ChunkedBuffer.
  • @param chunked - set true to send using HTTP chunked transfer encoding. Set false to send as body with specified Content-Length header.
  • @return - std::shared_ptr to ChunkedBufferBody.

static std::shared_ptr<ChunkedBufferBody> createShared(const std::shared_ptr<oatpp::data::stream::ChunkedBuffer>& buffer, bool chunked = false)

ChunkedBufferBody::declareHeaders

Add Transfer-Encoding: chunked header if chunked option was set to true. Else, add Content-Length header if chunked option was set to false.

void declareHeaders(Headers& headers) noexcept override

ChunkedBufferBody::writeToStream

Write body data to stream.

void writeToStream(OutputStream* stream) noexcept override

ChunkedBufferBody::writeToStreamAsync

Start ChunkedBufferBody::WriteToStreamCoroutine to write buffer data to stream.

oatpp::async::CoroutineStarter writeToStreamAsync(const std::shared_ptr<OutputStream>& stream) override

ChunkedBufferBody::WriteToStreamCoroutine

Coroutine used to write ChunkedBufferBody to oatpp::data::stream::OutputStream.

namespace oatpp { namespace web { namespace protocol { namespace http { namespace outgoing { 
  class ChunkedBufferBody : public oatpp::base::Countable, public Body, public std::enable_shared_from_this<ChunkedBufferBody> {
    class WriteToStreamCoroutine : public oatpp::async::Coroutine<WriteToStreamCoroutine> {}
  };
}}}}}

Methods

Return Type Name Summary
[none] WriteToStreamCoroutine Constructor.

ChunkedBufferBody::WriteToStreamCoroutine::WriteToStreamCoroutine

Constructor.

  • @param body
  • @param stream

WriteToStreamCoroutine(const std::shared_ptr<ChunkedBufferBody>& body,
                       const std::shared_ptr<OutputStream>& stream)