[erlang-questions] SSL behavior!?

Dmitry Kolesnikov dmkolesnikov@REDACTED
Wed Aug 15 21:50:42 CEST 2012


Hello,

I am experience very wired behavior with SSL in R15... So, I do have both client & server implemented on erlang, using ssl in active mode.

The implementation is straight forward it

Client-side:
{ok, Tcp} = gen_tcp:connect(Host, Port, ?SOCK_OPTS, T),
{ok, Ssl}  = ssl:connect(Tcp,  []),

Server-side:
   {ok, LSock} = ssl:listen(Port, [
      	{ip, IP}, 
   	{certfile, Cert}, 
   	{keyfile,  Key}, 
   	{reuseaddr, true} | ?SOCK_OPTS
   ]),
   ...
   {ok, Sock} = ssl:transport_accept(LSock),
   ok = ssl:ssl_accept(Sock),


-define(SOCK_OPTS, [
   {active, once}, 
   {mode, binary}, 
   {nodelay, true},  %% BTW, if I drop nodelay or put it to false, same issue
   {recbuf, 16 * 1024},
   {sndbuf, 16 * 1024}
]).


My issue is that client send data, the data got fragmented into multiple "Application Data" messages. I've been validating it by sniffing the traffic. I cannot get idea why this happens...

Client log:
22:34:54.948 [info] ssl connected {{127,0,0,1},8443}, local addr {{127,0,0,1},53804}, suite {tlsv1,{dhe_rsa,aes_256_cbc,sha}}
22:34:54.948 [debug] ssl send {{127,0,0,1},8443} <<"0123456789abcdef">>

Server log:
22:34:54.948 [info] ssl accepted {{127,0,0,1},53804}, local addr {{127,0,0,1},8443}, suite {tlsv1,{dhe_rsa,aes_256_cbc,sha}}
22:34:54.949 [debug] ssl recv {{127,0,0,1},53804} <<"0">>
22:34:54.949 [debug] ssl recv {{127,0,0,1},53804} <<"123456789abcdef">>

thanks in advanced,
Best Regards, Dmitry





More information about the erlang-questions mailing list