Browse Source

Release 2.1.1. Various fixes. See README

pull/24/head v2.1.1
Chandrashekhar Mullaparthi 14 years ago
parent
commit
3dabcaa174
6 changed files with 34 additions and 53 deletions
  1. +21
    -9
      README
  2. +1
    -1
      ebin/ibrowse.app
  3. +1
    -1
      src/ibrowse.erl
  4. +10
    -18
      src/ibrowse_http_client.erl
  5. +0
    -23
      src/ibrowse_lib.erl
  6. +1
    -1
      vsn.mk

+ 21
- 9
README View File

@ -18,7 +18,7 @@ ibrowse is available under two different licenses. LGPL or the BSD license.
Comments to : Chandrashekhar.Mullaparthi@gmail.com Comments to : Chandrashekhar.Mullaparthi@gmail.com
Version : 2.1.0
Version : 2.1.1
Latest version : git://github.com/cmullaparthi/ibrowse.git Latest version : git://github.com/cmullaparthi/ibrowse.git
@ -42,11 +42,11 @@ Erik Reitsma
Filipe David Manana Filipe David Manana
Geoff Cant Geoff Cant
Jeroen Koops Jeroen Koops
João Lopes
João Lopes
Karol Skocik Karol Skocik
Kostis Sagonas Kostis Sagonas
Matthew Reilly Matthew Reilly
Oscar Hellström
Oscar Hellström
Paul J. Davis Paul J. Davis
Peter Kristensen Peter Kristensen
Ram Krishnan Ram Krishnan
@ -55,11 +55,23 @@ Sean Hinde
Seth Falcon Seth Falcon
Steve Vinoski Steve Vinoski
Thomas Lindgren Thomas Lindgren
Younès Hafri
Younès Hafri
tholschuh (https://github.com/tholschuh/) tholschuh (https://github.com/tholschuh/)
CONTRIBUTIONS & CHANGE HISTORY CONTRIBUTIONS & CHANGE HISTORY
============================== ==============================
10-12-2010 - v2.1.1
* Fix for https://github.com/cmullaparthi/ibrowse/issues/issue/20
by Filipe David Manana
* Fix for https://github.com/cmullaparthi/ibrowse/issues/issue/21
by Filipe David Manana
* Fix for https://github.com/cmullaparthi/ibrowse/issues/issue/23
by Filipe David Manana
* Fix for bugs when using SSL by João Lopes
25-10-2010 - v2.1.0 25-10-2010 - v2.1.0
* Fixed build on OpenSolaris. Bug report and patch from * Fixed build on OpenSolaris. Bug report and patch from
tholschuh. tholschuh.
@ -70,7 +82,7 @@ CONTRIBUTIONS & CHANGE HISTORY
http://github.com/cmullaparthi/ibrowse/issues/issue/11 http://github.com/cmullaparthi/ibrowse/issues/issue/11
* Prevent atom table pollution when bogus URLs are input to * Prevent atom table pollution when bogus URLs are input to
ibrowse. Bug report by João Lopes.
ibrowse. Bug report by João Lopes.
http://github.com/cmullaparthi/ibrowse/issues/issue/13 http://github.com/cmullaparthi/ibrowse/issues/issue/13
* Automatically do Chunked-Transfer encoding of request body * Automatically do Chunked-Transfer encoding of request body
@ -94,7 +106,7 @@ CONTRIBUTIONS & CHANGE HISTORY
* Added ibrowse:stream_close/1 to close the connection * Added ibrowse:stream_close/1 to close the connection
associated with a certain response stream. Patch provided by associated with a certain response stream. Patch provided by
João Lopes.
João Lopes.
* Prevent port number being included in the Host header when port * Prevent port number being included in the Host header when port
443 is intended. Bug reported by Andrew Tunnell-Jones 443 is intended. Bug reported by Andrew Tunnell-Jones
@ -183,7 +195,7 @@ CONTRIBUTIONS & CHANGE HISTORY
- Patch submitted by Steve Vinoski to remove compiler warnings - Patch submitted by Steve Vinoski to remove compiler warnings
about the use of obsolete guards about the use of obsolete guards
29-06-2009 - * Fixed following issues reported by Oscar Hellström
29-06-2009 - * Fixed following issues reported by Oscar Hellström
- Use {active, once} instead of {active, true} - Use {active, once} instead of {active, true}
- Fix 'dodgy' timeout handling - Fix 'dodgy' timeout handling
- Use binaries internally instead of lists to reduce memory - Use binaries internally instead of lists to reduce memory
@ -263,7 +275,7 @@ CONTRIBUTIONS & CHANGE HISTORY
12-01-2007 - Derek Upham sent in a bug fix. The reset_state function was not 12-01-2007 - Derek Upham sent in a bug fix. The reset_state function was not
behaving correctly when the transfer encoding was not chunked. behaving correctly when the transfer encoding was not chunked.
13-11-2006 - Youn�s Hafri reported a bug where ibrowse was not returning the
13-11-2006 - Youn�s Hafri reported a bug where ibrowse was not returning the
temporary filename when the server was closing the connection temporary filename when the server was closing the connection
after sending the data (as in HTTP/1.0). after sending the data (as in HTTP/1.0).
Released ibrowse under the BSD license Released ibrowse under the BSD license
@ -282,7 +294,7 @@ CONTRIBUTIONS & CHANGE HISTORY
22-Nov-2005 - Added ability to generate requests using the Chunked 22-Nov-2005 - Added ability to generate requests using the Chunked
Transfer-Encoding. Transfer-Encoding.
08-May-2005 - Youn�s Hafri made a CRUX LINUX port of ibrowse.
08-May-2005 - Youn�s Hafri made a CRUX LINUX port of ibrowse.
http://yhafri.club.fr/crux/index.html http://yhafri.club.fr/crux/index.html
Here are some usage examples. Enjoy! Here are some usage examples. Enjoy!

+ 1
- 1
ebin/ibrowse.app View File

@ -1,6 +1,6 @@
{application, ibrowse, {application, ibrowse,
[{description, "HTTP client application"}, [{description, "HTTP client application"},
{vsn, "2.1.0"},
{vsn, "2.1.1"},
{modules, [ ibrowse, {modules, [ ibrowse,
ibrowse_http_client, ibrowse_http_client,
ibrowse_app, ibrowse_app,

+ 1
- 1
src/ibrowse.erl View File

@ -7,7 +7,7 @@
%%%------------------------------------------------------------------- %%%-------------------------------------------------------------------
%% @author Chandrashekhar Mullaparthi <chandrashekhar dot mullaparthi at gmail dot com> %% @author Chandrashekhar Mullaparthi <chandrashekhar dot mullaparthi at gmail dot com>
%% @copyright 2005-2010 Chandrashekhar Mullaparthi %% @copyright 2005-2010 Chandrashekhar Mullaparthi
%% @version 2.1.0
%% @version 2.1.1
%% @doc The ibrowse application implements an HTTP 1.1 client in erlang. This %% @doc The ibrowse application implements an HTTP 1.1 client in erlang. This
%% module implements the API of the HTTP client. There is one named %% module implements the API of the HTTP client. There is one named
%% process called 'ibrowse' which assists in load balancing and maintaining configuration. There is one load balancing process per unique webserver. There is %% process called 'ibrowse' which assists in load balancing and maintaining configuration. There is one load balancing process per unique webserver. There is

+ 10
- 18
src/ibrowse_http_client.erl View File

@ -69,7 +69,7 @@
]). ]).
-define(DEFAULT_STREAM_CHUNK_SIZE, 1024*1024). -define(DEFAULT_STREAM_CHUNK_SIZE, 1024*1024).
-define(dec2hex(X), erlang:integer_to_list(X, 16)).
%%==================================================================== %%====================================================================
%% External functions %% External functions
%%==================================================================== %%====================================================================
@ -369,15 +369,6 @@ accumulate_response(Data, #state{cur_req = #request{save_response_to_file = Srtf
{error, Reason} -> {error, Reason} ->
{error, {file_write_error, Reason}} {error, {file_write_error, Reason}}
end; end;
%% accumulate_response(<<>>, #state{cur_req = #request{caller_controls_socket = Ccs},
%% socket = Socket} = State) ->
%% case Ccs of
%% true ->
%% do_setopts(Socket, [{active, once}], State);
%% false ->
%% ok
%% end,
%% State;
accumulate_response(Data, #state{reply_buffer = RepBuf, accumulate_response(Data, #state{reply_buffer = RepBuf,
rep_buf_size = RepBufSize, rep_buf_size = RepBufSize,
streamed_size = Streamed_size, streamed_size = Streamed_size,
@ -544,7 +535,7 @@ do_send_body1(Source, Resp, State, TE) ->
maybe_chunked_encode(Data, false) -> maybe_chunked_encode(Data, false) ->
Data; Data;
maybe_chunked_encode(Data, true) -> maybe_chunked_encode(Data, true) ->
[ibrowse_lib:dec2hex(4, size(to_binary(Data))), "\r\n", Data, "\r\n"].
[?dec2hex(size(to_binary(Data))), "\r\n", Data, "\r\n"].
do_close(#state{socket = undefined}) -> ok; do_close(#state{socket = undefined}) -> ok;
do_close(#state{socket = Sock, do_close(#state{socket = Sock,
@ -830,13 +821,14 @@ make_request(Method, Headers, AbsPath, RelPath, Body, Options,
Headers_0 = [Fun1(X) || X <- Headers], Headers_0 = [Fun1(X) || X <- Headers],
Headers_1 = Headers_1 =
case lists:keysearch("content-length", 1, Headers_0) of case lists:keysearch("content-length", 1, Headers_0) of
false when (Body == [] orelse Body == <<>>) andalso
(Method == post orelse Method == put) ->
false when (Body =:= [] orelse Body =:= <<>>) andalso
(Method =:= post orelse Method =:= put) ->
[{"content-length", "Content-Length", "0"} | Headers_0]; [{"content-length", "Content-Length", "0"} | Headers_0];
false when is_binary(Body) orelse is_list(Body) -> false when is_binary(Body) orelse is_list(Body) ->
[{"content-length", "Content-Length", integer_to_list(iolist_size(Body))} | Headers_0]; [{"content-length", "Content-Length", integer_to_list(iolist_size(Body))} | Headers_0];
_ -> _ ->
%% Content-Length is already specified or Body is a function or function/state pair
%% Content-Length is already specified or Body is a
%% function or function/state pair
Headers_0 Headers_0
end, end,
{Headers_2, Body_1} = {Headers_2, Body_1} =
@ -922,23 +914,23 @@ chunk_request_body(Body, _ChunkSize, Acc) when Body == <<>>; Body == [] ->
chunk_request_body(Body, ChunkSize, Acc) when is_binary(Body), chunk_request_body(Body, ChunkSize, Acc) when is_binary(Body),
size(Body) >= ChunkSize -> size(Body) >= ChunkSize ->
<<ChunkBody:ChunkSize/binary, Rest/binary>> = Body, <<ChunkBody:ChunkSize/binary, Rest/binary>> = Body,
Chunk = [ibrowse_lib:dec2hex(4, ChunkSize),"\r\n",
Chunk = [?dec2hex(ChunkSize),"\r\n",
ChunkBody, "\r\n"], ChunkBody, "\r\n"],
chunk_request_body(Rest, ChunkSize, [Chunk | Acc]); chunk_request_body(Rest, ChunkSize, [Chunk | Acc]);
chunk_request_body(Body, _ChunkSize, Acc) when is_binary(Body) -> chunk_request_body(Body, _ChunkSize, Acc) when is_binary(Body) ->
BodySize = size(Body), BodySize = size(Body),
Chunk = [ibrowse_lib:dec2hex(4, BodySize),"\r\n",
Chunk = [?dec2hex(BodySize),"\r\n",
Body, "\r\n"], Body, "\r\n"],
LastChunk = "0\r\n", LastChunk = "0\r\n",
lists:reverse(["\r\n", LastChunk, Chunk | Acc]); lists:reverse(["\r\n", LastChunk, Chunk | Acc]);
chunk_request_body(Body, ChunkSize, Acc) when length(Body) >= ChunkSize -> chunk_request_body(Body, ChunkSize, Acc) when length(Body) >= ChunkSize ->
{ChunkBody, Rest} = split_list_at(Body, ChunkSize), {ChunkBody, Rest} = split_list_at(Body, ChunkSize),
Chunk = [ibrowse_lib:dec2hex(4, ChunkSize),"\r\n",
Chunk = [?dec2hex(ChunkSize),"\r\n",
ChunkBody, "\r\n"], ChunkBody, "\r\n"],
chunk_request_body(Rest, ChunkSize, [Chunk | Acc]); chunk_request_body(Rest, ChunkSize, [Chunk | Acc]);
chunk_request_body(Body, _ChunkSize, Acc) when is_list(Body) -> chunk_request_body(Body, _ChunkSize, Acc) when is_list(Body) ->
BodySize = length(Body), BodySize = length(Body),
Chunk = [ibrowse_lib:dec2hex(4, BodySize),"\r\n",
Chunk = [?dec2hex(BodySize),"\r\n",
Body, "\r\n"], Body, "\r\n"],
LastChunk = "0\r\n", LastChunk = "0\r\n",
lists:reverse(["\r\n", LastChunk, Chunk | Acc]). lists:reverse(["\r\n", LastChunk, Chunk | Acc]).

+ 0
- 23
src/ibrowse_lib.erl View File

@ -19,9 +19,6 @@
url_encode/1, url_encode/1,
decode_rfc822_date/1, decode_rfc822_date/1,
status_code/1, status_code/1,
dec2hex/2,
drv_ue/1,
drv_ue/2,
encode_base64/1, encode_base64/1,
decode_base64/1, decode_base64/1,
get_value/2, get_value/2,
@ -33,17 +30,6 @@
get_trace_status(Host, Port) -> get_trace_status(Host, Port) ->
ibrowse:get_config_value({trace, Host, Port}, false). ibrowse:get_config_value({trace, Host, Port}, false).
drv_ue(Str) ->
[{port, Port}| _] = ets:lookup(ibrowse_table, port),
drv_ue(Str, Port).
drv_ue(Str, Port) ->
case erlang:port_control(Port, 1, Str) of
[] ->
Str;
Res ->
Res
end.
%% @doc URL-encodes a string based on RFC 1738. Returns a flat list. %% @doc URL-encodes a string based on RFC 1738. Returns a flat list.
%% @spec url_encode(Str) -> UrlEncodedStr %% @spec url_encode(Str) -> UrlEncodedStr
%% Str = string() %% Str = string()
@ -163,15 +149,6 @@ status_code(507) -> insufficient_storage;
status_code(X) when is_list(X) -> status_code(list_to_integer(X)); status_code(X) when is_list(X) -> status_code(list_to_integer(X));
status_code(_) -> unknown_status_code. status_code(_) -> unknown_status_code.
%% @doc dec2hex taken from gtk.erl in std dist
%% M = integer() -- number of hex digits required
%% N = integer() -- the number to represent as hex
%% @spec dec2hex(M::integer(), N::integer()) -> string()
dec2hex(M,N) -> dec2hex(M,N,[]).
dec2hex(0,_N,Ack) -> Ack;
dec2hex(M,N,Ack) -> dec2hex(M-1,N bsr 4,[d2h(N band 15)|Ack]).
%% @doc Implements the base64 encoding algorithm. The output data type matches in the input data type. %% @doc Implements the base64 encoding algorithm. The output data type matches in the input data type.
%% @spec encode_base64(In) -> Out %% @spec encode_base64(In) -> Out
%% In = string() | binary() %% In = string() | binary()

+ 1
- 1
vsn.mk View File

@ -1,2 +1,2 @@
IBROWSE_VSN = 2.1.0
IBROWSE_VSN = 2.1.1

Loading…
Cancel
Save