23 #include <fcgi_stdio.h>    33   mBuffer.open( QIODevice::ReadWrite );
    39   mHeaders.remove( key );
    44   mHeaders.insert( key, value );
    49   return mHeaders.value( key );
    60   mHeaders.insert( QStringLiteral( 
"Status" ), QStringLiteral( 
" %1" ).arg( code ) );
    75   setHeader( QStringLiteral( 
"Content-Type" ), QStringLiteral( 
"text/html;charset=utf-8" ) );
    76   write( QStringLiteral( 
"<html><body>%1</body></html>" ).arg( message ) );
    95     if ( ! mHeaders.contains( 
"Content-Length" ) )
    97       mHeaders.insert( QStringLiteral( 
"Content-Length" ), QStringLiteral( 
"%1" ).arg( mBuffer.pos() ) );
   106   if ( ! mHeadersSent )
   109     QMap<QString, QString>::const_iterator it;
   110     for ( it = mHeaders.constBegin(); it != mHeaders.constEnd(); ++it )
   112       fputs( it.key().toUtf8(), FCGI_stdout );
   113       fputs( 
": ", FCGI_stdout );
   114       fputs( it.value().toUtf8(), FCGI_stdout );
   115       fputs( 
"\n", FCGI_stdout );
   117     fputs( 
"\n", FCGI_stdout );
   126     mBuffer.buffer().clear();
   128   else if ( mBuffer.bytesAvailable() > 0 )
   130     QByteArray &ba = mBuffer.buffer();
   131     size_t count   = fwrite( ( 
void * )ba.data(), ba.size(), 1, FCGI_stdout );
   133     qDebug() << QStringLiteral( 
"Sent %1 blocks of %2 bytes" ).arg( count ).arg( ba.size() );
   147   mBuffer.buffer().clear();
   156   return mBuffer.data();
   163   mBuffer.buffer().clear();
 void setDefaultHeaders()
Set the default headers. 
static const QString QGIS_VERSION
Version string. 
void truncate() override
Truncate data. 
Method
HTTP Method (or equivalent) used for the request. 
virtual void write(const QString &data)
Write string This is a convenient method that will write directly to the underlying I/O device...
void clear() override
Reset all headers and content for this response. 
bool headersSent() const override
Returns true if the headers have already been sent. 
QByteArray data() const override
Gets the data written so far. 
QString header(const QString &key) const override
Returns the header value. 
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary). 
void sendError(int code, const QString &message) override
Send error This method delegates error handling at the server level. 
void finish() override
Finish the response, ending the transaction. 
QgsFcgiServerResponse(QgsServerRequest::Method method=QgsServerRequest::GetMethod)
Constructor for QgsFcgiServerResponse. 
void setStatusCode(int code) override
Set the http status code. 
void removeHeader(const QString &key) override
Clear header Undo a previous 'setHeader' call. 
void flush() override
Flushes the current output buffer to the network. 
QIODevice * io() override
Returns the underlying QIODevice. 
void setHeader(const QString &key, const QString &value) override
Set Header entry Add Header entry to the response Note that it is usually an error to set Header afte...