[erlang-questions] Re: ssl and {active, once} - bug?

Ingela Andin ingela@REDACTED
Mon Apr 12 14:01:00 CEST 2010


Hi!

Tonys code will accomplish that you run the new ssl-implementation
instead of the old one. I would not run the new ssl in older
versions than R13 even though there is a primitive version in R12.
The main reason for not making the new one default yet is that we
want it to be as complete as possible before that, but that does not
necessarily mean it is not complete enough for your need.

Regards Ingela Erlang/OTP team, Ericsson AB

2010/4/12 Roberto Ostinelli <roberto@REDACTED>:
> 2010/4/12 Ingela Andin <ingela@REDACTED>:
>> Hi!
>>
>> Actually it is the new ssl implementation that has driven the http
>> packet support to become a supported feature in the inet driver. I
>> think the reason it does proably not work with the old ssl is that it
>> was never a supported feature when some one still actively cared about
>> that implementation. We are currently working hard at making the new
>> ssl implementation complete enough to be able to phase out the old
>> one.
>>
>> Regards Ingela Erlang/OTP Team, Ericsson AB
>
> hi ingela,
>
> thank you for your anwser. tony did give a working suggestion [code
> here below], can this be a viable solution meanwhile, or do you have a
> better way to implement this?
>
> also, do you happen to know minimum erlang version which allows the
> implementation here below?
>
>
> 2010/4/12 Tony Rogvall <tony@REDACTED>:
>> But if you call crypto:start add the option {ssl_imp, new} the code will work :-)
>
> indeed.
>
> here's the code for others' reference, now working.
>
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%
>
> -module(sslbug).
> -compile(export_all).
>
> start(Port) ->
>        application:start(ssl),
>        application:start(crypto),
>        Options = [
>                binary, {packet, http}, {reuseaddr, true}, {active, false},
>                {backlog, 128}, {ssl_imp, new},
>                {certfile, "/Users/roberto/Code/sslbug/server.pem"},
>                {keyfile, "/Users/roberto/Code/sslbug/privkey.pem"},
>                {password, "roberto"}
>        ],
>        {ok, ListenSocket} = ssl:listen(Port, Options),
>        {ok, Sock} = ssl:transport_accept(ListenSocket),
>        ok = ssl:ssl_accept(Sock),
>        ControllerPid = spawn(fun() ->
>                receive
>                        set -> ok
>                end,
>                controller_loop(Sock)
>        end),
>        ok = ssl:controlling_process(Sock, ControllerPid),
>        ControllerPid ! set.
>
> controller_loop(Sock) ->
>        ssl:setopts(Sock, [{active, once}]),
>        receive
>                _Any ->
>                        io:format("ok, received ~p~n", [_Any])
>        end,
>        ssl:close(Sock).
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>


More information about the erlang-questions mailing list