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

Roberto Ostinelli <>
Mon Apr 19 12:46:51 CEST 2010

2010/4/12 Ingela Andin <>:
> 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

hello ingela,

still having issues i can't understand, even with new_ssl.

see the code here below:



start(Port) ->
	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() ->
			set -> ok
		controller_loop(Sock, 0)
	ok = ssl:controlling_process(Sock, ControllerPid),
	ControllerPid ! set.

controller_loop(_Sock, 2) ->
controller_loop(Sock, Num) ->
	ssl:setopts(Sock, [{active, once}]),
		Any ->
			io:format("ok, received ~p~n", [Any]),
			controller_loop(Sock, Num + 1)


when i run this code with sslbug:start(8080), open a browser and point
it to https://localhost:8080, this is what gets written:

ok, received {ssl,{sslsocket,new_ssl,<0.46.0>},
ok, received {ssl,{sslsocket,new_ssl,<0.46.0>},
                  {http_error,"Host: localhost:8080\r\n"}}

as second message i would expect a {ssl,{sslsocket,new_ssl,<0.46.0>},
{http_header,"Host: localhost:8080\r\n"}} message, i.e. a 'header',
not a 'error' message.

something i'm missing here?

thank you,


More information about the erlang-questions mailing list