diff --git a/README b/README
index d8637a5..e534803 100644
--- a/README
+++ b/README
@@ -18,12 +18,14 @@ ibrowse is available under two different licenses. LGPL and the BSD license.
Comments to : Chandrashekhar.Mullaparthi@gmail.com
-Version : 1.5.5
+Version : 1.5.6
Latest version : git://github.com/cmullaparthi/ibrowse.git
CONTRIBUTIONS & CHANGE HISTORY
==============================
+08-11-2009 - * Added option headers_as_is
+
04-10-2009 - * Patch from Kostis Sagonas to cleanup some code and suppress
dialyzer warnings
diff --git a/src/ibrowse.erl b/src/ibrowse.erl
index 0cfe860..eaf9aae 100644
--- a/src/ibrowse.erl
+++ b/src/ibrowse.erl
@@ -226,12 +226,16 @@ send_req(Url, Headers, Method, Body) ->
%% request to complete will be 1000 milliseconds minus the time taken
%% for connection setup.
%%
-%%
%%
%%
The socket_options
option can be used to set
%% specific options on the socket. The {active, true | false | once}
%% and {packet_type, Packet_type}
will be filtered out by ibrowse.
%%
+%% The headers_as_is
option is to enable the caller
+%% to send headers exactly as specified in the request without ibrowse
+%% adding some of its own. Required for some picky servers apparently.
+%%
+%%
%% @spec send_req(Url::string(), Headers::headerList(), Method::method(), Body::body(), Options::optionList()) -> response()
%% optionList() = [option()]
%% option() = {max_sessions, integer()} |
@@ -258,7 +262,8 @@ send_req(Url, Headers, Method, Body) ->
%% {inactivity_timeout, integer()} |
%% {connect_timeout, integer()} |
%% {socket_options, Sock_opts} |
-%% {transfer_encoding, {chunked, ChunkSize}}
+%% {transfer_encoding, {chunked, ChunkSize}} |
+%% {headers_as_is, boolean()}
%%
%% stream_to() = process() | {process(), once}
%% process() = pid() | atom()
diff --git a/src/ibrowse_http_client.erl b/src/ibrowse_http_client.erl
index af1f108..4fdb334 100644
--- a/src/ibrowse_http_client.erl
+++ b/src/ibrowse_http_client.erl
@@ -81,7 +81,8 @@ start_link(Args) ->
gen_server:start_link(?MODULE, Args, []).
stop(Conn_pid) ->
- gen_server:call(Conn_pid, stop).
+ catch gen_server:call(Conn_pid, stop),
+ ok.
send_req(Conn_Pid, Url, Headers, Method, Body, Options, Timeout) ->
gen_server:call(
@@ -527,8 +528,6 @@ send_req_1(From,
end;
send_req_1(From,
#url{abspath = AbsPath,
- host = Host,
- port = Port,
path = RelPath} = Url,
Headers, Method, Body, Options, Timeout,
#state{status = Status,
@@ -565,18 +564,9 @@ send_req_1(From,
response_format = Resp_format,
from = From},
State_1 = State#state{reqs=queue:in(NewReq, State#state.reqs)},
- Headers_1 = add_auth_headers(Url, Options, Headers, State_1),
- HostHeaderValue = case lists:keysearch(host_header, 1, Options) of
- false ->
- case Port of
- 80 -> Host;
- _ -> [Host, ":", integer_to_list(Port)]
- end;
- {value, {_, Host_h_val}} ->
- Host_h_val
- end,
+ Headers_1 = maybe_modify_headers(Url, Options, Headers, State_1),
{Req, Body_1} = make_request(Method,
- [{"Host", HostHeaderValue} | Headers_1],
+ Headers_1,
AbsPath, RelPath, Body, Options, State_1#state.use_proxy),
case get(my_trace_flag) of
true ->
@@ -628,6 +618,25 @@ send_req_1(From,
{stop, normal, State_1}
end.
+maybe_modify_headers(#url{host = Host, port = Port} = Url,
+ Options, Headers, State) ->
+ case get_value(headers_as_is, Options, false) of
+ false ->
+ Headers_1 = add_auth_headers(Url, Options, Headers, State),
+ HostHeaderValue = case lists:keysearch(host_header, 1, Options) of
+ false ->
+ case Port of
+ 80 -> Host;
+ _ -> [Host, ":", integer_to_list(Port)]
+ end;
+ {value, {_, Host_h_val}} ->
+ Host_h_val
+ end,
+ [{"Host", HostHeaderValue} | Headers_1];
+ true ->
+ Headers
+ end.
+
add_auth_headers(#url{username = User,
password = UPw},
Options,
diff --git a/vsn.mk b/vsn.mk
index fedd2c5..4b3c4df 100644
--- a/vsn.mk
+++ b/vsn.mk
@@ -1,2 +1,2 @@
-IBROWSE_VSN = 1.5.5
+IBROWSE_VSN = 1.5.6