summaryrefslogtreecommitdiffstats
path: root/lib/private/appframework/http/request.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/appframework/http/request.php')
-rw-r--r--lib/private/appframework/http/request.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/private/appframework/http/request.php b/lib/private/appframework/http/request.php
index 29414b92f7c..cfd903bffe5 100644
--- a/lib/private/appframework/http/request.php
+++ b/lib/private/appframework/http/request.php
@@ -553,6 +553,27 @@ class Request implements \ArrayAccess, \Countable, IRequest {
}
/**
+ * Returns the used HTTP protocol.
+ *
+ * @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0.
+ */
+ public function getHttpProtocol() {
+ $claimedProtocol = strtoupper($this->server['SERVER_PROTOCOL']);
+
+ $validProtocols = [
+ 'HTTP/1.0',
+ 'HTTP/1.1',
+ 'HTTP/2',
+ ];
+
+ if(in_array($claimedProtocol, $validProtocols, true)) {
+ return $claimedProtocol;
+ }
+
+ return 'HTTP/1.1';
+ }
+
+ /**
* Returns the request uri, even if the website uses one or more
* reverse proxies
* @return string