diff options
author | Francisco Javier López <fjlopez@gitlab.com> | 2019-04-04 18:32:02 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-04-04 18:32:02 +0000 |
commit | 8a134f4c6505c4f8f3c89e0ae4d4ea2293765be3 (patch) | |
tree | 910dce4df7fd61af86a9f282f52fcc72ff056975 /lib/gitlab/url_helpers.rb | |
parent | 465f82e32cd1ca7c87ca7553e350af4c52b00805 (diff) | |
download | gitlab-ce-8a134f4c6505c4f8f3c89e0ae4d4ea2293765be3.tar.gz |
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.rb | 16 |
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 |