Bläddra i källkod

Merge pull request #103 from apauley/dialyzer_travis

Run dialyzer by default when compiling. Update travis builds.
pull/98/merge
Chandrashekhar Mullaparthi 11 år sedan
förälder
incheckning
fb97c66014
5 ändrade filer med 19 tillägg och 21 borttagningar
  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 Visa fil

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

+ 4
- 2
Makefile Visa fil

@ -3,13 +3,15 @@ IBROWSE_VSN = $(shell sed -n 's/.*{vsn,.*"\(.*\)"}.*/\1/p' src/ibrowse.app.src)
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
all:
all: compile dialyzer
compile:
./rebar compile
clean:
./rebar clean
install: all
install: compile
mkdir -p $(DESTDIR)/lib/ibrowse-$(IBROWSE_VSN)/
cp -r ebin $(DESTDIR)/lib/ibrowse-$(IBROWSE_VSN)/

+ 1
- 1
rebar.config Visa fil

@ -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]}.
{eunit_opts, [verbose]}.

+ 12
- 12
src/ibrowse_http_client.erl Visa fil

@ -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 Visa fil

@ -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>>),

Laddar…
Avbryt
Spara