RTBKit  0.9
Open-source framework to create real-time ad bidding systems.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Public Types | Public Member Functions | Public Attributes
Datacratic::HttpConnectionHandler Struct Reference

#include <http_endpoint.h>

Inheritance diagram for Datacratic::HttpConnectionHandler:
Datacratic::PassiveConnectionHandler Datacratic::ConnectionHandler Datacratic::ChunkedHttpHandler Datacratic::HttpMonitorHandler< Handler, Arg > Datacratic::HttpNamedEndpoint::RestConnectionHandler Datacratic::JsonConnectionHandler Datacratic::HttpMonitorHandler< RouterRestApiConnection, Router * > RTBKIT::HttpAuctionHandler Datacratic::AdHocJsonConnectionHandler RTBKIT::HttpAdServerConnectionHandler RTBKIT::RouterRestApiConnection

List of all members.

Public Types

enum  ReadState {
  INVALID, HEADER, PAYLOAD, CHUNK_HEADER,
  CHUNK_BODY, DONE
}

Public Member Functions

virtual void onGotTransport ()
std::shared_ptr
< ConnectionHandler
makeNewHandlerShared ()
virtual void handleData (const std::string &data)
virtual void handleSendFinished ()
virtual void handleError (const std::string &message)
virtual void onCleanup ()
virtual void handleHttpHeader (const HttpHeader &header)
virtual void handleHttpData (const std::string &data)
virtual void handleHttpPayload (const HttpHeader &header, const std::string &payload)
virtual void handleHttpChunk (const HttpHeader &header, const std::string &chunkHeader, const std::string &chunk)
void sendHttpChunk (const std::string &chunk, NextAction next=NEXT_CONTINUE, OnWriteFinished onWriteFinished=OnWriteFinished())
virtual void putResponseOnWire (HttpResponse response, std::function< void()> onSendFinished=std::function< void()>())

Public Attributes

enum
Datacratic::HttpConnectionHandler::ReadState 
readState
std::string headerText
HttpHeader header
std::string payload
std::string chunkHeader
size_t chunkSize
std::string chunkBody
Date firstData
HttpEndpointhttpEndpoint

Detailed Description

A connection handler that deals with HTTP connections.

This will handle parsing the header, but will forward the data off to another slave handler. It's the HTTP Endpoint's responsibility to generate a slave handler once a header is received.

Definition at line 75 of file http_endpoint.h.


Member Function Documentation

void Datacratic::HttpConnectionHandler::handleData ( const std::string &  data) [virtual]

Function called out to when we got some data

Implements Datacratic::PassiveConnectionHandler.

Definition at line 56 of file http_endpoint.cc.

void Datacratic::HttpConnectionHandler::handleError ( const std::string &  message) [virtual]

Function called out to when we got an error from the socket.

Implements Datacratic::PassiveConnectionHandler.

Reimplemented in Datacratic::ChunkedHttpHandler.

Definition at line 301 of file http_endpoint.cc.

void Datacratic::HttpConnectionHandler::handleHttpChunk ( const HttpHeader header,
const std::string &  chunkHeader,
const std::string &  chunk 
) [virtual]

Called when a chunk comes through. Default will call handleHttpPayload.

Reimplemented in Datacratic::JsonConnectionHandler, and Datacratic::ChunkedHttpHandler.

Definition at line 266 of file http_endpoint.cc.

void Datacratic::HttpConnectionHandler::handleHttpData ( const std::string &  data) [virtual]

Called for each packet of data that comes through. Default concatenates them together into a payload and calls handleHttpPayload once done.

Definition at line 143 of file http_endpoint.cc.

Called when the HTTP header comes through. Default will pass it back to the endpoint to do something with it.

Reimplemented in Datacratic::JsonConnectionHandler.

Definition at line 136 of file http_endpoint.cc.

void Datacratic::HttpConnectionHandler::handleHttpPayload ( const HttpHeader header,
const std::string &  payload 
) [virtual]

Called once the entire payload has come through. Default will throw. Will be called multiple times for chunked encoding.

Reimplemented in Datacratic::HttpNamedEndpoint::RestConnectionHandler, Datacratic::HttpMonitorHandler< Handler, Arg >, Datacratic::HttpMonitorHandler< RouterRestApiConnection, Router * >, RTBKIT::HttpAuctionHandler, and Datacratic::JsonConnectionHandler.

Definition at line 276 of file http_endpoint.cc.

Create a new connection handler. Delegates to the endpoint. This is used after a response is sent to set the connection up for a new request.

Reimplemented in Datacratic::ChunkedHttpHandler.

Definition at line 46 of file http_endpoint.cc.

Function called out to to clean up before we finish for whatever reason.

Reimplemented from Datacratic::ConnectionHandler.

Reimplemented in RTBKIT::HttpAuctionHandler.

Definition at line 308 of file http_endpoint.cc.

Function called when we ge the transport.

Reimplemented from Datacratic::ConnectionHandler.

Reimplemented in RTBKIT::HttpAuctionHandler, and Datacratic::ChunkedHttpHandler.

Definition at line 36 of file http_endpoint.cc.

void Datacratic::HttpConnectionHandler::putResponseOnWire ( HttpResponse  response,
std::function< void()>  onSendFinished = std::function<void ()>() 
) [virtual]

Handle sending an HTTP response.

Calls the given callback once done.

Definition at line 314 of file http_endpoint.cc.

void Datacratic::HttpConnectionHandler::sendHttpChunk ( const std::string &  chunk,
NextAction  next = NEXT_CONTINUE,
OnWriteFinished  onWriteFinished = OnWriteFinished() 
)

Send an HTTP chunk with the appropriate headers back down the wire.

Definition at line 290 of file http_endpoint.cc.


Member Data Documentation

The chunk header we're accumulating.

Definition at line 98 of file http_endpoint.h.

When we first got data.

Definition at line 103 of file http_endpoint.h.

The actual header

Definition at line 92 of file http_endpoint.h.

Accumulated text for the header.

Definition at line 89 of file http_endpoint.h.

The payload we're accumulating.

Definition at line 95 of file http_endpoint.h.


The documentation for this struct was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator