fastcgi++
3.1alpha
A C++ FastCGI/Web API
|
Go to the documentation of this file.
29 #ifndef FASTCGIPP_REQUEST_HPP
30 #define FASTCGIPP_REQUEST_HPP
60 virtual std::unique_lock<std::mutex>
handler() =0;
100 template<
class charT>
class Request:
public Request_base
114 Request(
const size_t maxPostSize=0):
121 out.imbue(std::locale(
"C"));
122 err.imbue(std::locale(
"C"));
143 const std::function<
void(
const Socket&,
Block&&,
bool)>
147 std::unique_lock<std::mutex>
handler();
153 const Http::Environment<charT>&
environment()
const
165 std::basic_ostream<charT>
out;
168 std::basic_ostream<charT>
err;
247 virtual void inHandler(
int bytesReceived)
288 void dump(
const char* data,
size_t size)
302 void dump(
const unsigned char* data,
size_t size)
317 void dump(std::basic_istream<char>& stream)
329 unsigned pickLocale(
const std::vector<std::string>& locales);
332 void setLocale(
const std::string& locale);
384 inline const char*
codepage()
const;
void setLocale(const std::string &locale)
Set the output stream's locale.
Http::Environment< charT > m_environment
The data structure containing all HTTP environment data.
Role
Defines the possible roles a FastCGI application may play.
std::queue< Message > m_messages
A queue of message for the request.
virtual void unknownContentErrorHandler()
Called when receiving an unknown content type.
std::basic_ostream< charT > err
Output stream to the HTTP server error log.
Protocol::Role role() const
See the requests role.
Data structure to hold a block of raw data.
ProtocolStatus
Possible statuses a request may declare when complete.
void complete()
Generates an END_REQUEST FastCGI record.
std::mutex mutex
Thread safe the logging mechanism.
Data structure used to pass messages to requests.
std::unique_lock< std::mutex > handler()
Request Handler.
Protocol::RecordType m_state
What the request is current doing.
const char * codepage() const
Codepage.
Declares the FcgiStreambuf class.
void dump(const char *data, size_t size)
Dumps raw data directly into the FastCGI protocol.
const Http::Environment< charT > & environment() const
Const accessor for the HTTP environment data.
const size_t m_maxPostSize
The maximum amount of post data, in bytes, that can be recieved.
virtual void bigPostErrorHandler()
Called when too much post data is recieved.
Protocol::Role m_role
The role that the other side expects this request to play.
unsigned pickLocale(const std::vector< std::string > &locales)
Pick a locale.
Protocol::RequestId m_id
The complete ID (request id & file descriptor) associated with the request.
FcgiStreambuf< charT > m_outStreamBuffer
Stream buffer for the out stream.
const std::function< void(Message)> & callback() const
Callback function for dealings outside the fastcgi++ library.
virtual void errorHandler()
Called when a processing error occurs.
Data structure of HTTP environment data.
bool m_kill
Should the socket be closed upon completion.
virtual bool response()=0
Response generator.
Declares the Address class.
Request(const size_t maxPostSize=0)
Initializes what it can. configure() to finish.
Class for representing an OS level I/O socket.
std::mutex mutex
Only one thread is allowed to handle the request at a time.
std::function< void(const Socket &, Block &&, bool kill)> m_send
Function to actually send the record.
virtual bool inProcessor()
Process custom POST data.
void dump(const char *data, size_t size)
Dumps raw data directly into the FastCGI protocol.
virtual void inHandler(int bytesReceived)
Generate a data input response.
Message m_message
The message associated with the current handler() call.
Topmost namespace for the fastcgi++ library.
Declares everything for relating to the FastCGI protocol itself.
RecordType
Defines the types of records within the FastCGI protocol.
FcgiStreambuf< charT > m_errStreamBuffer
Stream buffer for the err stream.
std::function< void(Message)> m_callback
The callback function for dealings outside the fastcgi++ library.
A unique identifier for each FastCGI request.
std::basic_ostream< charT > out
Standard output stream to the client.
void push(Message &&message)
Send a message to the request.
void configure(const Protocol::RequestId &id, const Protocol::Role &role, bool kill, const std::function< void(const Socket &, Block &&, bool)> send, const std::function< void(Message)> callback)
Configures the request with the data it needs.
std::mutex m_messagesMutex
Thread safe our message queue.
Protocol::ProtocolStatus m_status
Status to end the request with.
virtual std::unique_lock< std::mutex > handler()=0
Request Handler.