Skip to content
Permalink
Browse files

apply #3793: libfcgi cannot change mapserv's environment variables on…

… windows
  • Loading branch information
jef-n committed May 4, 2011
1 parent 7ca652f commit 4b03014baa1fd3fd01b657b15fb4deaa87fa9678
Showing with 21 additions and 5 deletions.
  1. +12 −3 src/mapserver/qgis_map_serv.cpp
  2. +7 −1 src/mapserver/qgsconfigcache.cpp
  3. +2 −1 src/mapserver/qgsmapserverlogger.cpp
@@ -126,7 +126,17 @@ QFileInfo defaultAdminSLD()
return QFileInfo( "admin.sld" );
}


int fcgi_accept()
{
#ifdef Q_OS_WIN
if ( FCGX_IsCGI() )
return FCGI_Accept();
else
return FCGX_Accept( &FCGI_stdin->fcgx_stream, &FCGI_stdout->fcgx_stream, &FCGI_stderr->fcgx_stream, &environ );
#else
return FCGI_Accept();
#endif
}

int main( int argc, char * argv[] )
{
@@ -181,11 +191,10 @@ int main( int argc, char * argv[] )
}
}


//creating QgsMapRenderer is expensive (access to srs.db), so we do it here before the fcgi loop
QgsMapRenderer* theMapRenderer = new QgsMapRenderer();

while ( FCGI_Accept() >= 0 )
while ( fcgi_accept() >= 0 )
{
printRequestInfos(); //print request infos if in debug mode

@@ -73,14 +73,19 @@ QgsConfigParser* QgsConfigCache::insertConfiguration( const QString& filePath )
QFile* configFile = new QFile( filePath );
if ( !configFile->exists() || !configFile->open( QIODevice::ReadOnly ) )
{
QgsMSDebugMsg( "File unreadable: " + filePath );
delete configFile;
return 0;
}

//then create xml document
QDomDocument* configDoc = new QDomDocument();
if ( !configDoc->setContent( configFile, true ) )
QString errorMsg;
int line, column;
if ( !configDoc->setContent( configFile, true, &errorMsg, &line, &column ) )
{
QgsMSDebugMsg( QString( "Parse error %1 at row %2, column %3 in %4 " )
.arg( errorMsg ).arg( line ).arg( column ).arg( filePath ) );
delete configFile;
delete configDoc;
return 0;
@@ -99,6 +104,7 @@ QgsConfigParser* QgsConfigCache::insertConfiguration( const QString& filePath )
}
else
{
QgsMSDebugMsg( "SLD or qgis expected in " + filePath );
delete configDoc;
return 0;
}
@@ -57,7 +57,8 @@ void QgsMapServerLogger::printMessage( const QString& message )
if ( !mLogFile.isOpen() )
{
#ifdef _MSC_VER
::OutputDebugString( message.toLocal8Bit() );
::OutputDebugString( message .toLocal8Bit() );
::OutputDebugString( "\n" );
#endif
return;
}

0 comments on commit 4b03014

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