badarg in new_ssl ssl_connection with client socket and {packet, http}

Jonas Boberg jonas.boberg@REDACTED
Wed Jun 23 11:04:40 CEST 2010


Hi!

The http packet option does not work with new_ssl client sockets.
The ssl_connection process crashes with a badarg when retrieving the http response:
::exit:{{badarg,[{erlang,binary_to_list,[{http_response,{1,1},200,"OK"}]},
               {ssl_connection,format_reply,3},
               {ssl_connection,format_reply,2},
               {ssl_connection,deliver_app_data,4},
               {ssl_connection,application_data,2},
               {ssl_connection,handle_event,3},
               {gen_fsm,handle_msg,7},
               {proc_lib,init_p_do_apply,3}]},
      {gen_fsm,sync_send_all_state_event,[<0.592.0>,{recv,0},1000]}}
  in function gen_fsm:sync_send_all_state_event/3
  in call from ssl_connection:sync_send_all_state_event/3

Erlang version: R13B04 (no fix mentioned in in the release notes of R14A).

How to repeat:
* ssl:connect to a http server 
* ssl:send a http request string
* call ssl:recv on the socket

Trace that shows the calls:
(<0.592.0>) call ssl:connect("localhost",10000,[{ssl_imp,new},{packet,http},{active,false}])
(<0.592.0>) returned from ssl:connect/3 -> {ok,{sslsocket,new_ssl,<0.594.0>}}

(<0.592.0>) call ssl:send({sslsocket,new_ssl,<0.594.0>},"GET / HTTP/1.1\r\n\r\n")
(<0.592.0>) returned from ssl:send/2 -> ok

(<0.592.0>) call ssl:recv({sslsocket,new_ssl,<0.594.0>},0,1000)

(<0.592.0>) exception_from {ssl,recv,3} {exit,{{badarg,[{erlang,binary_to_list,[{http_response,{1,1},200,"OK"}]},
                {ssl_connection,format_reply,3},
                {ssl_connection,format_reply,2},
                {ssl_connection,deliver_app_data,4},
                {ssl_connection,application_data,2},
                {ssl_connection,handle_event,3},
                {gen_fsm,handle_msg,7},
                {proc_lib,init_p_do_apply,3}]},
       {gen_fsm,sync_send_all_state_event,[<0.594.0>,{recv,0},1000]}}}


/Jonas
---------------------------------------------------

---------------------------------------------------

WE'VE CHANGED NAMES!

Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.

www.erlang-solutions.com



More information about the erlang-bugs mailing list