Skip to content

Commit a201a89

Browse files
author
mhugent
committedAug 21, 2010
Fix problem with parameter map in getrequesthandler
git-svn-id: http://svn.osgeo.org/qgis/trunk@14116 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent e5f6eb6 commit a201a89

File tree

1 file changed

+29
-33
lines changed

1 file changed

+29
-33
lines changed
 

‎src/mapserver/qgsgetrequesthandler.cpp

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -36,55 +36,51 @@ std::map<QString, QString> QgsGetRequestHandler::parseInput()
3636
QStringList elements = queryString.split( "&" );
3737

3838
QString element, key, value;
39-
int separator = -1;
4039

4140
//insert key and value into the map
4241
for ( QStringList::const_iterator it = elements.begin(); it != elements.end(); ++it )
4342
{
4443
element = *it;
45-
if ( separator != -1 )
46-
{
47-
int sepidx = element.indexOf( "=", 0, Qt::CaseSensitive );
44+
int sepidx = element.indexOf( "=", 0, Qt::CaseSensitive );
4845

49-
key = element.left( sepidx );
50-
value = element.mid( sepidx + 1 );
51-
value = QUrl::fromPercentEncoding( value.toLocal8Bit() ); //replace encoded special caracters and utf-8 encodings
46+
key = element.left( sepidx );
47+
value = element.mid( sepidx + 1 );
48+
value = QUrl::fromPercentEncoding( value.toLocal8Bit() ); //replace encoded special caracters and utf-8 encodings
5249

5350

54-
if ( key.compare( "SLD_BODY", Qt::CaseInsensitive ) == 0 )
55-
{
56-
key = "SLD";
57-
}
58-
else if ( key.compare( "SLD", Qt::CaseInsensitive ) == 0 )
51+
if ( key.compare( "SLD_BODY", Qt::CaseInsensitive ) == 0 )
52+
{
53+
key = "SLD";
54+
}
55+
else if ( key.compare( "SLD", Qt::CaseInsensitive ) == 0 )
56+
{
57+
QByteArray fileContents;
58+
if ( value.startsWith( "http", Qt::CaseInsensitive ) )
5959
{
60-
QByteArray fileContents;
61-
if ( value.startsWith( "http", Qt::CaseInsensitive ) )
60+
QgsHttpTransaction http( value );
61+
if ( !http.getSynchronously( fileContents ) )
6262
{
63-
QgsHttpTransaction http( value );
64-
if ( !http.getSynchronously( fileContents ) )
65-
{
66-
continue;
67-
}
63+
continue;
6864
}
69-
else if ( value.startsWith( "ftp", Qt::CaseInsensitive ) )
70-
{
71-
QgsFtpTransaction ftp;
72-
if ( !ftp.get( value, fileContents ) )
73-
{
74-
continue;
75-
}
76-
value = QUrl::fromPercentEncoding( fileContents );
77-
}
78-
else
65+
}
66+
else if ( value.startsWith( "ftp", Qt::CaseInsensitive ) )
67+
{
68+
QgsFtpTransaction ftp;
69+
if ( !ftp.get( value, fileContents ) )
7970
{
80-
continue; //only http and ftp supported at the moment
71+
continue;
8172
}
8273
value = QUrl::fromPercentEncoding( fileContents );
83-
8474
}
85-
parameters.insert( std::make_pair( key.toUpper(), value ) );
86-
QgsMSDebugMsg( "qgsgetrequesthandler.cpp: inserting pair " + key.toUpper() + " // " + value + " into the parameter map" )
75+
else
76+
{
77+
continue; //only http and ftp supported at the moment
78+
}
79+
value = QUrl::fromPercentEncoding( fileContents );
80+
8781
}
82+
parameters.insert( std::make_pair( key.toUpper(), value ) );
83+
QgsMSDebugMsg( "qgsgetrequesthandler.cpp: inserting pair " + key.toUpper() + " // " + value + " into the parameter map" )
8884
}
8985

9086
//feature info format?

0 commit comments

Comments
 (0)
Please sign in to comment.