27#include <fastcgi/fcgiapp.h>
47 virtual int putStr(
const char* msg,
int len ) = 0;
51 virtual int putS(
const char* msg ) = 0;
55 virtual int printf(
const char* msg ) = 0;
71 static const unsigned int bufsize = 65536;
74 void cpy2buf(
const char* msg,
size_t len ){
75 if( sz+len > bufsize ) buffer = (
char*) realloc( buffer, sz+len );
77 memcpy( &buffer[sz], msg, len );
91 buffer = (
char*) malloc(bufsize);
98 int putStr(
const char* msg,
int len ){
100 return FCGX_PutStr( msg, len, out );
102 int putS(
const char* msg ){
103 int len = (int) strlen( msg );
105 if( FCGX_PutStr( msg, len, out ) != len )
return -1;
108 int printf(
const char* msg ){
109 cpy2buf( msg, strlen(msg) );
110 return FCGX_FPrintF( out, msg );
113 return FCGX_FFlush( out );
131 int putStr(
const char* msg,
int len ){
132 return fwrite( (
void*) msg,
sizeof(
char), len, out );
134 int putS(
const char* msg ){
135 return fputs( msg, out );
137 int printf(
const char* msg ){
138 return fprintf( out,
"%s", msg );
141 return fflush( out );
FCGI Writer Class.
Definition: Writer.h:65
~FCGIWriter()
Destructor.
Definition: Writer.h:96
FCGIWriter(FCGX_Stream *o)
Constructor.
Definition: Writer.h:89
File Writer Class.
Definition: Writer.h:121
Virtual base class for various writers.
Definition: Writer.h:37
virtual int flush()=0
Flush the output buffer.
virtual int putStr(const char *msg, int len)=0
Write out a binary string.
virtual int putS(const char *msg)=0
Write out a string.
virtual int printf(const char *msg)=0
Write out a string.