<html><head></head><body><div class="ydpfc875dafyahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:10px;"><div><div>Dialyzer warning if not export my function convert_result_and_exit/1</div><div><br></div><div><br></div><div><span><div>%%% ###=====================================================================###</div><div>-spec convert_result_and_exit(any()) -> no_return().</div><div>%%% ###=====================================================================###</div><div>convert_result_and_exit({error, ErrReason}) when is_binary(ErrReason)-> exit({error, ErrReason});</div><div>convert_result_and_exit(no_permission)-> exit(no_permission);</div><div>convert_result_and_exit(_E) -> exit({error, <<"Unknown reason">>}).</div></span><br></div><div><br></div><div><br></div><div>got a warning from dialyzer:</div><div><br></div><div><span>1569: The variable _E can never match since previous clauses completely covered the type 'no_permission' | {'error',binary()}</span><br></div><div><span><br></span></div><div><span>Anybody has an explanation why ? </span></div><div><span><br></span></div><div><span>Dialyzer bug ?</span></div><div><span><br></span></div><div><span>Best regards//KW</span></div><div><span><br></span></div><div><span><br></span></div><div><span><br></span></div><div><span><br></span></div><div><br></div><div class="ydpfc875dafsignature">Best Regards
W.W.(KingWang)</div></div>
<div><br></div><div><br></div>
</div><div id="yahoo_quoted_6559029466" class="yahoo_quoted">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div>
On Friday, April 26, 2019, 8:26:00 AM GMT+2, Frank Muller <frank.muller.erl@gmail.com> wrote:
</div>
<div><br></div>
<div><br></div>
<div><div id="yiv6969152300"><div><div><div>Small typo in ssl_client/0:</div></div><div><span style="color:rgb(49,49,49);word-spacing:1px;">______________________________</span><span style="color:rgb(49,49,49);word-spacing:1px;">_</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;">tcp_client() -></span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"> {ok, TcpSock} = gen_tcp:connect("local_proxy_f</span><span style="color:rgb(49,49,49);word-spacing:1px;">or_traffic_fitering", 12345, [ binary, {active, true}, {packet. 0} ]),</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"> ok = gen_tcp:send(TcpSocket, <<"CONNECT…">>),</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"> … got 200OK ...</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"> TcpSocket.</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;">ssl_client() -></span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"> TcpSocket = tcp_client(),</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"> Opts = [ {verify, verify_none}, {cacertfile, "cacert.pem"}, {versions, ['tlsv1.2']} ],</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"> {ok, Sock} = ssl:connect(TcpSocket, Opts),</span></div><div> Sock.<br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;">connect() -></span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"> SslSocket = ssl_client(),</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"> ok = ssl:send("...some data...">>, SslSocket),</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"> …</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"> ok.</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;">______________________________</span><span style="color:rgb(49,49,49);word-spacing:1px;">_</span><br clear="none"></div><div><span style="color:rgb(49,49,49);word-spacing:1px;"><br clear="none"></span></div><div><span style="color:rgb(49,49,49);word-spacing:1px;"><br clear="none"></span></div><div class="yiv6969152300yqt8432330977" id="yiv6969152300yqt52809"><div><div class="yiv6969152300gmail_quote"><blockquote class="yiv6969152300gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><span style="color:rgb(49,49,49);word-spacing:1px;">Hi guys</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;">I’m trying to connect to a remote SSL server using a filtering Proxy in between.</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"></span><div>First, I try to establish a normal TCP connection to this local Proxy using the CONNECT word.</div><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;">Second, I upgrade the TCP socket to SSL as in this snippet code:</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;">______________________________</span><span style="color:rgb(49,49,49);word-spacing:1px;">_</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;">tcp_client() -></span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"> {ok, TcpSock} = gen_tcp:connect("local_proxy_f</span><span style="color:rgb(49,49,49);word-spacing:1px;"></span><div>or_traffic_filtering", 12345, [ binary, {active,true}, {packet,0} ]),</div><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"> ok = gen_tcp:send(TcpSocket, <<"CONNECT…">>),</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"> … got 200OK ...</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"> TcpSocket.</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;">ssl_client() -></span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"> TcpSocket = tcp_client(),</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"> Opts = [ {verify, verify_none}, {cacertfile, "cacert.pem"}, {versions, ['tlsv1.2']} ],</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"> {ok, Sock} = ssl:connect(TcpSocket, Opts).</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;">connect() -></span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"> SslSocket = ssl_client(),</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"></span><div> ok = ssl:send(SslSocket, <<"...some data...">>),</div><span style="color:rgb(49,49,49);word-spacing:1px;"> …</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"> ok.</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;">______________________________</span><span style="color:rgb(49,49,49);word-spacing:1px;">_</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"></span><div>When i call the ssl:send/2, the remote SSL server (I’ve no control on this server) immediately closes the connection with {error, closed}.</div><span style="color:rgb(49,49,49);word-spacing:1px;"> </span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;">Furthermore, the SSL server claims I’m using SSL v1.3 (from the logs we've got).</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;">Questions:</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"></span><div>a. is it the right way to establish an SSL connection via a proxy?</div><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"></span><div>b. how can I really ensure I’m using SSL v1.2 and not v1.3?</div><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;"></span><div>My config: Erlang 21.3.5, Ubuntu 18.04 LTS, Kernel 4.4.0-grs-64 on a very restricted environment: no sudo, no direct internet access</div><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;"><span style="color:rgb(49,49,49);word-spacing:1px;">/Frank</span><br clear="none" style="color:rgb(49,49,49);word-spacing:1px;">
</blockquote></div></div></div></div></div><div class="yqt8432330977" id="yqt21268">_______________________________________________<br clear="none">erlang-questions mailing list<br clear="none"><a shape="rect" ymailto="mailto:erlang-questions@erlang.org" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br clear="none"><a shape="rect" href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br clear="none"></div></div>
</div>
</div></body></html>