Skip to content

Commit

Permalink
QgsServer cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Mercier committed Dec 14, 2016
1 parent 64b131c commit 3f06605
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 81 deletions.
69 changes: 0 additions & 69 deletions src/server/qgsserver.cpp
Expand Up @@ -81,7 +81,6 @@ QgsServer::QgsServer( bool captureOutput )
}
sCaptureOutput = captureOutput;
init();
saveEnvVars();
}


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -317,10 +284,6 @@ bool QgsServer::init( )

QgsServerLogger::instance();

#ifndef _MSC_VER
qInstallMsgHandler( dummyMessageHandler );
#endif

QString optionsPath = getenv( "QGIS_OPTIONS_PATH" );
if ( !optionsPath.isEmpty() )
{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 ) );
}

12 changes: 0 additions & 12 deletions src/server/qgsserver.h
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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.