40 const std::codecvt_utf8<char_type> converter;
41 std::codecvt_base::result result;
44 mbstate_t state = mbstate_t();
46 const char_type* fromNext;
48 while((count = this->pptr() - this->pbase()) != 0)
51 +std::min(static_cast<size_t>(0xffffU),
58 result = converter.out(
67 if(result == std::codecvt_base::error
68 || result == std::codecvt_base::noconv)
70 ERROR_LOG(
"FcgiStreambuf code conversion failed")
74 pbump(-(fromNext - this->pbase()));
86 send(m_id.m_socket, std::move(record));
98 while((count = this->pptr() - this->pbase()) != 0)
101 +std::min(static_cast<size_t>(0xffffU),
107 header.contentLength = std::min(
113 this->pbase()+
header.contentLength,
116 pbump(-
header.contentLength);
120 header.fcgiId = m_id.m_id;
124 send(m_id.m_socket, std::move(record));
131 template <
class charT,
class traits>
136 return traits_type::eof();
137 if(!traits_type::eq_int_type(c, traits_type::eof()))
138 return this->sputc(c);
140 return traits_type::not_eof(c);
143 template <
class charT,
class traits>
154 +std::min(static_cast<size_t>(0xffffU),
160 header.contentLength = std::min(
166 data+
header.contentLength,
169 size -=
header.contentLength;
170 data +=
header.contentLength;
174 header.fcgiId = m_id.m_id;
178 send(m_id.m_socket, std::move(record));
182 template <
class charT,
class traits>
184 std::basic_istream<char>& stream)
186 const ssize_t maxContentLength = 0xffff;
198 header.contentLength = stream.gcount();
207 header.fcgiId = m_id.m_id;
211 send(m_id.m_socket, std::move(record));
212 }
while(stream.gcount() < maxContentLength);
Topmost namespace for the fastcgi++ library.
const char version[]
Defines the fastcgi++ version.
void header(Level level)
Send a log header to logstream.
size_t size() const
See the relevant data size.
Stream buffer class for output of client data through FastCGI.
const int chunkSize
All FastCGI records will be a multiple of this many bytes.
std::basic_streambuf< charT, traits >::int_type int_type
size_t reserve() const
See the reserve size.
char * end()
Pointer to 1+ the last element.
#define ERROR_LOG(data)
Log any "errors" that can be recovered from.
Declares the Fastcgipp debugging/logging facilities.
Declares the FcgiStreambuf class.
int_type overflow(int_type c=traits_type::eof())
const int version
The version of the FastCGI protocol that this adheres to.
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.
char * begin()
Pointer to the first element.