# HttpProcessor.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/web/server/HttpProcessor.hpp"

# HttpProcessor

HttpProcessor. Helper class to handle HTTP processing.

namespace oatpp { namespace web { namespace server { 
  class HttpProcessor {}
}}}

# HttpProcessor::Config

Resource config per connection.

namespace oatpp { namespace web { namespace server { 
  class HttpProcessor {
    struct Config {}
  };
}}}

# Fields

Type Name Summary
v_buff_size headersInBufferInitial Buffer used to read headers in request. Initial size of the buffer.
v_buff_size headersOutBufferInitial Buffer used to write headers in response. Initial size of the buffer.
v_buff_size headersReaderChunkSize Size of the chunk used for iterative-read of headers.
v_buff_size headersReaderMaxSize Maximum allowed size of requests headers. The overall size of all headers in the request.

# HttpProcessor::Config::headersInBufferInitial

Buffer used to read headers in request. Initial size of the buffer.

v_buff_size headersInBufferInitial = 2048

# HttpProcessor::Config::headersOutBufferInitial

Buffer used to write headers in response. Initial size of the buffer.

v_buff_size headersOutBufferInitial = 2048

# HttpProcessor::Config::headersReaderChunkSize

Size of the chunk used for iterative-read of headers.

v_buff_size headersReaderChunkSize = 2048

# HttpProcessor::Config::headersReaderMaxSize

Maximum allowed size of requests headers. The overall size of all headers in the request.

v_buff_size headersReaderMaxSize = 4096

# HttpProcessor::Components

Collection of components needed to serve http-connection.

namespace oatpp { namespace web { namespace server { 
  class HttpProcessor {
    struct Components {}
  };
}}}

# Fields

Type Name Summary
std::shared_ptr<HttpRouter> router Router to route incoming requests. oatpp::web::server::HttpRouter.
std::shared_ptr<protocol::http::encoding::ProviderCollection> contentEncodingProviders Content-encoding providers. oatpp::web::protocol::encoding::ProviderCollection.
std::shared_ptr<const oatpp::web::protocol::http::incoming::BodyDecoder> bodyDecoder Body decoder. oatpp::web::protocol::http::incoming::BodyDecoder.
std::shared_ptr<handler::ErrorHandler> errorHandler Error handler. oatpp::web::server::handler::ErrorHandler.
RequestInterceptors requestInterceptors Collection of request interceptors. oatpp::web::server::interceptor::RequestInterceptor.
ResponseInterceptors responseInterceptors Collection of request interceptors. oatpp::web::server::interceptor::ResponseInterceptor.
std::shared_ptr<Config> config Resource allocation config. HttpProcessor::Config.

# Methods

Return Type Name Summary
[none] Components Multiple implementations:
  1. Constructor.
  2. Constructor.
  3. Constructor.

# HttpProcessor::Components::router

Router to route incoming requests. oatpp::web::server::HttpRouter.

std::shared_ptr<HttpRouter> router

# HttpProcessor::Components::contentEncodingProviders

Content-encoding providers. oatpp::web::protocol::encoding::ProviderCollection.

std::shared_ptr<protocol::http::encoding::ProviderCollection> contentEncodingProviders

# HttpProcessor::Components::bodyDecoder

Body decoder. oatpp::web::protocol::http::incoming::BodyDecoder.

std::shared_ptr<const oatpp::web::protocol::http::incoming::BodyDecoder> bodyDecoder

# HttpProcessor::Components::errorHandler

Error handler. oatpp::web::server::handler::ErrorHandler.

std::shared_ptr<handler::ErrorHandler> errorHandler

# HttpProcessor::Components::requestInterceptors

Collection of request interceptors. oatpp::web::server::interceptor::RequestInterceptor.

RequestInterceptors requestInterceptors

# HttpProcessor::Components::responseInterceptors

Collection of request interceptors. oatpp::web::server::interceptor::ResponseInterceptor.

ResponseInterceptors responseInterceptors

# HttpProcessor::Components::config

Resource allocation config. HttpProcessor::Config.

std::shared_ptr<Config> config

# HttpProcessor::Components::Components

  1. Constructor.
    • @param pRouter
    • @param pContentEncodingProviders
    • @param pBodyDecoder
    • @param pErrorHandler
    • @param pRequestInterceptors
    • @param pConfig
    Components(const std::shared_ptr<HttpRouter>& pRouter,
               const std::shared_ptr<protocol::http::encoding::ProviderCollection>& pContentEncodingProviders,
               const std::shared_ptr<const oatpp::web::protocol::http::incoming::BodyDecoder>& pBodyDecoder,
               const std::shared_ptr<handler::ErrorHandler>& pErrorHandler,
               const RequestInterceptors& pRequestInterceptors,
               const ResponseInterceptors& pResponseInterceptors,
               const std::shared_ptr<Config>& pConfig)
    
  2. Constructor.
    • @param pRouter
    Components(const std::shared_ptr<HttpRouter>& pRouter)
    
  3. Constructor.
    • @param pRouter
    • @param pConfig
    Components(const std::shared_ptr<HttpRouter>& pRouter, const std::shared_ptr<Config>& pConfig)
    

# HttpProcessor::TaskProcessingListener

Listener of the connection processing task.

namespace oatpp { namespace web { namespace server { 
  class HttpProcessor {
    class TaskProcessingListener {}
  };
}}}

# HttpProcessor::Task

Connection serving task.
Usege example:
std::thread thread(HttpProcessor::Task::run, HttpProcessor::Task(components, connection));

namespace oatpp { namespace web { namespace server { 
  class HttpProcessor {
    class Task : public base::Countable {}
  };
}}}

# Fields

Type Name Summary
Task& operator Move-Assignment to correctly count tasks.
  • @param t
  • @return

# Methods

Return Type Name Summary
[none] Task Multiple implementations:
  1. Constructor.
  2. Move-Constructor to correclty count tasks;
[none] ~Task Destructor, needed for counting.
void run Run loop.

# HttpProcessor::Task::operator

Move-Assignment to correctly count tasks.

  • @param t
  • @return

Task &operator=(Task &&other)

# HttpProcessor::Task::Task

  1. Constructor.
    Task(const std::shared_ptr<Components>& components,
         const provider::ResourceHandle<oatpp::data::stream::IOStream>& connection,
         TaskProcessingListener* taskListener)
    
  2. Move-Constructor to correclty count tasks;
    Task(Task &&other)
    

# HttpProcessor::Task::~Task

Destructor, needed for counting.

~Task() override

# HttpProcessor::Task::run

Run loop.

void run()

# HttpProcessor::Coroutine

Connection serving coroutiner - oatpp::async::Coroutine.

namespace oatpp { namespace web { namespace server { 
  class HttpProcessor {
    class Coroutine : public oatpp::async::Coroutine<HttpProcessor::Coroutine> {}
  };
}}}

# Methods

Return Type Name Summary
[none] Coroutine Constructor.

# HttpProcessor::Coroutine::Coroutine

Constructor.

Coroutine(const std::shared_ptr<Components>& components,
          const provider::ResourceHandle<oatpp::data::stream::IOStream>& connection,
          TaskProcessingListener* taskListener)