Skip to content

Commit c3622c0

Browse files
hao-yuadamruzicka
authored andcommitted
Fixes #38739: Cockpit error if special characters in ssh password
1 parent b509b59 commit c3622c0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

extra/cockpit/foreman-cockpit-session

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class AccessDeniedError < CockpitError; end
4646
class Cockpit
4747
class << self
4848
def encode_message(payload)
49-
data = JSON.dump(payload)
49+
data = JSON.dump(payload).bytes.pack("c*")
5050
"#{data.length + 1}\n\n#{data}"
5151
end
5252

@@ -259,7 +259,8 @@ class Relay
259259
Host: #{url.host}:#{url.port}
260260
Connection: upgrade
261261
Upgrade: raw
262-
Content-Length: #{data.length + 2}
262+
Content-Length: #{data.bytes.length + 2}
263+
Content-Type: application/json
263264
264265
#{data}
265266
HTTP

0 commit comments

Comments
 (0)