Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancisco Javier López <fjlopez@gitlab.com>2019-04-04 21:32:02 +0300
committerNick Thomas <nick@gitlab.com>2019-04-04 21:32:02 +0300
commit8a134f4c6505c4f8f3c89e0ae4d4ea2293765be3 (patch)
tree910dce4df7fd61af86a9f282f52fcc72ff056975 /lib/gitlab/url_helpers.rb
parent465f82e32cd1ca7c87ca7553e350af4c52b00805 (diff)
Renamed terminal_specification to channel_specification
We're moving from using terminology related to terminals when we refer to Websockets connections in Workhorse. It's more appropiate a concept like channel.
Diffstat (limited to 'lib/gitlab/url_helpers.rb')
-rw-r--r--lib/gitlab/url_helpers.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/gitlab/url_helpers.rb b/lib/gitlab/url_helpers.rb
new file mode 100644
index 00000000000..883585c196f
--- /dev/null
+++ b/lib/gitlab/url_helpers.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+module Gitlab
+ class UrlHelpers
+ WSS_PROTOCOL = "wss".freeze
+ def self.as_wss(url)
+ return unless url.present?
+
+ URI.parse(url).tap do |uri|
+ uri.scheme = WSS_PROTOCOL
+ end.to_s
+ rescue URI::InvalidURIError
+ nil
+ end
+ end
+end