aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/doc/src/http_client.xml
diff options
context:
space:
mode:
authorPéter Dimitrov <[email protected]>2018-02-20 15:24:46 +0100
committerPéter Dimitrov <[email protected]>2018-02-26 09:41:21 +0100
commitae2daff04fdf7aca199e799c4f3024519e7d53f0 (patch)
tree700787407ec674ae4e3615988105e613265c9a36 /lib/inets/doc/src/http_client.xml
parentb3fd7dc1b52520065e9dc977195608baf1f206ce (diff)
downloadotp-ae2daff04fdf7aca199e799c4f3024519e7d53f0.tar.gz
otp-ae2daff04fdf7aca199e799c4f3024519e7d53f0.tar.bz2
otp-ae2daff04fdf7aca199e799c4f3024519e7d53f0.zip
inets: Add unix domain socket support to httpc
Change-Id: I44fe2670e36884e09600d17dd71b1e86b9ee75fa
Diffstat (limited to 'lib/inets/doc/src/http_client.xml')
-rw-r--r--lib/inets/doc/src/http_client.xml15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/inets/doc/src/http_client.xml b/lib/inets/doc/src/http_client.xml
index 212958f17f..15e383ec77 100644
--- a/lib/inets/doc/src/http_client.xml
+++ b/lib/inets/doc/src/http_client.xml
@@ -97,27 +97,32 @@
7 > {ok, {{NewVersion, 200, NewReasonPhrase}, NewHeaders, NewBody}} =
httpc:request(get, {"http://www.erlang.org", [{"connection", "close"}]},
[], []).</code>
-
+ <p>This sends an HTTP request over a unix domain socket (experimental):</p>
+ <code type="erl">
+ 8 > httpc:set_options([{ipfamily, local},
+ {unix_socket,"/tmp/unix_socket/consul_http.sock"}]).
+ 9 > {ok, {{NewVersion, 200, NewReasonPhrase}, NewHeaders, NewBody}} =
+ httpc:request(put, {"http:///v1/kv/foo", [], [], "hello"}, [], []).</code>
<p>Start an HTTP client profile:</p>
<code><![CDATA[
- 8 > {ok, Pid} = inets:start(httpc, [{profile, foo}]).
+ 10 > {ok, Pid} = inets:start(httpc, [{profile, foo}]).
{ok, <0.45.0>}
]]></code>
<p>The new profile has no proxy settings, so the connection is refused:</p>
<code type="erl">
- 9 > httpc:request("http://www.erlang.org", foo).
+ 11 > httpc:request("http://www.erlang.org", foo).
{error, econnrefused}</code>
<p>Stop the HTTP client profile:</p>
<code type="erl">
- 10 > inets:stop(httpc, foo).
+ 12 > inets:stop(httpc, foo).
ok</code>
<p>Alternative way to stop the HTTP client profile:</p>
<code type="erl">
- 10 > inets:stop(httpc, Pid).
+ 13 > inets:stop(httpc, Pid).
ok</code>
</section>