Skip to content

Commit cd763bc

Browse files
committedJan 10, 2019
Update override comment with a full explanation of what it does
Also checks for original url emptiness before returning it.
1 parent cf5982c commit cd763bc

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed
 

‎python/server/auto_generated/qgsfcgiserverrequest.sip.in

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ Returns true if an error occurred during initialization
3838

3939
:return: the request url
4040

41-
Subclasses may override in case the original URL needs to be
42-
returned instead of the rewritten one (i.e. from a web server
43-
rewrite module).
41+
Overrides base implementation because FCGI is typically behind
42+
a proxy server and QGIS Server will see a rewritten QUERY_STRING.
43+
FCGI implementation stores the REQUEST_URI (which is the URL seen
44+
by the proxy before it gets rewritten) and returns it instead of
45+
the rewritten one.
4446
%End
4547

4648

‎src/server/qgsfcgiserverrequest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ QByteArray QgsFcgiServerRequest::data() const
135135

136136
QUrl QgsFcgiServerRequest::url() const
137137
{
138-
return mOriginalUrl;
138+
return mOriginalUrl.isEmpty() ? QgsServerRequest::url() : mOriginalUrl;
139139
}
140140

141141
// Read post put data

‎src/server/qgsfcgiserverrequest.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ class SERVER_EXPORT QgsFcgiServerRequest: public QgsServerRequest
4545
/**
4646
* \returns the request url
4747
*
48-
* Subclasses may override in case the original URL needs to be
49-
* returned instead of the rewritten one (i.e. from a web server
50-
* rewrite module).
48+
* Overrides base implementation because FCGI is typically behind
49+
* a proxy server and QGIS Server will see a rewritten QUERY_STRING.
50+
* FCGI implementation stores the REQUEST_URI (which is the URL seen
51+
* by the proxy before it gets rewritten) and returns it instead of
52+
* the rewritten one.
5153
*/
5254
QUrl url() const override;
5355

0 commit comments

Comments
 (0)
Please sign in to comment.