libutil++  1.9.3
 All Classes Functions Variables
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
sella::server::HTTPConnection Class Reference

#include <HTTPConnection.h>

Public Types

enum  Compression : uint8_t { None, Gzip, Deflate }
 
typedef std::shared_ptr
< HTTPConnection
shared
 

Public Member Functions

 HTTPConnection (const HTTP &http, sella::net::TCPSocket::shared &socket, timeval tv=ReceiveTimeoutDefault) throw ()
 
const HTTPRequestgetRequest (void) throw (ServerException)
 
struct timespec getRuntime (void) const throw ()
 
bool isUsable (void) const throw ()
 
bool isSecure (void) const throw ()
 
void response (const std::string &body, const std::string &contentType=ContentTypeDefault, bool close=true) throw (ServerException)
 
void response (const std::vector< char > &content, const std::string &contentType, bool close=true) throw (ServerException)
 
void error (int code, const std::string &detail=std::string(), const std::string &contentType=ContentTypeDefault) throw (ServerException)
 
void error (int code, const std::vector< char > &content, const std::string &contentType=ContentTypeDefault) throw (ServerException)
 
void methodOptions (void) throw (ServerException)
 
void methodGet (void) throw (ServerException)
 
void methodHead (void) throw (ServerException)
 
void methodPost (void) throw (ServerException)
 
void methodPut (void) throw (ServerException)
 
void methodDelete (void) throw (ServerException)
 
void methodTrace (void) throw (ServerException)
 
void methodConnect (void) throw (ServerException)
 
void methodPatch (void) throw (ServerException)
 
sella::net::IPAddressPort getLocalIPAddressPort (void) const throw (ServerException)
 
sella::net::IPAddressPort getRemoteIPAddressPort (void) const throw (ServerException)
 
const char * getSSLLibraryVersion (void) const throw ()
 
const char * getActiveProtocol (void) const throw ()
 
const char * getActiveCipher (void) const throw ()
 
std::string getContentType (HTTPRequest::AcceptType type, const std::string &fallback=std::string()) const throw ()
 
void clear (void) throw ()
 

Static Public Member Functions

static const HTTPConnection::shared shared_ptr (const HTTP &http, sella::net::TCPSocket::shared &socket, timeval tv=ReceiveTimeoutDefault) throw ()
 

Static Public Attributes

static const timeval ReceiveTimeoutDefault = { 30, 0 }
 
static const std::string MIMEFallback = "text/plain; charset=us-ascii"
 
static const std::string ContentTypeDefault = "text/html; charset=iso-8859-1"
 

Protected Member Functions

void response (int code, const std::string &body, const std::string &contentType=ContentTypeDefault, bool close=true) throw (ServerException)
 
void response (int code, const std::vector< char > &content, const std::string &contentType, bool close=true) throw (ServerException)
 
void sendStatusLine (int code, const std::string &detail=std::string()) throw (sella::net::SocketException)
 
void sendHeaders (size_t size, const std::string &contentType=ContentTypeDefault, bool close=true, Compression compression=None) throw (sella::net::SocketException)
 
void sendBody (const std::string &body) throw (sella::net::SocketException)
 
void sendContent (const std::vector< char > &content) throw (sella::net::SocketException)
 
void read (std::string &buffer) throw (ServerException)
 
void chunker (void) throw (ServerException)
 
Compression getCompressionType (const std::string &body, const std::string &contentType) const throw ()
 
Compression getCompressionType (const std::vector< char > &content, const std::string &contentType) const throw ()
 
const std::string buildHeaders (size_t contentSize, const std::string &contentType=ContentTypeDefault, bool close=true, bool useAllow=false, Compression compression=None, const std::string &transferEncoding=std::string()) throw ()
 
void getFileContent (const std::string &file, std::vector< char > &content, std::string &contentType) throw (ServerException)
 
size_t getFileSize (std::ifstream &ifile) throw (ServerException)
 
std::string getErrorBody (int code, const std::string &detail=std::string(), const std::string &callback=std::string()) throw ()
 

Protected Attributes

const HTTPhttp
 
sella::net::TCPSocket::shared socket
 
struct timespec start
 
HTTPRequest request
 

Detailed Description

Provides incoming HTTP connection and code for replying to a request.

Definition at line 32 of file HTTPConnection.h.


The documentation for this class was generated from the following files: