[erlang-patches] Fix SSL bug when {packet, line} and list are set

Ingela Anderton Andin <>
Tue Aug 24 16:47:41 CEST 2010


Hi!

Thank you for reporting this. We will not take the patch as is, because 
you are right it does
not fix the whole problem. Instead we have made the following patch:

--- a/lib/ssl/src/ssl_connection.erl
+++ b/lib/ssl/src/ssl_connection.erl
@@ -1738,12 +1738,13 @@ format_packet_error(#socket_options{active = _, 
mode = Mode}, Data) ->

 format_reply(binary, _, N, Data) when N > 0 ->  % Header mode
     header(N, Data);
-format_reply(binary, _, _, Data) ->  Data;
+format_reply(binary, _, _, Data) ->
+    Data;
 format_reply(list, Packet, _, Data)
-  when is_integer(Packet); Packet == raw; Packet == line ->
-    binary_to_list(Data);
-format_reply(list, _,_, Data) ->
-    Data.
+  when Packet == http; Packet == {http, headers};  Packet == http_bin; 
Packet == {http_bin, headers} ->
+    Data;
+format_reply(list, _,_, Data) ->
+    binary_to_list(Data).

 header(0, <<>>) ->
     <<>>;


And add appropriate test cases not listed in this mail.

Regards Ingela Erlang/OTP team - Ericsson AB

Thomas Lachmann wrote:
> Hello,
>
> these patches correct the behaviour of the new ssl implementation, if 
> {packet, line} and mode list are set.
> Previously the returned type was a binary.
>
> The first patch changes the test ssl_packet_SUITE:packet_line_decode
> to check for both cases packet line combined with mode binary and packet
> line combined with mode list.
>
> The second patch corrects the error.
>
> I suspect the packet formats asn1, cdr, sunrm, fcgi and tpkt to suffer
> the same problem. But as I don't know these formats, I don't know if
> there are reasonable representations of them as lists.
>
> The patches are available here:
>
> git fetch :thlachmann/otp.git
> ssl_fix_packet_line_mode_list
>
>
> Thomas
>
> ________________________________________________________________
> erlang-patches (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
>
>   



More information about the erlang-patches mailing list