Skip to content

Commit

Permalink
apply #3793: libfcgi cannot change mapserv's environment variables on…
Browse files Browse the repository at this point in the history
… windows
  • Loading branch information
jef-n committed May 4, 2011
1 parent 4d480fc commit 5794256
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
15 changes: 12 additions & 3 deletions src/mapserver/qgis_map_serv.cpp
Expand Up @@ -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[] )
{
Expand Down Expand Up @@ -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

Expand Down
8 changes: 7 additions & 1 deletion src/mapserver/qgsconfigcache.cpp
Expand Up @@ -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;
Expand All @@ -99,6 +104,7 @@ QgsConfigParser* QgsConfigCache::insertConfiguration( const QString& filePath )
}
else
{
QgsMSDebugMsg( "SLD or qgis expected in " + filePath );
delete configDoc;
return 0;
}
Expand Down
3 changes: 2 additions & 1 deletion src/mapserver/qgsmapserverlogger.cpp
Expand Up @@ -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;
}
Expand Down

0 comments on commit 5794256

Please sign in to comment.