From f31b34c4ebf66fb9226047dd1f3cb6fa81a2a6c9 Mon Sep 17 00:00:00 2001
From: Micael Karlberg For valid properties see For valid properties see
+
[{inets, [{services, [{httpc, PropertyList}]}]}]
-
- 2 > http:set_options([{proxy, {{"www-proxy.mycompany.com", 8000},
+ 2 > httpc:set_options([{proxy, {{"www-proxy.mycompany.com", 8000},
["localhost"]}}]).
ok
An ordinary synchronous request.
3 > {ok, {{Version, 200, ReasonPhrase}, Headers, Body}} =
- http:request(get, {"http://www.erlang.org", []}, [], []).
+ httpc:request(get, {"http://www.erlang.org", []}, [], []).
With all default values, as above, a get request can also be written like this.
4 > {ok, {{Version, 200, ReasonPhrase}, Headers, Body}} =
- http:request("http://www.erlang.org").
+ httpc:request("http://www.erlang.org").
An ordinary asynchronous request. The result will be sent to the calling process on the form {http, {ReqestId, Result}}
5 > {ok, RequestId} =
- http:request(get, {"http://www.erlang.org", []}, [], [{sync, false}]).
+ httpc:request(get, {"http://www.erlang.org", []}, [], [{sync, false}]).
In this case the calling process is the shell, so we receive the result.
- 6 > receive {http, {RequestId, Result}} -> ok after 500 -> error end.
+ 6 > receive {http, {RequestId, Result}} -> ok after 500 -> error end.
ok
Send a request with a specified connection header.
7 > {ok, {{NewVersion, 200, NewReasonPhrase}, NewHeaders, NewBody}} =
- http:request(get, {"http://www.erlang.org", [{"connection", "close"}]},
+ httpc:request(get, {"http://www.erlang.org", [{"connection", "close"}]},
[], []).
Start a HTTP client profile.
{ok, Pid} = inets:start(httpc, [{profile, foo}]).
+ 8 > {ok, Pid} = inets:start(httpc, [{profile, foo}]).
{ok, <0.45.0>}
]]>
The new profile has no proxy settings so the connection will be refused
- 9 > http:request("http://www.erlang.org", foo).
- {error,econnrefused}
+ 9 > httpc:request("http://www.erlang.org", foo).
+ {error, econnrefused}
Stop a HTTP client profile.
- 10 > inets:stop(httpc, foo).
+ 10 > inets:stop(httpc, foo).
ok
Alternatively:
- 10 > inets:stop(httpc, Pid).
+ 10 > inets:stop(httpc, Pid).
ok
-
diff --git a/lib/inets/doc/src/inets.xml b/lib/inets/doc/src/inets.xml
index 81dfe7e944..c367d7fa77 100644
--- a/lib/inets/doc/src/inets.xml
+++ b/lib/inets/doc/src/inets.xml
@@ -13,12 +13,12 @@
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
-
+
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
-
+
Type definitions that are used more than once in this module:
-Starts the Inets application. Default type @@ -115,11 +115,9 @@
Stops a started service of the inets application or takes
@@ -169,7 +167,7 @@
-
+ + +[httpc] - If a request times out (not during connect), the + handler process exited (normal) but neglected to inform + the manager process. For this reason, the manager + did not clean up the request table, resulting in a + memory leak. Also the manager did not create a monitor + for the handler, so in an unforseen handler crash, this + could also create a memory leak.
+Own Id: OTP-8739
+[tftp] - Was spelled wrong in documentation and in some + parts of the code. It should be tftp.
+Own Id: OTP-8741
+[htpc] - Replaced the old http client api module (http)
+ with the new, http client in the
+
Own Id: OTP-8742
+Ryan Zezeski
+