|
fastcgi++
A C++ FastCGI/Web API
|
Stream buffer class for output of client data through FastCGI. More...
#include <fastcgi++/fcgistreambuf.hpp>
Public Member Functions | |
| FcgiStreambuf () | |
| void | configure (const Protocol::RequestId &id, const Protocol::RecordType &type, const std::function< void(const Socket &, Block &&)> send_) |
| Configure the stream buffer. More... | |
| virtual | ~FcgiStreambuf () |
| void | dump (const char *data, size_t size) |
| Dumps raw data directly into the FastCGI protocol. More... | |
| void | dump (std::basic_istream< char > &stream) |
| Dumps an input stream directly into the FastCGI protocol. More... | |
Private Types | |
| typedef std::basic_streambuf< charT, traits >::int_type | int_type |
| typedef std::basic_streambuf< charT, traits >::traits_type | traits_type |
| typedef std::basic_streambuf< charT, traits >::char_type | char_type |
Private Member Functions | |
| int_type | overflow (int_type c=traits_type::eof()) |
| int | sync () |
| bool | emptyBuffer () |
| Code converts, packages and transmits all data in the stream buffer. More... | |
| template<> | |
| bool | emptyBuffer () |
| template<> | |
| bool | emptyBuffer () |
Private Attributes | |
| char_type | m_buffer [s_buffSize] |
| The buffer. More... | |
| Protocol::RequestId | m_id |
| ID associated with the request. More... | |
| Protocol::RecordType | m_type |
| Type of output stream (ERR or OUT) More... | |
| std::function< void(const Socket &, Block &&)> | send |
| Function to actually send the record. More... | |
Static Private Attributes | |
| static const int | s_buffSize = 8192 |
| Size of the internal stream buffer. More... | |
Stream buffer class for output of client data through FastCGI.
This class is derived from WebStreambuf<charT, traits>. It acts just the same with the added feature of the dump() function but properly flushes into FastCGI records.
| charT | Character type (char or wchar_t) |
| traits | Character traits |
Definition at line 55 of file fcgistreambuf.hpp.
|
private |
Definition at line 114 of file fcgistreambuf.hpp.
|
private |
Definition at line 112 of file fcgistreambuf.hpp.
|
private |
Definition at line 113 of file fcgistreambuf.hpp.
|
inline |
Definition at line 58 of file fcgistreambuf.hpp.
|
inlinevirtual |
Definition at line 83 of file fcgistreambuf.hpp.
|
inline |
Configure the stream buffer.
Sets FastCGI related member data necessary for operation of the stream buffer.
| [in] | id | Complete ID associated with the request |
| [in] | type | Type of output stream (ERR or OUT) |
| [in] | send_ | Function to send record with |
Definition at line 72 of file fcgistreambuf.hpp.
| void Fastcgipp::FcgiStreambuf< charT, traits >::dump | ( | const char * | data, |
| size_t | size | ||
| ) |
Dumps raw data directly into the FastCGI protocol.
This function exists as a mechanism to dump raw data out the stream bypassing the stream buffer or any code conversion mechanisms. If the user has any binary data to send, this is the function to do it with.
| [in] | data | Pointer to first byte of data to send |
| [in] | size | Size in bytes of data to be sent |
Definition at line 144 of file fcgistreambuf.cpp.
References Fastcgipp::Block::begin(), Fastcgipp::Protocol::chunkSize, Fastcgipp::Protocol::Header::contentLength, Fastcgipp::Protocol::Header::fcgiId, Fastcgipp::Logging::header(), Fastcgipp::Protocol::Header::paddingLength, Fastcgipp::Block::size(), Fastcgipp::Protocol::Header::type, Fastcgipp::Protocol::version, and Fastcgipp::Protocol::Header::version.
Referenced by Fastcgipp::FcgiStreambuf< charT >::~FcgiStreambuf().
| void Fastcgipp::FcgiStreambuf< charT, traits >::dump | ( | std::basic_istream< char > & | stream | ) |
Dumps an input stream directly into the FastCGI protocol.
This function exists as a mechanism to dump a raw input stream out this stream bypassing the stream buffer or any code conversion mechanisms. Typically this would be a filestream associated with an image or something. The stream is transmitted until an EOF.
| [in] | stream | Reference to input stream that should be transmitted. |
Definition at line 183 of file fcgistreambuf.cpp.
References Fastcgipp::Block::begin(), Fastcgipp::Protocol::chunkSize, Fastcgipp::Protocol::Header::contentLength, Fastcgipp::Protocol::Header::fcgiId, Fastcgipp::Logging::header(), Fastcgipp::Protocol::Header::paddingLength, Fastcgipp::Block::reserve(), Fastcgipp::Block::size(), Fastcgipp::Protocol::Header::type, Fastcgipp::Protocol::version, and Fastcgipp::Protocol::Header::version.
|
private |
Definition at line 38 of file fcgistreambuf.cpp.
References Fastcgipp::Block::begin(), Fastcgipp::Protocol::chunkSize, Fastcgipp::Protocol::Header::contentLength, Fastcgipp::Block::end(), ERROR_LOG, Fastcgipp::Protocol::Header::fcgiId, Fastcgipp::Logging::header(), Fastcgipp::Protocol::Header::paddingLength, Fastcgipp::Block::reserve(), Fastcgipp::Block::size(), Fastcgipp::Protocol::Header::type, Fastcgipp::Protocol::version, and Fastcgipp::Protocol::Header::version.
|
private |
Definition at line 93 of file fcgistreambuf.cpp.
References Fastcgipp::Block::begin(), Fastcgipp::Protocol::chunkSize, Fastcgipp::Protocol::Header::contentLength, Fastcgipp::Protocol::Header::fcgiId, Fastcgipp::Logging::header(), Fastcgipp::Protocol::Header::paddingLength, Fastcgipp::Block::size(), Fastcgipp::Protocol::Header::type, Fastcgipp::Protocol::version, and Fastcgipp::Protocol::Header::version.
|
private |
Code converts, packages and transmits all data in the stream buffer.
Referenced by Fastcgipp::FcgiStreambuf< charT >::sync().
|
private |
Definition at line 133 of file fcgistreambuf.cpp.
|
inlineprivate |
Definition at line 118 of file fcgistreambuf.hpp.
Referenced by Fastcgipp::FcgiStreambuf< charT >::~FcgiStreambuf().
|
private |
The buffer.
Definition at line 130 of file fcgistreambuf.hpp.
Referenced by Fastcgipp::FcgiStreambuf< charT >::FcgiStreambuf().
|
private |
ID associated with the request.
Definition at line 133 of file fcgistreambuf.hpp.
Referenced by Fastcgipp::FcgiStreambuf< charT >::configure().
|
private |
Type of output stream (ERR or OUT)
Definition at line 136 of file fcgistreambuf.hpp.
Referenced by Fastcgipp::FcgiStreambuf< charT >::configure().
|
staticprivate |
Size of the internal stream buffer.
Definition at line 127 of file fcgistreambuf.hpp.
Referenced by Fastcgipp::FcgiStreambuf< charT >::FcgiStreambuf().
|
private |
Function to actually send the record.
Definition at line 139 of file fcgistreambuf.hpp.
Referenced by Fastcgipp::FcgiStreambuf< charT >::configure().
1.8.11