Skip to content

Commit

Permalink
strip off superfluous parameters from WMS server url (for the common …
Browse files Browse the repository at this point in the history
…case that GetCapabilities request urls are advertised)

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15183 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Feb 17, 2011
1 parent 2025236 commit a0241d3
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/app/qgsnewhttpconnection.cpp
Expand Up @@ -19,6 +19,7 @@
#include "qgscontexthelp.h"
#include <QSettings>
#include <QMessageBox>
#include <QUrl>

QgsNewHttpConnection::QgsNewHttpConnection(
QWidget *parent, const QString& baseKey, const QString& connName, Qt::WFlags fl ):
Expand Down Expand Up @@ -73,7 +74,21 @@ void QgsNewHttpConnection::accept()
settings.remove( "/Qgis/WMS/" + mOriginalConnName );
}

settings.setValue( key + "/url", txtUrl->text().trimmed() );
QUrl url( txtUrl->text().trimmed() );

QList< QPair<QByteArray, QByteArray> > params = url.encodedQueryItems();
for ( int i = 0; i < params.size(); i++ )
{
if ( params[i].first.toUpper() == "SERVICE" ||
params[i].first.toUpper() == "REQUEST" ||
params[i].first.toUpper() == "FORMAT" )
{
params.removeAt( i-- );
}
}
url.setEncodedQueryItems( params );

settings.setValue( key + "/url", url.toString() );
settings.setValue( credentialsKey + "/username", txtUserName->text() );
settings.setValue( credentialsKey + "/password", txtPassword->text() );

Expand Down

0 comments on commit a0241d3

Please sign in to comment.