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