From f31b34c4ebf66fb9226047dd1f3cb6fa81a2a6c9 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 27 Jul 2010 12:00:00 +0200 Subject: inets: Patch 1129 OTP-8739 [httpc] If a request times out (not connect timeout), 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. OTP-8741 The service tftp was spelled wrong in documentation and in some parts of the code. It should be tftp. OTP-8742 [httpc] Replaced the old http client api module (http) with the new, httpc in the users guide. --- lib/inets/doc/src/http_client.xml | 29 +++++++++--------- lib/inets/doc/src/inets.xml | 22 +++++++------- lib/inets/doc/src/notes.xml | 63 +++++++++++++++++++++++++++++++++++++-- 3 files changed, 85 insertions(+), 29 deletions(-) (limited to 'lib/inets/doc/src') diff --git a/lib/inets/doc/src/http_client.xml b/lib/inets/doc/src/http_client.xml index 510c30eb35..ea8053cafa 100644 --- a/lib/inets/doc/src/http_client.xml +++ b/lib/inets/doc/src/http_client.xml @@ -4,7 +4,7 @@
- 20042009 + 20042010 Ericsson AB. All Rights Reserved. @@ -56,8 +56,8 @@
       [{inets, [{services, [{httpc, PropertyList}]}]}]
     
-

For valid properties see http(3)

+

For valid properties see + httpc(3).

@@ -71,67 +71,66 @@ but not for requests to localhost. This will apply to all subsequent requests

- 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. - +
inets @@ -40,13 +40,13 @@ COMMON DATA TYPES

Type definitions that are used more than once in this module:

-

service() = ftpc | tfptd | httpc | httpd

+

service() = ftpc | tftp | httpc | httpd

property() = atom()

services() -> [{Service, Pid}] - Returns a list of currently running services. + Returns a list of currently running services. Service = service() Pid = pid() @@ -97,7 +97,7 @@ start(Type) -> ok | {error, Reason} Starts the Inets application. - Type = permanent | transient | temporary + Type = permanent | transient | temporary

Starts the Inets application. Default type @@ -115,11 +115,9 @@ start(Service, ServiceConfig) -> {ok, Pid} | {error, Reason} - start(Service, ServiceConfig, How) -> {ok, Pid} | - {error, Reason} + start(Service, ServiceConfig, How) -> {ok, Pid} | {error, Reason} Dynamically starts an inets - service after the inets application has been - started. + service after the inets application has been started. Service = service() ServiceConfig = [{Option, Value}] @@ -153,9 +151,9 @@ Stops a started service of the inets application or takes down a "stand_alone-service" gracefully. - Service = service() | stand_alone + Service = service() | stand_alone Reference = pid() | term() - service specified reference - Reason = term() + Reason = term()

Stops a started service of the inets application or takes @@ -169,7 +167,7 @@

SEE ALSO

ftp(3), - http(3), + httpc(3), httpd(3), tftp(3)

diff --git a/lib/inets/doc/src/notes.xml b/lib/inets/doc/src/notes.xml index fed42291ab..9ab35ff38b 100644 --- a/lib/inets/doc/src/notes.xml +++ b/lib/inets/doc/src/notes.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. - + Inets Release Notes @@ -32,6 +32,65 @@ notes.xml
+
Inets 5.3.4 + +
Improvements and New Features +

-

+ + +
+ +
Fixed Bugs and Malfunctions + + + + + +

[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 + Users Guide.

+

Own Id: OTP-8742

+

Ryan Zezeski

+
+ +
+
+ +
+ +
Inets 5.3.3
Improvements and New Features -- cgit v1.2.3