diff options
author | Ingela Anderton Andin <[email protected]> | 2013-08-08 11:07:23 +0200 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2013-08-08 11:07:23 +0200 |
commit | 50d7d2f939a7c5e1aa12c6404363faf4a28aa9e8 (patch) | |
tree | a377911e50403b88eecec666180f38d863cd2b90 | |
parent | 3021fca734f71f8bae966ab67f1400d37f8927bc (diff) | |
download | otp-50d7d2f939a7c5e1aa12c6404363faf4a28aa9e8.tar.gz otp-50d7d2f939a7c5e1aa12c6404363faf4a28aa9e8.tar.bz2 otp-50d7d2f939a7c5e1aa12c6404363faf4a28aa9e8.zip |
ssl: Revert faulty header option fix
The code was changed in the belife that it made it inet compatible.
However the testing is a bit hairy as the inet option is acctualy
broken, now the tests are corrected and the header option should work
in the same broken way as inet again, preferably use the bitsyntax
instead.
-rw-r--r-- | lib/ssl/src/tls_connection.erl | 2 | ||||
-rw-r--r-- | lib/ssl/test/ssl_packet_SUITE.erl | 24 |
2 files changed, 15 insertions, 11 deletions
diff --git a/lib/ssl/src/tls_connection.erl b/lib/ssl/src/tls_connection.erl index 246fecf34a..edbba94865 100644 --- a/lib/ssl/src/tls_connection.erl +++ b/lib/ssl/src/tls_connection.erl @@ -2458,7 +2458,7 @@ do_format_reply(list, _,_, Data) -> binary_to_list(Data). header(0, <<>>) -> - []; + <<>>; header(_, <<>>) -> []; header(0, Binary) -> diff --git a/lib/ssl/test/ssl_packet_SUITE.erl b/lib/ssl/test/ssl_packet_SUITE.erl index 36f7af784d..d50498f547 100644 --- a/lib/ssl/test/ssl_packet_SUITE.erl +++ b/lib/ssl/test/ssl_packet_SUITE.erl @@ -1631,8 +1631,8 @@ header_decode_one_byte_active(Config) when is_list(Config) -> {from, self()}, {mfa, {?MODULE, client_header_decode_active, [Data, [11 | <<"Hello world">> ]]}}, - {options, [{active, true}, {header, 1}, - binary | ClientOpts]}]), + {options, [{active, true}, binary, {header, 1} + | ClientOpts]}]), ssl_test_lib:check_result(Server, ok, Client, ok), @@ -1688,7 +1688,7 @@ header_decode_two_bytes_two_sent_active(Config) when is_list(Config) -> Server = ssl_test_lib:start_server([{node, ClientNode}, {port, 0}, {from, self()}, {mfa, {?MODULE, server_header_decode_active, - [Data, [$H, $e]]}}, + [Data, [$H, $e | <<>>]]}}, {options, [{active, true}, binary, {header,2}|ServerOpts]}]), @@ -1697,7 +1697,7 @@ header_decode_two_bytes_two_sent_active(Config) when is_list(Config) -> {host, Hostname}, {from, self()}, {mfa, {?MODULE, client_header_decode_active, - [Data, [$H, $e]]}}, + [Data, [$H, $e | <<>>]]}}, {options, [{active, true}, {header, 2}, binary | ClientOpts]}]), @@ -1765,8 +1765,8 @@ header_decode_one_byte_passive(Config) when is_list(Config) -> {from, self()}, {mfa, {?MODULE, client_header_decode_passive, [Data, [11 | <<"Hello world">> ]]}}, - {options, [{active, false}, {header, 1}, - binary | ClientOpts]}]), + {options, [{active, false}, binary, {header, 1} + | ClientOpts]}]), ssl_test_lib:check_result(Server, ok, Client, ok), @@ -1822,7 +1822,7 @@ header_decode_two_bytes_two_sent_passive(Config) when is_list(Config) -> Server = ssl_test_lib:start_server([{node, ClientNode}, {port, 0}, {from, self()}, {mfa, {?MODULE, server_header_decode_passive, - [Data, [$H, $e]]}}, + [Data, [$H, $e | <<>>]]}}, {options, [{active, false}, binary, {header,2}|ServerOpts]}]), @@ -1831,7 +1831,7 @@ header_decode_two_bytes_two_sent_passive(Config) when is_list(Config) -> {host, Hostname}, {from, self()}, {mfa, {?MODULE, client_header_decode_passive, - [Data, [$H, $e]]}}, + [Data, [$H, $e | <<>>]]}}, {options, [{active, false}, {header, 2}, binary | ClientOpts]}]), @@ -2124,10 +2124,14 @@ client_header_decode_passive(Socket, Packet, Result) -> %% option and the bitsynax makes it obsolete! check_header_result([Byte1 | _], [Byte1]) -> ok; +check_header_result([Byte1 | _], [Byte1| <<>>]) -> + ok; check_header_result([Byte1, Byte2 | _], [Byte1, Byte2]) -> ok; -check_header_result(_,Got) -> - exit({?LINE, Got}). +check_header_result([Byte1, Byte2 | _], [Byte1, Byte2 | <<>>]) -> + ok; +check_header_result(Expected,Got) -> + exit({?LINE, {Expected, Got}}). server_line_packet_decode(Socket, Packet) when is_binary(Packet) -> [L1, L2] = string:tokens(binary_to_list(Packet), "\n"), |