aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src/ssh_transport.erl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2017-12-15 16:03:28 +0100
committerErlang/OTP <[email protected]>2017-12-15 16:03:28 +0100
commitc71fa4134c13e56e09c52976f2d7d4264cc1024c (patch)
treed6ca88b20e94ce820ce762c0fe626cbd12f87ee5 /lib/ssh/src/ssh_transport.erl
parente64a1f429ec5f7534e0201fed42967aeb1aae8d8 (diff)
parent81dd055d949593d88144db8a78424af54b7acbc3 (diff)
downloadotp-c71fa4134c13e56e09c52976f2d7d4264cc1024c.tar.gz
otp-c71fa4134c13e56e09c52976f2d7d4264cc1024c.tar.bz2
otp-c71fa4134c13e56e09c52976f2d7d4264cc1024c.zip
Merge branch 'hans/ssh/dont_remove_trailing_ws_19/OTP-14763' into maint-19
* hans/ssh/dont_remove_trailing_ws_19/OTP-14763: ssh: testcases for space trailing Hello msg ssh: Don't remove trailing WS in Hello msg
Diffstat (limited to 'lib/ssh/src/ssh_transport.erl')
-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 9bebaf2d9b..61a1a57063 100644
--- a/lib/ssh/src/ssh_transport.erl
+++ b/lib/ssh/src/ssh_transport.erl
@@ -1827,12 +1827,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).