Skip to content
Permalink
Browse files

QgsServer cleanup

  • Loading branch information
Hugo Mercier
Hugo Mercier committed Dec 14, 2016
1 parent 64b131c commit 3f066054043f87d0e58a9607bbe4f0ce47ec979e
Showing with 0 additions and 81 deletions.
  1. +0 −69 src/server/qgsserver.cpp
  2. +0 −12 src/server/qgsserver.h
@@ -81,7 +81,6 @@ QgsServer::QgsServer( bool captureOutput )
}
sCaptureOutput = captureOutput;
init();
saveEnvVars();
}


@@ -241,38 +240,6 @@ void QgsServer::printRequestInfos()
}
}

void QgsServer::dummyMessageHandler( QtMsgType type, const char *msg )
{
#if 0 //def QGSMSDEBUG
QString output;

switch ( type )
{
case QtDebugMsg:
output += "Debug: ";
break;
case QtCriticalMsg:
output += "Critical: ";
break;
case QtWarningMsg:
output += "Warning: ";
break;
case QtFatalMsg:
output += "Fatal: ";
}

output += msg;

QgsLogger::logMessageToFile( output );

if ( type == QtFatalMsg )
abort();
#else
Q_UNUSED( type );
Q_UNUSED( msg );
#endif
}

/**
* @brief QgsServer::configPath
* @param defaultConfigPath
@@ -317,10 +284,6 @@ bool QgsServer::init( )

QgsServerLogger::instance();

#ifndef _MSC_VER
qInstallMsgHandler( dummyMessageHandler );
#endif

QString optionsPath = getenv( "QGIS_OPTIONS_PATH" );
if ( !optionsPath.isEmpty() )
{
@@ -420,13 +383,6 @@ void QgsServer::putenv( const QString &var, const QString &val )
*/
QPair<QByteArray, QByteArray> QgsServer::handleRequest( const QString& queryString )
{
//apply environment variables
QHash< QString, QString >::const_iterator envIt = mEnvironmentVariables.constBegin();
for ( ; envIt != mEnvironmentVariables.constEnd(); ++envIt )
{
putenv( envIt.key(), envIt.value() );
}

/*
* This is mainly for python bindings, passing QUERY_STRING
* to handleRequest without using os.environment
@@ -637,28 +593,3 @@ void QgsServer::initPython()
}
#endif

#if 0
// The following code was used to test type conversion in python bindings
QPair<QByteArray, QByteArray> QgsServer::testQPair( QPair<QByteArray, QByteArray> pair )
{
return pair;
}
#endif

void QgsServer::saveEnvVars()
{
saveEnvVar( QStringLiteral( "MAX_CACHE_LAYERS" ) );
saveEnvVar( QStringLiteral( "DEFAULT_DATUM_TRANSFORM" ) );
}

void QgsServer::saveEnvVar( const QString& variableName )
{
const char* env = getenv( variableName.toLocal8Bit() );
if ( !env )
{
return;
}

mEnvironmentVariables.insert( variableName, QString::fromLocal8Bit( env ) );
}

@@ -74,10 +74,6 @@ class SERVER_EXPORT QgsServer
* @return the response headers and body QPair of QByteArray if called from python bindings, empty otherwise
*/
QPair<QByteArray, QByteArray> handleRequest( const QString& queryString = QString() );
#if 0
// The following code was used to test type conversion in python bindings
QPair<QByteArray, QByteArray> testQPair( QPair<QByteArray, QByteArray> pair );
#endif

#ifdef HAVE_SERVER_PYTHON_PLUGINS
//! Returns a pointer to the server interface
@@ -93,11 +89,6 @@ class SERVER_EXPORT QgsServer
//! Server initialization
static bool init();

void saveEnvVars();

//! Saves environment variable into mEnvironmentVariables if defined
void saveEnvVar( const QString& variableName );

// All functions that where previously in the main file are now
// static methods of this class
static QString configPath( const QString& defaultConfigPath,
@@ -134,9 +125,6 @@ class SERVER_EXPORT QgsServer
//! Initialization must run once for all servers
static bool sInitialised;
static bool sCaptureOutput;

//! Pass important environment variables to the fcgi processes
QHash< QString, QString > mEnvironmentVariables;
};
#endif // QGSSERVER_H

0 comments on commit 3f06605

Please sign in to comment.
You can’t perform that action at this time.