瀏覽代碼

Merge pull request #103 from apauley/dialyzer_travis

Run dialyzer by default when compiling. Update travis builds.
pull/98/merge
Chandrashekhar Mullaparthi 11 年之前
父節點
當前提交
fb97c66014
共有 5 個文件被更改,包括 19 次插入21 次删除
  1. +1
    -6
      .travis.yml
  2. +4
    -2
      Makefile
  3. +1
    -1
      rebar.config
  4. +12
    -12
      src/ibrowse_http_client.erl
  5. +1
    -0
      src/ibrowse_socks5.erl

+ 1
- 6
.travis.yml 查看文件

@ -1,9 +1,4 @@
language: erlang language: erlang
otp_release: otp_release:
- R14B04
- R14B03
- R14B02
- R14A
- R13B04
- R13B03
- R16B
script: "make test" script: "make test"

+ 4
- 2
Makefile 查看文件

@ -3,13 +3,15 @@ IBROWSE_VSN = $(shell sed -n 's/.*{vsn,.*"\(.*\)"}.*/\1/p' src/ibrowse.app.src)
DIALYZER_PLT=$(CURDIR)/.dialyzer_plt DIALYZER_PLT=$(CURDIR)/.dialyzer_plt
DIALYZER_APPS=erts kernel stdlib ssl crypto public_key asn1 compiler hipe edoc gs syntax_tools inets xmerl runtime_tools mnesia DIALYZER_APPS=erts kernel stdlib ssl crypto public_key asn1 compiler hipe edoc gs syntax_tools inets xmerl runtime_tools mnesia
all:
all: compile dialyzer
compile:
./rebar compile ./rebar compile
clean: clean:
./rebar clean ./rebar clean
install: all
install: compile
mkdir -p $(DESTDIR)/lib/ibrowse-$(IBROWSE_VSN)/ mkdir -p $(DESTDIR)/lib/ibrowse-$(IBROWSE_VSN)/
cp -r ebin $(DESTDIR)/lib/ibrowse-$(IBROWSE_VSN)/ cp -r ebin $(DESTDIR)/lib/ibrowse-$(IBROWSE_VSN)/

+ 1
- 1
rebar.config 查看文件

@ -1,3 +1,3 @@
{erl_opts, [debug_info, warn_unused_vars, nowarn_shadow_vars, warn_unused_import]}.
{erl_opts, [debug_info, warnings_as_errors, warn_unused_vars, nowarn_shadow_vars, warn_unused_import]}.
{xref_checks, [undefined_function_calls, deprecated_function_calls]}. {xref_checks, [undefined_function_calls, deprecated_function_calls]}.
{eunit_opts, [verbose]}. {eunit_opts, [verbose]}.

+ 12
- 12
src/ibrowse_http_client.erl 查看文件

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

+ 1
- 0
src/ibrowse_socks5.erl 查看文件

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

Loading…
取消
儲存