Skip to content

Commit 46dba8a

Browse files
rldhontjef-n
authored andcommitted
WFS service Capability request resource bug
1 parent 19e2286 commit 46dba8a

File tree

2 files changed

+78
-3
lines changed

2 files changed

+78
-3
lines changed

src/mapserver/qgswfsserver.cpp

+62-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/***************************************************************************
2+
qgswfsserver.cpp
3+
-------------------
4+
begin : February 27, 2012
5+
copyright : (C) 2012 by René-Luc D'Hont & Marco Hugentobler
6+
email : rldhont at 3liz dot com
7+
***************************************************************************/
8+
9+
/***************************************************************************
10+
* *
11+
* This program is free software; you can redistribute it and/or modify *
12+
* it under the terms of the GNU General Public License as published by *
13+
* the Free Software Foundation; either version 2 of the License, or *
14+
* (at your option) any later version. *
15+
* *
16+
***************************************************************************/
117
#include "qgswfsserver.h"
218
#include "qgsconfigparser.h"
319
#include "qgscrscache.h"
@@ -101,9 +117,52 @@ QDomDocument QgsWFSServer::getCapabilities()
101117
QString requestUrl = getenv( "REQUEST_URI" );
102118
QUrl mapUrl( requestUrl );
103119
mapUrl.setHost( QString( getenv( "SERVER_NAME" ) ) );
104-
mapUrl.removeQueryItem( "REQUEST" );
105-
mapUrl.removeQueryItem( "VERSION" );
106-
mapUrl.removeQueryItem( "SERVICE" );
120+
121+
//Add non-default ports to url
122+
QString portString = getenv( "SERVER_PORT" );
123+
if ( !portString.isEmpty() )
124+
{
125+
bool portOk;
126+
int portNumber = portString.toInt( &portOk );
127+
if ( portOk )
128+
{
129+
if ( portNumber != 80 )
130+
{
131+
mapUrl.setPort( portNumber );
132+
}
133+
}
134+
}
135+
136+
if ( QString( getenv( "HTTPS" ) ).compare( "on", Qt::CaseInsensitive ) == 0 )
137+
{
138+
mapUrl.setScheme( "https" );
139+
}
140+
else
141+
{
142+
mapUrl.setScheme( "http" );
143+
}
144+
145+
QList<QPair<QString, QString> > queryItems = mapUrl.queryItems();
146+
QList<QPair<QString, QString> >::const_iterator queryIt = queryItems.constBegin();
147+
for ( ; queryIt != queryItems.constEnd(); ++queryIt )
148+
{
149+
if ( queryIt->first.compare( "REQUEST", Qt::CaseInsensitive ) == 0 )
150+
{
151+
mapUrl.removeQueryItem( queryIt->first );
152+
}
153+
else if ( queryIt->first.compare( "VERSION", Qt::CaseInsensitive ) == 0 )
154+
{
155+
mapUrl.removeQueryItem( queryIt->first );
156+
}
157+
else if ( queryIt->first.compare( "SERVICE", Qt::CaseInsensitive ) == 0 )
158+
{
159+
mapUrl.removeQueryItem( queryIt->first );
160+
}
161+
else if ( queryIt->first.compare( "_DC", Qt::CaseInsensitive ) == 0 )
162+
{
163+
mapUrl.removeQueryItem( queryIt->first );
164+
}
165+
}
107166
hrefString = mapUrl.toString();
108167

109168
//only Get supported for the moment

src/mapserver/qgswfsserver.h

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/***************************************************************************
2+
qgswfsserver.h
3+
-------------------
4+
begin : February 27, 2012
5+
copyright : (C) 2012 by René-Luc D'Hont
6+
email : rldhont at 3liz dot com
7+
***************************************************************************/
8+
9+
/***************************************************************************
10+
* *
11+
* This program is free software; you can redistribute it and/or modify *
12+
* it under the terms of the GNU General Public License as published by *
13+
* the Free Software Foundation; either version 2 of the License, or *
14+
* (at your option) any later version. *
15+
* *
16+
***************************************************************************/
117

218
#ifndef QGSWFSSERVER_H
319
#define QGSWFSSERVER_H

0 commit comments

Comments
 (0)