summaryrefslogtreecommitdiffstats
path: root/lib/public/irequest.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/irequest.php')
-rw-r--r--lib/public/irequest.php65
1 files changed, 65 insertions, 0 deletions
diff --git a/lib/public/irequest.php b/lib/public/irequest.php
index b5ea1fa95da..814fc0251cf 100644
--- a/lib/public/irequest.php
+++ b/lib/public/irequest.php
@@ -134,4 +134,69 @@ interface IRequest {
* @return string
*/
public function getId();
+
+ /**
+ * Returns the remote address, if the connection came from a trusted proxy
+ * and `forwarded_for_headers` has been configured then the IP address
+ * specified in this header will be returned instead.
+ * Do always use this instead of $_SERVER['REMOTE_ADDR']
+ * @return string IP address
+ */
+ public function getRemoteAddress();
+
+ /**
+ * Returns the server protocol. It respects reverse proxy servers and load
+ * balancers.
+ * @return string Server protocol (http or https)
+ */
+ public function getServerProtocol();
+
+ /**
+ * Returns the request uri, even if the website uses one or more
+ * reverse proxies
+ * @return string
+ */
+ public function getRequestUri();
+
+ /**
+ * Get raw PathInfo from request (not urldecoded)
+ * @throws \Exception
+ * @return string|false Path info or false when not found
+ */
+ public function getRawPathInfo();
+
+ /**
+ * Get PathInfo from request
+ * @throws \Exception
+ * @return string|false Path info or false when not found
+ */
+ public function getPathInfo();
+
+ /**
+ * Returns the script name, even if the website uses one or more
+ * reverse proxies
+ * @return string the script name
+ */
+ public function getScriptName();
+
+ /**
+ * Checks whether the user agent matches a given regex
+ * @param array $agent array of agent names
+ * @return bool true if at least one of the given agent matches, false otherwise
+ */
+ public function isUserAgent(array $agent);
+
+ /**
+ * Returns the unverified server host from the headers without checking
+ * whether it is a trusted domain
+ * @return string Server host
+ */
+ public function getInsecureServerHost();
+
+ /**
+ * Returns the server host from the headers, or the first configured
+ * trusted domain if the host isn't in the trusted list
+ * @return string Server host
+ */
+ public function getServerHost();
}