File tree Expand file tree Collapse file tree 1 file changed +37
-3
lines changed Expand file tree Collapse file tree 1 file changed +37
-3
lines changed Original file line number Diff line number Diff line change @@ -173,13 +173,47 @@ QgsFcgiServerRequest::QgsFcgiServerRequest()
173
173
{
174
174
mHasError = false ;
175
175
176
+ // Rebuild the full URL
177
+
176
178
// Get the REQUEST_URI from the environment
177
179
QUrl url;
178
- const char * uri = getenv ( " REQUEST_URI" );
179
- if ( uri )
180
+ QString uri = getenv ( " REQUEST_URI" );
181
+ if ( uri.isEmpty () )
182
+ {
183
+ uri = getenv ( " SCRIPT_NAME" );
184
+ }
185
+
186
+ url.setUrl ( uri );
187
+
188
+ // Check if host is defined
189
+ if ( url.host ().isEmpty () )
190
+ {
191
+ url.setHost ( getenv ( " SERVER_NAME" ) );
192
+ }
193
+
194
+ // Port ?
195
+ if ( url.port (-1 ) == -1 )
180
196
{
181
- url.setUrl ( uri );
197
+ QString portString = getenv ( " SERVER_PORT" );
198
+ if ( !portString.isEmpty () )
199
+ {
200
+ bool portOk;
201
+ int portNumber = portString.toInt ( &portOk );
202
+ if ( portOk && portNumber != 80 )
203
+ {
204
+ url.setPort ( portNumber );
205
+ }
206
+ }
182
207
}
208
+
209
+ // scheme
210
+ if ( url.scheme ().isEmpty () )
211
+ {
212
+ QString ( getenv ( " HTTPS" ) ).compare ( QLatin1String ( " on" ), Qt::CaseInsensitive ) == 0
213
+ ? url.setScheme ( QStringLiteral ( " https" ) )
214
+ : url.setScheme ( QStringLiteral ( " http" ) );
215
+ }
216
+
183
217
// XXX OGC paremetrs are passed with the query string
184
218
// we override the query string url in case it is
185
219
// defined independently of REQUEST_URI
You can’t perform that action at this time.
0 commit comments