|
| 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 | + ***************************************************************************/ |
1 | 17 | #include "qgswfsserver.h"
|
2 | 18 | #include "qgsconfigparser.h"
|
3 | 19 | #include "qgscrscache.h"
|
@@ -101,9 +117,52 @@ QDomDocument QgsWFSServer::getCapabilities()
|
101 | 117 | QString requestUrl = getenv( "REQUEST_URI" );
|
102 | 118 | QUrl mapUrl( requestUrl );
|
103 | 119 | 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 | + } |
107 | 166 | hrefString = mapUrl.toString();
|
108 | 167 |
|
109 | 168 | //only Get supported for the moment
|
|
0 commit comments