Update override comment with a full explanation of what it does

Also checks for original url emptiness before returning it.
This commit is contained in:
Alessandro Pasotti 2019-01-10 10:58:27 +01:00
parent cf5982c309
commit cd763bccf2
3 changed files with 11 additions and 7 deletions

View File

@ -38,9 +38,11 @@ Returns true if an error occurred during initialization
:return: the request url
Subclasses may override in case the original URL needs to be
returned instead of the rewritten one (i.e. from a web server
rewrite module).
Overrides base implementation because FCGI is typically behind
a proxy server and QGIS Server will see a rewritten QUERY_STRING.
FCGI implementation stores the REQUEST_URI (which is the URL seen
by the proxy before it gets rewritten) and returns it instead of
the rewritten one.
%End

View File

@ -135,7 +135,7 @@ QByteArray QgsFcgiServerRequest::data() const
QUrl QgsFcgiServerRequest::url() const
{
return mOriginalUrl;
return mOriginalUrl.isEmpty() ? QgsServerRequest::url() : mOriginalUrl;
}
// Read post put data

View File

@ -45,9 +45,11 @@ class SERVER_EXPORT QgsFcgiServerRequest: public QgsServerRequest
/**
* \returns the request url
*
* Subclasses may override in case the original URL needs to be
* returned instead of the rewritten one (i.e. from a web server
* rewrite module).
* Overrides base implementation because FCGI is typically behind
* a proxy server and QGIS Server will see a rewritten QUERY_STRING.
* FCGI implementation stores the REQUEST_URI (which is the URL seen
* by the proxy before it gets rewritten) and returns it instead of
* the rewritten one.
*/
QUrl url() const override;