path, % string()
read_buffer, % iolist()
write_buffer, % iolist()
- http_options % see http(3)
+ http_options, % see http(3)
+ extra_headers % [{str(), str()}, ...]
}).
%%====================================================================
path = Path,
read_buffer = [],
write_buffer = [],
- http_options = []},
+ http_options = [],
+ extra_headers = []},
ApplyOption =
fun
({http_options, HttpOpts}, State = #http_transport{}) ->
State#http_transport{http_options = HttpOpts};
+ ({extra_headers, ExtraHeaders}, State = #http_transport{}) ->
+ State#http_transport{extra_headers = ExtraHeaders};
(Other, #http_transport{}) ->
{invalid_option, Other};
(_, Error) ->
path = Path,
read_buffer = Rbuf,
write_buffer = Wbuf,
- http_options = HttpOptions}) ->
+ http_options = HttpOptions,
+ extra_headers = ExtraHeaders}) ->
case iolist_to_binary(Wbuf) of
<<>> ->
%% Don't bother flushing empty buffers.
{ok, {{_Version, 200, _ReasonPhrase}, _Headers, Body}} =
http:request(post,
{"http://" ++ Host ++ Path,
- [{"User-Agent", "Erlang/thrift_http_transport"}],
+ [{"User-Agent", "Erlang/thrift_http_transport"} | ExtraHeaders],
"application/x-thrift",
WBinary},
HttpOptions,