diff options
author | Noah Slater <nslater@apache.org> | 2009-07-06 00:33:50 +0000 |
---|---|---|
committer | Noah Slater <nslater@apache.org> | 2009-07-06 00:33:50 +0000 |
commit | 282b96ddd9a84b740788c2358ec0f5fedafb7cc6 (patch) | |
tree | fb48e605ceb8079d0195d3b1ec0eca7110fa7ef2 /src/ibrowse | |
parent | b5cc085d3bc6316063f14adedf20632ee904875d (diff) |
trimmed trailing whitespace
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@791350 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ibrowse')
-rw-r--r-- | src/ibrowse/ibrowse.app | 8 | ||||
-rw-r--r-- | src/ibrowse/ibrowse.erl | 42 | ||||
-rw-r--r-- | src/ibrowse/ibrowse_app.erl | 8 | ||||
-rw-r--r-- | src/ibrowse/ibrowse_http_client.erl | 16 | ||||
-rw-r--r-- | src/ibrowse/ibrowse_lb.erl | 6 | ||||
-rw-r--r-- | src/ibrowse/ibrowse_lib.erl | 20 | ||||
-rw-r--r-- | src/ibrowse/ibrowse_sup.erl | 4 | ||||
-rw-r--r-- | src/ibrowse/ibrowse_test.erl | 4 |
8 files changed, 54 insertions, 54 deletions
diff --git a/src/ibrowse/ibrowse.app b/src/ibrowse/ibrowse.app index 5e4621d3..a3d23ae7 100644 --- a/src/ibrowse/ibrowse.app +++ b/src/ibrowse/ibrowse.app @@ -1,10 +1,10 @@ {application, ibrowse, [{description, "HTTP client application"}, {vsn, "1.5.0"}, - {modules, [ ibrowse, - ibrowse_http_client, - ibrowse_app, - ibrowse_sup, + {modules, [ ibrowse, + ibrowse_http_client, + ibrowse_app, + ibrowse_sup, ibrowse_lib, ibrowse_lb ]}, {registered, []}, diff --git a/src/ibrowse/ibrowse.erl b/src/ibrowse/ibrowse.erl index 0d3478b3..56f0ef4d 100644 --- a/src/ibrowse/ibrowse.erl +++ b/src/ibrowse/ibrowse.erl @@ -21,14 +21,14 @@ %% <p>Here are a few sample invocations.</p> %% %% <code> -%% ibrowse:send_req("http://intranet/messenger/", [], get). +%% ibrowse:send_req("http://intranet/messenger/", [], get). %% <br/><br/> -%% -%% ibrowse:send_req("http://www.google.com/", [], get, [], +%% +%% ibrowse:send_req("http://www.google.com/", [], get, [], %% [{proxy_user, "XXXXX"}, %% {proxy_password, "XXXXX"}, %% {proxy_host, "proxy"}, -%% {proxy_port, 8080}], 1000). +%% {proxy_port, 8080}], 1000). %% <br/><br/> %% %%ibrowse:send_req("http://www.erlang.org/download/otp_src_R10B-3.tar.gz", [], get, [], @@ -48,7 +48,7 @@ %% ibrowse:send_req("http://www.bbc.co.uk", [], trace). %% %% <br/><br/> -%% ibrowse:send_req("http://www.google.com", [], get, [], +%% ibrowse:send_req("http://www.google.com", [], get, [], %% [{stream_to, self()}]). %% </code> %% @@ -110,7 +110,7 @@ get_value/3, do_trace/2 ]). - + -record(state, {trace = false}). -include("ibrowse.hrl"). @@ -158,7 +158,7 @@ stop() -> send_req(Url, Headers, Method) -> send_req(Url, Headers, Method, [], []). -%% @doc Same as send_req/3. +%% @doc Same as send_req/3. %% If a list is specified for the body it has to be a flat list. The body can also be a fun/0 or a fun/1. <br/> %% If fun/0, the connection handling process will repeatdely call the fun until it returns an error or eof. <pre>Fun() = {ok, Data} | eof</pre><br/> %% If fun/1, the connection handling process will repeatedly call the fun with the supplied state until it returns an error or eof. <pre>Fun(State) = {ok, Data} | {ok, Data, NewState} | eof</pre> @@ -168,7 +168,7 @@ send_req(Url, Headers, Method) -> send_req(Url, Headers, Method, Body) -> send_req(Url, Headers, Method, Body, []). -%% @doc Same as send_req/4. +%% @doc Same as send_req/4. %% For a description of SSL Options, look in the ssl manpage. If the %% HTTP Version to use is not specified, the default is 1.1. %% <br/> @@ -181,7 +181,7 @@ send_req(Url, Headers, Method, Body) -> %% used to specify what should go in the <code>Host</code> header in %% the request.</p> %% <ul> -%% <li>When both the options <code>save_response_to_file</code> and <code>stream_to</code> +%% <li>When both the options <code>save_response_to_file</code> and <code>stream_to</code> %% are specified, the former takes precedence.</li> %% %% <li>For the <code>save_response_to_file</code> option, the response body is saved to @@ -211,21 +211,21 @@ send_req(Url, Headers, Method, Body) -> %% ibrowse:send_req("http://www.example.com/cgi-bin/request", [], get, [], [{connect_timeout, 100}], 1000). %% </code> %% In the above invocation, if the connection isn't established within -%% 100 milliseconds, the request will fail with +%% 100 milliseconds, the request will fail with %% <code>{error, conn_failed}</code>.<br/> %% If connection setup succeeds, the total time allowed for the %% request to complete will be 1000 milliseconds minus the time taken %% for connection setup. %% </li> %% </ul> -%% +%% %% @spec send_req(Url::string(), Headers::headerList(), Method::method(), Body::body(), Options::optionList()) -> response() %% optionList() = [option()] %% option() = {max_sessions, integer()} | %% {response_format,response_format()}| %% {stream_chunk_size, integer()} | %% {max_pipeline_size, integer()} | -%% {trace, boolean()} | +%% {trace, boolean()} | %% {is_ssl, boolean()} | %% {ssl_options, [SSLOpt]} | %% {pool_name, atom()} | @@ -257,7 +257,7 @@ send_req(Url, Headers, Method, Body) -> send_req(Url, Headers, Method, Body, Options) -> send_req(Url, Headers, Method, Body, Options, 30000). -%% @doc Same as send_req/5. +%% @doc Same as send_req/5. %% All timeout values are in milliseconds. %% @spec send_req(Url, Headers::headerList(), Method::method(), Body::body(), Options::optionList(), Timeout) -> response() %% Timeout = integer() | infinity @@ -282,7 +282,7 @@ send_req(Url, Headers, Method, Body, Options, Timeout) -> true -> {get_value(ssl_options, Options_1, []), true} end, case ibrowse_lb:spawn_connection(Lb_pid, Parsed_url, - Max_sessions, + Max_sessions, Max_pipeline_size, {SSLOptions, IsSSL}) of {ok, Conn_Pid} -> @@ -333,7 +333,7 @@ set_dest(_Host, _Port, [H | _]) -> exit({invalid_option, H}); set_dest(_, _, []) -> ok. - + %% @doc Set the maximum number of connections allowed to a specific Host:Port. %% @spec set_max_sessions(Host::string(), Port::integer(), Max::integer()) -> ok set_max_sessions(Host, Port, Max) when is_integer(Max), Max > 0 -> @@ -432,7 +432,7 @@ send_req_direct(Conn_pid, Url, Headers, Method, Body, Options, Timeout) -> %% caller. Should be used in conjunction with the %% <code>stream_to</code> option %% @spec stream_next(Req_id :: req_id()) -> ok | {error, unknown_req_id} -stream_next(Req_id) -> +stream_next(Req_id) -> case ets:lookup(ibrowse_stream, {req_id_pid, Req_id}) of [] -> {error, unknown_req_id}; @@ -451,7 +451,7 @@ trace_off() -> %% @doc Turn tracing on for all connections to the specified HTTP %% server. Host is whatever is specified as the domain name in the URL %% @spec trace_on(Host, Port) -> ok -%% Host = string() +%% Host = string() %% Port = integer() trace_on(Host, Port) -> ibrowse ! {trace, true, Host, Port}, @@ -554,7 +554,7 @@ import_config(Filename) -> case file:consult(Filename) of {ok, Terms} -> ets:delete_all_objects(ibrowse_conf), - Fun = fun({dest, Host, Port, MaxSess, MaxPipe, Options}) + Fun = fun({dest, Host, Port, MaxSess, MaxPipe, Options}) when is_list(Host), is_integer(Port), is_integer(MaxSess), MaxSess > 0, is_integer(MaxPipe), MaxPipe > 0, is_list(Options) -> @@ -564,7 +564,7 @@ import_config(Filename) -> lists:foreach( fun({X, Y}) -> ets:insert(ibrowse_conf, - #ibrowse_conf{key = X, + #ibrowse_conf{key = X, value = Y}) end, I); ({K, V}) -> @@ -663,7 +663,7 @@ handle_info(all_trace_off, State) -> ets:foldl(Fun, undefined, ibrowse_lb), ets:select_delete(ibrowse_conf, [{{ibrowse_conf,{trace,'$1','$2'},true},[],['true']}]), {noreply, State}; - + handle_info({trace, Bool}, State) -> put(my_trace_flag, Bool), {noreply, State}; @@ -680,7 +680,7 @@ handle_info({trace, Bool, Host, Port}, State) -> ets:insert(ibrowse_conf, #ibrowse_conf{key = {trace, Host, Port}, value = Bool}), {noreply, State}; - + handle_info(_Info, State) -> {noreply, State}. diff --git a/src/ibrowse/ibrowse_app.erl b/src/ibrowse/ibrowse_app.erl index f5e523c2..8c83e8f1 100644 --- a/src/ibrowse/ibrowse_app.erl +++ b/src/ibrowse/ibrowse_app.erl @@ -1,7 +1,7 @@ %%%------------------------------------------------------------------- %%% File : ibrowse_app.erl %%% Author : Chandrashekhar Mullaparthi <chandrashekhar.mullaparthi@t-mobile.co.uk> -%%% Description : +%%% Description : %%% %%% Created : 15 Oct 2003 by Chandrashekhar Mullaparthi <chandrashekhar.mullaparthi@t-mobile.co.uk> %%%------------------------------------------------------------------- @@ -42,11 +42,11 @@ %% Func: start/2 %% Returns: {ok, Pid} | %% {ok, Pid, State} | -%% {error, Reason} +%% {error, Reason} %%-------------------------------------------------------------------- start(_Type, _StartArgs) -> case ibrowse_sup:start_link() of - {ok, Pid} -> + {ok, Pid} -> {ok, Pid}; Error -> Error @@ -54,7 +54,7 @@ start(_Type, _StartArgs) -> %%-------------------------------------------------------------------- %% Func: stop/1 -%% Returns: any +%% Returns: any %%-------------------------------------------------------------------- stop(_State) -> ok. diff --git a/src/ibrowse/ibrowse_http_client.erl b/src/ibrowse/ibrowse_http_client.erl index 3cacf391..43aa51f4 100644 --- a/src/ibrowse/ibrowse_http_client.erl +++ b/src/ibrowse/ibrowse_http_client.erl @@ -51,10 +51,10 @@ }). -record(request, {url, method, options, from, - stream_to, caller_controls_socket = false, + stream_to, caller_controls_socket = false, req_id, stream_chunk_size, - save_response_to_file = false, + save_response_to_file = false, tmp_file_name, tmp_file_fd, response_format}). @@ -338,7 +338,7 @@ accumulate_response(Data, #state{reply_buffer = RepBuf, State#state{reply_buffer = RepBuf_1}; _ when Caller_controls_socket == true -> do_interim_reply(StreamTo, Response_format, ReqId, RepBuf_1), - State#state{reply_buffer = <<>>, + State#state{reply_buffer = <<>>, streamed_size = Streamed_size + size(RepBuf_1)}; _ when New_data_size >= Stream_chunk_size -> {Stream_chunk, Rem_data} = split_binary(RepBuf_1, Stream_chunk_size), @@ -514,7 +514,7 @@ send_req_1(From, {Caller, once} when is_pid(Caller) or is_atom(Caller) -> Async_pid_rec = {{req_id_pid, ReqId}, self()}, - true = ets:insert(ibrowse_stream, Async_pid_rec), + true = ets:insert(ibrowse_stream, Async_pid_rec), {Caller, true}; undefined -> {undefined, false}; @@ -869,7 +869,7 @@ is_connection_closing(_, _) -> false. %% This clause determines the chunk size when given data from the beginning of the chunk parse_11_response(DataRecvd, - #state{transfer_encoding=chunked, + #state{transfer_encoding=chunked, chunk_size=chunk_start, chunk_size_buffer = Chunk_sz_buf } = State) -> @@ -899,7 +899,7 @@ parse_11_response(DataRecvd, %% This clause is to remove the CRLF between two chunks %% parse_11_response(DataRecvd, - #state{transfer_encoding = chunked, + #state{transfer_encoding = chunked, chunk_size = tbd, chunk_size_buffer = Buf}=State) -> case scan_crlf(Buf, DataRecvd) of @@ -916,7 +916,7 @@ parse_11_response(DataRecvd, %% This clause deals with the end of a chunked transfer parse_11_response(DataRecvd, - #state{transfer_encoding = chunked, chunk_size = 0, + #state{transfer_encoding = chunked, chunk_size = 0, cur_req = CurReq, deleted_crlf = DelCrlf, reply_buffer = Trailer, reqs = Reqs}=State) -> @@ -1449,7 +1449,7 @@ get_stream_chunk_size(Options) -> ?DEFAULT_STREAM_CHUNK_SIZE end. -get_inac_timeout(#state{cur_req = #request{options = Opts}}) -> +get_inac_timeout(#state{cur_req = #request{options = Opts}}) -> get_value(inactivity_timeout, Opts, infinity); get_inac_timeout(#state{cur_req = undefined}) -> infinity. diff --git a/src/ibrowse/ibrowse_lb.erl b/src/ibrowse/ibrowse_lb.erl index 9212ccd7..b0654b72 100644 --- a/src/ibrowse/ibrowse_lb.erl +++ b/src/ibrowse/ibrowse_lb.erl @@ -1,7 +1,7 @@ %%%------------------------------------------------------------------- %%% File : ibrowse_lb.erl %%% Author : chandru <chandrashekhar.mullaparthi@t-mobile.co.uk> -%%% Description : +%%% Description : %%% %%% Created : 6 Mar 2008 by chandru <chandrashekhar.mullaparthi@t-mobile.co.uk> %%%------------------------------------------------------------------- @@ -101,7 +101,7 @@ spawn_connection(Lb_pid, Url, % #state{max_sessions = Max_sess, % ets_tid = Tid, % max_pipeline_size = Max_pipe_sz, -% num_cur_sessions = Num} = State) +% num_cur_sessions = Num} = State) % when Num >= Max -> % Reply = find_best_connection(Tid), % {reply, sorry_dude_reuse, State}; @@ -109,7 +109,7 @@ spawn_connection(Lb_pid, Url, %% Update max_sessions in #state with supplied value handle_call({spawn_connection, _Url, Max_sess, Max_pipe, _}, _From, #state{ets_tid = Tid, - num_cur_sessions = Num} = State) + num_cur_sessions = Num} = State) when Num >= Max_sess -> Reply = find_best_connection(Tid, Max_pipe), {reply, Reply, State#state{max_sessions = Max_sess}}; diff --git a/src/ibrowse/ibrowse_lib.erl b/src/ibrowse/ibrowse_lib.erl index 67c5eee2..7567a6a6 100644 --- a/src/ibrowse/ibrowse_lib.erl +++ b/src/ibrowse/ibrowse_lib.erl @@ -1,6 +1,6 @@ %%% File : ibrowse_lib.erl %%% Author : Chandrashekhar Mullaparthi <chandrashekhar.mullaparthi@t-mobile.co.uk> -%%% Description : +%%% Description : %%% Created : 27 Feb 2004 by Chandrashekhar Mullaparthi <chandrashekhar.mullaparthi@t-mobile.co.uk> %% @doc Module with a few useful functions @@ -110,7 +110,7 @@ month_int("Oct") -> 10; month_int("Nov") -> 11; month_int("Dec") -> 12. -%% @doc Given a status code, returns an atom describing the status code. +%% @doc Given a status code, returns an atom describing the status code. %% @spec status_code(StatusCode::status_code()) -> StatusDescription %% status_code() = string() | integer() %% StatusDescription = atom() @@ -271,7 +271,7 @@ parse_url([$:, $/, $/ | _], get_protocol, Url, []) -> {invalid_uri_1, Url}; parse_url([$:, $/, $/ | T], get_protocol, Url, TmpAcc) -> Prot = list_to_atom(lists:reverse(TmpAcc)), - parse_url(T, get_username, + parse_url(T, get_username, Url#url{protocol = Prot}, []); parse_url([$/ | T], get_username, Url, TmpAcc) -> @@ -285,16 +285,16 @@ parse_url([$: | T], get_username, Url, TmpAcc) -> %% a username/password. If we encounter a '@' later on, there is a %% username/password indeed. If we encounter a '/', it was %% actually the hostname - parse_url(T, get_password, + parse_url(T, get_password, Url#url{username = lists:reverse(TmpAcc)}, []); parse_url([$@ | T], get_username, Url, TmpAcc) -> - parse_url(T, get_host, + parse_url(T, get_host, Url#url{username = lists:reverse(TmpAcc), password = ""}, []); parse_url([$@ | T], get_password, Url, TmpAcc) -> - parse_url(T, get_host, + parse_url(T, get_host, Url#url{password = lists:reverse(TmpAcc)}, []); parse_url([$/ | T], get_password, Url, TmpAcc) -> @@ -308,7 +308,7 @@ parse_url([$/ | T], get_password, Url, TmpAcc) -> password = undefined, path = [$/ | T]}; parse_url([$: | T], get_host, #url{} = Url, TmpAcc) -> - parse_url(T, get_port, + parse_url(T, get_port, Url#url{host = lists:reverse(TmpAcc)}, []); parse_url([$/ | T], get_host, #url{protocol=Prot} = Url, TmpAcc) -> @@ -340,7 +340,7 @@ parse_url([], get_port, #url{protocol=Prot} = Url, TmpAcc) -> _ -> list_to_integer(lists:reverse(TmpAcc)) end, - Url#url{port = Port, + Url#url{port = Port, path = "/"}; parse_url([], get_password, Url, TmpAcc) -> %% Ok, what we thought was the username/password was the hostname @@ -387,12 +387,12 @@ do_trace(Fmt, Args) -> -ifdef(DEBUG). do_trace(_, Fmt, Args) -> io:format("~s -- (~s) - "++Fmt, - [printable_date(), + [printable_date(), get(ibrowse_trace_token) | Args]). -else. do_trace(true, Fmt, Args) -> io:format("~s -- (~s) - "++Fmt, - [printable_date(), + [printable_date(), get(ibrowse_trace_token) | Args]); do_trace(_, _, _) -> ok. diff --git a/src/ibrowse/ibrowse_sup.erl b/src/ibrowse/ibrowse_sup.erl index 300435d4..1b9b863a 100644 --- a/src/ibrowse/ibrowse_sup.erl +++ b/src/ibrowse/ibrowse_sup.erl @@ -1,7 +1,7 @@ %%%------------------------------------------------------------------- %%% File : ibrowse_sup.erl %%% Author : Chandrashekhar Mullaparthi <chandrashekhar.mullaparthi@t-mobile.co.uk> -%%% Description : +%%% Description : %%% %%% Created : 15 Oct 2003 by Chandrashekhar Mullaparthi <chandrashekhar.mullaparthi@t-mobile.co.uk> %%%------------------------------------------------------------------- @@ -53,7 +53,7 @@ start_link() -> %% Func: init/1 %% Returns: {ok, {SupFlags, [ChildSpec]}} | %% ignore | -%% {error, Reason} +%% {error, Reason} %%-------------------------------------------------------------------- init([]) -> AChild = {ibrowse,{ibrowse,start_link,[]}, diff --git a/src/ibrowse/ibrowse_test.erl b/src/ibrowse/ibrowse_test.erl index ad3e8126..cab1f882 100644 --- a/src/ibrowse/ibrowse_test.erl +++ b/src/ibrowse/ibrowse_test.erl @@ -225,7 +225,7 @@ unit_tests() -> unit_tests(Options) -> Options_1 = Options ++ [{connect_timeout, 5000}], {Pid, Ref} = erlang:spawn_monitor(?MODULE, unit_tests_1, [self(), Options_1]), - receive + receive {done, Pid} -> ok; {'DOWN', Ref, _, _, Info} -> @@ -292,7 +292,7 @@ compare_responses(R1, R2, R3) -> do_async_req_list(Url, Method, Options) -> {Pid,_} = erlang:spawn_monitor(?MODULE, i_do_async_req_list, - [self(), Url, Method, + [self(), Url, Method, Options ++ [{stream_chunk_size, 1000}]]), io:format("Spawned process ~p~n", [Pid]), wait_for_resp(Pid). |