diff --git a/classes/Kohana/HTTP.php b/classes/Kohana/HTTP.php index 4c22c52bc..fe23b0c34 100644 --- a/classes/Kohana/HTTP.php +++ b/classes/Kohana/HTTP.php @@ -220,5 +220,24 @@ public static function www_form_urlencode(array $params = array()) return implode('&', $encoded); } + + public static function current_protocol() + { + $protocol = Request::$initial; + + if ($protocol instanceof Request) + { + if ($protocol->secure()) + $protocol = 'https'; + else + list($protocol) = explode('/', strtolower($protocol->protocol())); + } + else + { + $protocol = 'http'; + } + + return $protocol; + } }