Skip to content

Commit a0241d3

Browse files
author
jef
committed
strip off superfluous parameters from WMS server url (for the common case that GetCapabilities request urls are advertised)
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15183 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 2025236 commit a0241d3

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/app/qgsnewhttpconnection.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "qgscontexthelp.h"
2020
#include <QSettings>
2121
#include <QMessageBox>
22+
#include <QUrl>
2223

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

76-
settings.setValue( key + "/url", txtUrl->text().trimmed() );
77+
QUrl url( txtUrl->text().trimmed() );
78+
79+
QList< QPair<QByteArray, QByteArray> > params = url.encodedQueryItems();
80+
for ( int i = 0; i < params.size(); i++ )
81+
{
82+
if ( params[i].first.toUpper() == "SERVICE" ||
83+
params[i].first.toUpper() == "REQUEST" ||
84+
params[i].first.toUpper() == "FORMAT" )
85+
{
86+
params.removeAt( i-- );
87+
}
88+
}
89+
url.setEncodedQueryItems( params );
90+
91+
settings.setValue( key + "/url", url.toString() );
7792
settings.setValue( credentialsKey + "/username", txtUserName->text() );
7893
settings.setValue( credentialsKey + "/password", txtPassword->text() );
7994

0 commit comments

Comments
 (0)