From f39609df9458a7ccfc986b8d83beba5a0665680e Mon Sep 17 00:00:00 2001 From: chandrusf Date: Mon, 13 Nov 2006 20:41:36 +0000 Subject: [PATCH] Release under BSD license. Fix for bug reported by Younes Hafri. See README for more details --- BSD_LICENSE | 10 ++++++++++ README | 26 ++++++++++++++++++-------- src/ibrowse_http_client.erl | 17 +++++++++++++---- vsn.mk | 2 +- 4 files changed, 42 insertions(+), 13 deletions(-) create mode 100644 BSD_LICENSE diff --git a/BSD_LICENSE b/BSD_LICENSE new file mode 100644 index 0000000..3cf5d2c --- /dev/null +++ b/BSD_LICENSE @@ -0,0 +1,10 @@ +Copyright (c) 2006, Chandrashekhar Mullaparthi +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + * Neither the name of the T-Mobile nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README b/README index c0ccbb4..6957dae 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -$Id: README,v 1.5 2006/10/12 09:25:29 chandrusf Exp $ +$Id: README,v 1.6 2006/11/13 20:41:36 chandrusf Exp $ ibrowse is a HTTP client. The following are a list of features. - RFC2616 compliant (AFAIK) @@ -15,23 +15,33 @@ ibrowse is a HTTP client. The following are a list of features. - Can talk to Secure webservers using SSL - any other features in the code not listed here :) +ibrowse is available under two different licenses. LGPL and the BSD license. + Comments to : Chandrashekhar.Mullaparthi@t-mobile.co.uk CONTRIBUTIONS & CHANGE HISTORY ============================== -08-May-2005 - Youns Hafri made a CRUX LINUX port of ibrowse. - http://yhafri.club.fr/crux/index.html +13-11-2006 - Youns Hafri reported a bug where ibrowse was not returning the + temporary filename when the server was closing the connection + after sending the data (as in HTTP/1.0). + Released ibrowse under the BSD license -22-Nov-2005 - Added ability to generate requests using the Chunked - Transfer-Encoding. +12-10-2006 - Chris Newcombe reported bug in dealing with requests where no + body is expected in the response. The first request would succeed + and the next request would hang. + +24-May-2006 - Sean Hinde reported a bug. Async responses with pipelining was + returning the wrong result. 08-Dec-2005 - Richard Cameron (camster@citeulike.org). Patch to ibrowse to prevent port number being included in the Host header when port 80 is intended. -12-10-2006 - Chris Newcombe reported bug in dealing with requests where no - body is expected in the response. The first request would succeed - and the next request would hang. +22-Nov-2005 - Added ability to generate requests using the Chunked + Transfer-Encoding. + +08-May-2005 - Youns Hafri made a CRUX LINUX port of ibrowse. + http://yhafri.club.fr/crux/index.html Here are some usage examples. Enjoy! diff --git a/src/ibrowse_http_client.erl b/src/ibrowse_http_client.erl index a879a9d..82e87f5 100644 --- a/src/ibrowse_http_client.erl +++ b/src/ibrowse_http_client.erl @@ -6,7 +6,7 @@ %%% Created : 11 Oct 2003 by Chandrashekhar Mullaparthi %%%------------------------------------------------------------------- -module(ibrowse_http_client). --vsn('$Id: ibrowse_http_client.erl,v 1.7 2006/10/12 09:25:30 chandrusf Exp $ '). +-vsn('$Id: ibrowse_http_client.erl,v 1.8 2006/11/13 20:41:36 chandrusf Exp $ '). -behaviour(gen_server). %%-------------------------------------------------------------------- @@ -410,13 +410,22 @@ handle_sock_closed(#state{cur_req=undefined}) -> %% of response. There maybe requests pipelined which need a response. handle_sock_closed(#state{reply_buffer=Buf, reqs=Reqs, http_status_code=SC, is_closing=IsClosing, cur_req=CurReq, + tmp_file_name=TmpFilename, tmp_file_fd=Fd, status=get_body, recvd_headers=Headers}=State) -> #request{from=From, stream_to=StreamTo, req_id=ReqId} = CurReq, case IsClosing of true -> {_, Reqs_1} = queue:out(Reqs), -% {{value, Req}, Reqs_1} = queue:out(Reqs), - do_reply(From, StreamTo, ReqId, {ok, SC, Headers, lists:flatten(lists:reverse(Buf))}), + case TmpFilename of + undefined -> + do_reply(From, StreamTo, ReqId, + {ok, SC, Headers, + lists:flatten(lists:reverse(Buf))}); + _ -> + file:close(Fd), + do_reply(From, StreamTo, ReqId, + {ok, SC, Headers, {file, TmpFilename}}) + end, do_error_reply(State#state{reqs = Reqs_1}, connection_closed); _ -> do_error_reply(State, connection_closed) @@ -858,9 +867,9 @@ handle_response(#request{from=From, stream_to=StreamTo, req_id=ReqId}, send_timer=ReqTimer, recvd_headers = RespHeaders}=State) -> State_1 = set_cur_request(State), + file:close(Fd), do_reply(From, StreamTo, ReqId, {ok, SCode, RespHeaders, {file, TmpFilename}}), cancel_timer(ReqTimer, {eat_message, {req_timedout, From}}), - file:close(Fd), State_1#state{tmp_file_name=undefined, tmp_file_fd=undefined}; handle_response(#request{from=From, stream_to=StreamTo, req_id=ReqId}, #state{http_status_code=SCode, recvd_headers=RespHeaders, diff --git a/vsn.mk b/vsn.mk index 533fb28..3b6d337 100644 --- a/vsn.mk +++ b/vsn.mk @@ -1,2 +1,2 @@ -IBROWSE_VSN = 1.2.2 +IBROWSE_VSN = 1.2.3