diff options
author | Francisco Javier López <fjlopez@gitlab.com> | 2019-04-04 21:32:02 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-04-04 21:32:02 +0300 |
commit | 8a134f4c6505c4f8f3c89e0ae4d4ea2293765be3 (patch) | |
tree | 910dce4df7fd61af86a9f282f52fcc72ff056975 /lib/gitlab | |
parent | 465f82e32cd1ca7c87ca7553e350af4c52b00805 (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')
-rw-r--r-- | lib/gitlab/url_helpers.rb | 16 | ||||
-rw-r--r-- | lib/gitlab/workhorse.rb | 14 |
2 files changed, 23 insertions, 7 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 diff --git a/lib/gitlab/workhorse.rb b/lib/gitlab/workhorse.rb index 83eabb8d674..533757d2237 100644 --- a/lib/gitlab/workhorse.rb +++ b/lib/gitlab/workhorse.rb @@ -162,16 +162,16 @@ module Gitlab ] end - def terminal_websocket(terminal) + def channel_websocket(channel) details = { - 'Terminal' => { - 'Subprotocols' => terminal[:subprotocols], - 'Url' => terminal[:url], - 'Header' => terminal[:headers], - 'MaxSessionTime' => terminal[:max_session_time] + 'Channel' => { + 'Subprotocols' => channel[:subprotocols], + 'Url' => channel[:url], + 'Header' => channel[:headers], + 'MaxSessionTime' => channel[:max_session_time] } } - details['Terminal']['CAPem'] = terminal[:ca_pem] if terminal.key?(:ca_pem) + details['Channel']['CAPem'] = channel[:ca_pem] if channel.key?(:ca_pem) details end |