Skip to content

Commit 4b03014

Browse files
committed
apply #3793: libfcgi cannot change mapserv's environment variables on windows
1 parent 7ca652f commit 4b03014

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

src/mapserver/qgis_map_serv.cpp

+12-3
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,17 @@ QFileInfo defaultAdminSLD()
126126
return QFileInfo( "admin.sld" );
127127
}
128128

129-
129+
int fcgi_accept()
130+
{
131+
#ifdef Q_OS_WIN
132+
if ( FCGX_IsCGI() )
133+
return FCGI_Accept();
134+
else
135+
return FCGX_Accept( &FCGI_stdin->fcgx_stream, &FCGI_stdout->fcgx_stream, &FCGI_stderr->fcgx_stream, &environ );
136+
#else
137+
return FCGI_Accept();
138+
#endif
139+
}
130140

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

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

188-
while ( FCGI_Accept() >= 0 )
197+
while ( fcgi_accept() >= 0 )
189198
{
190199
printRequestInfos(); //print request infos if in debug mode
191200

src/mapserver/qgsconfigcache.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,19 @@ QgsConfigParser* QgsConfigCache::insertConfiguration( const QString& filePath )
7373
QFile* configFile = new QFile( filePath );
7474
if ( !configFile->exists() || !configFile->open( QIODevice::ReadOnly ) )
7575
{
76+
QgsMSDebugMsg( "File unreadable: " + filePath );
7677
delete configFile;
7778
return 0;
7879
}
7980

8081
//then create xml document
8182
QDomDocument* configDoc = new QDomDocument();
82-
if ( !configDoc->setContent( configFile, true ) )
83+
QString errorMsg;
84+
int line, column;
85+
if ( !configDoc->setContent( configFile, true, &errorMsg, &line, &column ) )
8386
{
87+
QgsMSDebugMsg( QString( "Parse error %1 at row %2, column %3 in %4 " )
88+
.arg( errorMsg ).arg( line ).arg( column ).arg( filePath ) );
8489
delete configFile;
8590
delete configDoc;
8691
return 0;
@@ -99,6 +104,7 @@ QgsConfigParser* QgsConfigCache::insertConfiguration( const QString& filePath )
99104
}
100105
else
101106
{
107+
QgsMSDebugMsg( "SLD or qgis expected in " + filePath );
102108
delete configDoc;
103109
return 0;
104110
}

src/mapserver/qgsmapserverlogger.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ void QgsMapServerLogger::printMessage( const QString& message )
5757
if ( !mLogFile.isOpen() )
5858
{
5959
#ifdef _MSC_VER
60-
::OutputDebugString( message.toLocal8Bit() );
60+
::OutputDebugString( message .toLocal8Bit() );
61+
::OutputDebugString( "\n" );
6162
#endif
6263
return;
6364
}

0 commit comments

Comments
 (0)