[erlang-bugs] ssl:negotiated_next_protocol/1 client bug?

Loïc Hoguin essen@REDACTED
Thu Aug 22 10:16:12 CEST 2013


Hello,

I can't get ssl:negotiated_next_protocol/1 to work from the client side. 
As a result I can't really know what protocol to use once the connection 
is established.

Example:

1> ssl:start().
ok
2> {ok, S} = ssl:connect("twitter.com", 443, [binary, {active, false}, 
{client_preferred_next_protocols, client, [<<"spdy/3">>, 
<<"http/1.1">>], <<"http/1.1">>}]).
{ok,{sslsocket,{gen_tcp,#Port<0.1088>},<0.52.0>}}
3> ssl:negotiated_next_protocol(S).
{error,next_protocol_not_negotiated}

It says that the protocol hasn't been negotiated. But it actually has 
been as can be demonstrated below.

4> ssl:send(S, [<<128,3,0,1,1,0,0,81,0,0,0,1,0,0,0,0,0,0>>,
4> 
[<<120,187,227,198,167,194,2,101,37,80,122,180,66,164,90,119,215,16,176,72,
4> 
49,176,236,203,5,23,144,25,37,37,5,160,244,203,106,5,45,54,184,75,202,51,
4> 
75,128,113,163,151,12,46,77,88,173,10,18,193,229,24,163,62,40,65,91,97,
4>     73,220,0,0,0,0,255,255>>]]).
ok
5> ssl:recv(S, 0).
{ok,<<128,3,0,4,0,0,0,12,0,0,0,1,0,0,0,4,0,0,0,100>>}

This is SPDY working just fine.

The same can be done against an Erlang server that uses 
ssl:negotiated_next_protocol/1 where it works, it only fails on the 
client side.

Bug?

-- 
Loïc Hoguin
Erlang Cowboy
Nine Nines
http://ninenines.eu



More information about the erlang-bugs mailing list