aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2017-11-17 14:19:09 +0100
committerErlang/OTP <[email protected]>2017-11-17 14:19:09 +0100
commit4d9982b2412121cdd2cb20559e0569f7a01edb0b (patch)
tree9d17cc03670e2691490ff390dfc5ba502aeb64a6 /lib/ssh/src
parente4fbc047b039dd80d331d22c29f02b29387090ad (diff)
parent037b68bfc1e6b20186f542170833af90416c8482 (diff)
downloadotp-4d9982b2412121cdd2cb20559e0569f7a01edb0b.tar.gz
otp-4d9982b2412121cdd2cb20559e0569f7a01edb0b.tar.bz2
otp-4d9982b2412121cdd2cb20559e0569f7a01edb0b.zip
Merge branch 'hans/ssh/dont_remove_trailing_ws_20/OTP-14763' into maint-20
* hans/ssh/dont_remove_trailing_ws_20/OTP-14763: ssh: testcases for space trailing Hello msg ssh: Don't remove trailing WS in Hello msg
Diffstat (limited to 'lib/ssh/src')
-rw-r--r--lib/ssh/src/ssh_transport.erl12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/ssh/src/ssh_transport.erl b/lib/ssh/src/ssh_transport.erl
index 0052347912..6d158537d4 100644
--- a/lib/ssh/src/ssh_transport.erl
+++ b/lib/ssh/src/ssh_transport.erl
@@ -1987,12 +1987,6 @@ same(Algs) -> [{client2server,Algs}, {server2client,Algs}].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
trim_tail(Str) ->
- lists:reverse(trim_head(lists:reverse(Str))).
-
-trim_head([$\s|Cs]) -> trim_head(Cs);
-trim_head([$\t|Cs]) -> trim_head(Cs);
-trim_head([$\n|Cs]) -> trim_head(Cs);
-trim_head([$\r|Cs]) -> trim_head(Cs);
-trim_head(Cs) -> Cs.
-
-
+ lists:takewhile(fun(C) ->
+ C=/=$\r andalso C=/=$\n
+ end, Str).