Explorar el Código

Fix dialyzer warnings due to -Wunmatched_returns option.

Below are the warnings that were fixed by this commit.

[git: master]Iris:ibrowse andreas$ make dialyzer
Building local plt at .dialyzer_plt

dialyzer --output_plt .dialyzer_plt --build_plt \
	   --apps erts kernel stdlib ssl crypto public_key asn1 compiler hipe edoc gs syntax_tools inets xmerl runtime_tools mnesia
  Compiling some key modules to native code... done in 0m19.73s
  Creating PLT .dialyzer_plt ... done in 1m40.98s
done (passed successfully)
dialyzer --fullpath --plt .dialyzer_plt -Wrace_conditions -Wunmatched_returns -Werror_handling -r ./ebin
  Checking whether the PLT .dialyzer_plt is up-to-date... yes
  Proceeding with analysis...
src/ibrowse_http_client.erl:197: Expression produces a value of type 'ok' | {'error',_}, but this value is unmatched
src/ibrowse_http_client.erl:298: Expression produces a value of type 'ok' | {'error',_}, but this value is unmatched
src/ibrowse_http_client.erl:322: Expression produces a value of type 'ok' | {'error',_}, but this value is unmatched
src/ibrowse_http_client.erl:335: Expression produces a value of type 'ok' | {'error',_}, but this value is unmatched
src/ibrowse_http_client.erl:352: Expression produces a value of type 'ok' | {'error',_}, but this value is unmatched
src/ibrowse_http_client.erl:582: Expression produces a value of type 'ok' | {'error',_}, but this value is unmatched
src/ibrowse_http_client.erl:587: Expression produces a value of type 'ok' | {'error',_}, but this value is unmatched
src/ibrowse_http_client.erl:590: Expression produces a value of type 'ok' | {'error',_}, but this value is unmatched
src/ibrowse_http_client.erl:706: Expression produces a value of type 'ok' | {'error',_}, but this value is unmatched
src/ibrowse_http_client.erl:789: Expression produces a value of type 'ok' | {'error',_}, but this value is unmatched
src/ibrowse_http_client.erl:797: Expression produces a value of type 'ok' | {'error',_}, but this value is unmatched
src/ibrowse_http_client.erl:1402: Expression produces a value of type 'ok' | {'error',_}, but this value is unmatched
src/ibrowse_http_client.erl:1859: Expression produces a value of type 'ok' | integer(), but this value is unmatched
src/ibrowse_socks5.erl:25: Expression produces a value of type {'ok',<<_:16>>}, but this value is unmatched
 done in 0m8.07s
done (warnings were emitted)
make: *** [dialyzer] Error 2
pull/103/head
Andreas Pauley hace 11 años
padre
commit
08e6a4c165
Se han modificado 2 ficheros con 13 adiciones y 12 borrados
  1. +12
    -12
      src/ibrowse_http_client.erl
  2. +1
    -0
      src/ibrowse_socks5.erl

+ 12
- 12
src/ibrowse_http_client.erl Ver fichero

@ -194,7 +194,7 @@ handle_info({ssl, _Sock, Data}, State) ->
handle_info({stream_next, Req_id}, #state{socket = Socket,
cur_req = #request{req_id = Req_id}} = State) ->
do_setopts(Socket, [{active, once}], State),
ok = do_setopts(Socket, [{active, once}], State),
{noreply, set_inac_timer(State)};
handle_info({stream_next, _Req_id}, State) ->
@ -297,7 +297,7 @@ handle_sock_data(Data, #state{status = get_header}=State) ->
#state{socket = Socket, status = Status, cur_req = CurReq} = State_1 ->
case {Status, CurReq} of
{get_header, #request{caller_controls_socket = true}} ->
do_setopts(Socket, [{active, once}], State_1);
ok = do_setopts(Socket, [{active, once}], State_1);
_ ->
active_once(State_1)
end,
@ -336,7 +336,7 @@ handle_sock_data(Data, #state{status = get_body,
true ->
active_once(State_1);
false when Ccs == true ->
do_setopts(Socket, [{active, once}], State);
ok = do_setopts(Socket, [{active, once}], State);
false ->
active_once(State_1)
end,
@ -579,16 +579,15 @@ do_send_body1(Source, Resp, State, TE) ->
{ok, Data} when Data == []; Data == <<>> ->
do_send_body({Source}, State, TE);
{ok, Data} ->
do_send(maybe_chunked_encode(Data, TE), State),
ok = do_send(maybe_chunked_encode(Data, TE), State),
do_send_body({Source}, State, TE);
{ok, Data, New_source_state} when Data == []; Data == <<>> ->
do_send_body({Source, New_source_state}, State, TE);
{ok, Data, New_source_state} ->
do_send(maybe_chunked_encode(Data, TE), State),
ok = do_send(maybe_chunked_encode(Data, TE), State),
do_send_body({Source, New_source_state}, State, TE);
eof when TE == true ->
do_send(<<"0\r\n\r\n">>, State),
ok;
ok = do_send(<<"0\r\n\r\n">>, State);
eof ->
ok;
Err ->
@ -612,7 +611,7 @@ do_close(#state{socket = Sock, is_ssl = false}) -> catch gen_tcp:close(Sock).
active_once(#state{cur_req = #request{caller_controls_socket = true}}) ->
ok;
active_once(#state{socket = Socket} = State) ->
do_setopts(Socket, [{active, once}], State).
ok = do_setopts(Socket, [{active, once}], State).
do_setopts(_Sock, [], _) -> ok;
do_setopts(Sock, Opts, #state{is_ssl = true,
@ -703,7 +702,7 @@ send_req_1(From,
case do_send_body(Body_1, State_1, TE) of
ok ->
trace_request_body(Body_1),
active_once(State_1),
ok = active_once(State_1),
State_1_1 = inc_pipeline_counter(State_1),
State_2 = State_1_1#state{status = get_header,
cur_req = NewReq,
@ -786,7 +785,7 @@ send_req_1(From,
AbsPath, RelPath, Body, Options, State_1,
ReqId),
trace_request(Req),
do_setopts(Socket, Caller_socket_options, State_1),
ok = do_setopts(Socket, Caller_socket_options, State_1),
TE = is_chunked_encoding_specified(Options),
case do_send(Req, State_1) of
ok ->
@ -1401,7 +1400,7 @@ set_cur_request(#state{reqs = Reqs, socket = Socket} = State) ->
{value, #request{caller_controls_socket = Ccs} = NextReq} ->
case Ccs of
true ->
do_setopts(Socket, [{active, once}], State);
ok = do_setopts(Socket, [{active, once}], State);
_ ->
ok
end,
@ -1858,7 +1857,8 @@ dec_pipeline_counter(#state{cur_pipeline_size = Pipe_sz,
lb_ets_tid = Tid} = State) ->
try
update_counter(Tid, self(), {2,-1,0,0}),
update_counter(Tid, self(), {3,-1,0,0})
update_counter(Tid, self(), {3,-1,0,0}),
ok
catch
_:_ ->
ok

+ 1
- 0
src/ibrowse_socks5.erl Ver fichero

@ -22,6 +22,7 @@ connect(Host, Port, Options) ->
{ok, Socket} = gen_tcp:connect(Socks5Host, Socks5Port, [binary, {packet, 0}, {keepalive, true}, {active, false}]),
{ok, _Bin} =
case proplists:get_value(socks5_user, Options, undefined) of
undefined ->
ok = gen_tcp:send(Socket, <<?SOCKS5, 1, ?AUTH_METHOD_NO>>),

Cargando…
Cancelar
Guardar