From 748dbeb1524122229373c5964334a8d8f18a525d Mon Sep 17 00:00:00 2001 From: Christian von Roques Date: Wed, 15 Dec 2010 17:36:09 -0400 Subject: inets/httpc: Polish documentation * Assure store_cookies (and verify_cookies) is documented instead of the nonexistent store_cookie and verify_cookie. * Make sure the cookies option is not called cookie in comments. * Sprinkle ... arround symbols and code snippets in text. * Grammar, wording, and punctuation fixes. * Formalize See gen_tcp:connect/3,4 using . --- lib/inets/doc/src/http_client.xml | 8 ++-- lib/inets/doc/src/httpc.xml | 88 ++++++++++++++++++------------------- lib/inets/src/http_client/httpc.erl | 2 +- 3 files changed, 49 insertions(+), 49 deletions(-) (limited to 'lib/inets') diff --git a/lib/inets/doc/src/http_client.xml b/lib/inets/doc/src/http_client.xml index 672ea3fa98..4542211d71 100644 --- a/lib/inets/doc/src/http_client.xml +++ b/lib/inets/doc/src/http_client.xml @@ -42,10 +42,10 @@ dynamically in runtime. Each client profile will spawn a new process to handle each request unless there is a possibility to use a persistent connection with or without pipelining. - The client will add a host header and an empty - te header if there are no such headers present in the request.

+ The client will add a host header and an empty + te header if there are no such headers present in the request.

-

The clients supports ipv6 as long as the underlying mechanisms also do +

The client supports ipv6 as long as the underlying mechanisms also do so.

@@ -87,7 +87,7 @@ 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}}

+ to the calling process in the form {http, {ReqestId, Result}}

5 > {ok, RequestId} = httpc:request(get, {"http://www.erlang.org", []}, [], [{sync, false}]). diff --git a/lib/inets/doc/src/httpc.xml b/lib/inets/doc/src/httpc.xml index 69e1009bc2..5d1f027e24 100644 --- a/lib/inets/doc/src/httpc.xml +++ b/lib/inets/doc/src/httpc.xml @@ -117,7 +117,7 @@ ssl_options() = {verify, code()} | application or started dynamically in runtime by calling the inets application API inets:start(httpc, ServiceConfig), or inets:start(httpc, ServiceConfig, How) - see inets(3) Below follows a + see inets(3). Below follows a description of the available configuration options.

{profile, profile()} @@ -129,8 +129,8 @@ ssl_options() = {verify, code()} | as session cookies. -

The client can be stopped using inets:stop(httpc, Pid) or - inets:stop(httpc, Profile).

+

The client can be stopped using inets:stop(httpc, Pid) or + inets:stop(httpc, Profile).

@@ -148,7 +148,7 @@ ssl_options() = {verify, code()} | Reason = term() -

Equivalent to httpc:request(get, {Url, []}, [], []).

+

Equivalent to httpc:request(get, {Url, []}, [], []).

@@ -201,7 +201,7 @@ ssl_options() = {verify, code()} |

Sends a HTTP-request. The function can be both synchronous and asynchronous. In the later case the function will return - {ok, RequestId} and later on the information will be delivered + {ok, RequestId} and later on the information will be delivered to the receiver depending on that value.

Http option (http_option()) details:

@@ -267,12 +267,12 @@ ssl_options() = {verify, code()} | HTTP/0.9 client. By default this is an HTTP/1.1 client. When using HTTP/1.0 persistent connections will not be used.

-

Defaults to the trsing "HTTP/1.1".

+

Defaults to the string "HTTP/1.1".

-

If set to true workarounds for known server deviations from +

If set to true workarounds for known server deviations from the HTTP-standard are enabled.

Defaults to false.

@@ -297,20 +297,20 @@ ssl_options() = {verify, code()} |

Streams the body of a 200 or 206 response to the calling process or to a file. When streaming to the calling process using the option self the following stream messages - will be sent to that process: {http, {RequestId, + will be sent to that process: {http, {RequestId, stream_start, Headers}, {http, {RequestId, stream, - BinBodyPart}, {http, {RequestId, stream_end, Headers}. When - streaming to the calling processes using the option + BinBodyPart}, {http, {RequestId, stream_end, Headers}. When + streaming to to the calling processes using the option {self, once} the first message will have an additional - element e.i. {http, {RequestId, stream_start, Headers, Pid}, + element e.i. {http, {RequestId, stream_start, Headers, Pid}, this is the process id that should be used as an argument to - http:stream_next/1 to trigger the next message to be sent to + http:stream_next/1 to trigger the next message to be sent to the calling process.

Note that it is possible that chunked encoding will add - headers so that there are more headers in the stream_end - message than in the stream_start. + headers so that there are more headers in the stream_end + message than in the stream_start. When streaming to a file and the request is asynchronous the - message {http, {RequestId, saved_to_file}} will be sent.

+ message {http, {RequestId, saved_to_file}} will be sent.

Defaults to none.

@@ -358,13 +358,13 @@ ssl_options() = {verify, code()} | request handler.

By default the socket options set by the set_options/1,2 - function are used when establishing the connection.

+ function are used when establishing a connection.

-

Defines how the client will deliver the result for an - asynchronous request (sync has the value +

Defines how the client will deliver the result of an + asynchroneous request (sync has the value false).

@@ -395,7 +395,7 @@ apply(Module, Function, [ReplyInfo | Args])
-

In all cases above, ReplyInfo has the following +

In all of the above cases, ReplyInfo has the following structure:

@@ -470,46 +470,46 @@ apply(Module, Function, [ReplyInfo | Args])
         IpDesc = string()
         ex: "134.138" or "[FEDC:BA98" (all IP-addresses starting with 134.138 or FEDC:BA98), "66.35.250.150" or "[2010:836B:4179::836B:4179]" (a complete IP-address).
         MaxSessions = integer() 
-        Default is 2. 
+        Default is 2.
           Maximum number of persistent connections to a host.
 	MaxKeepAlive = integer() 
-        Default is 5. 
+        Default is 5.
           Maximum number of outstanding requests on the same connection to 
           a host.
         KeepAliveTimeout = integer() 
-        Default is 120000 (= 2 min). 
+        Default is 120000 (= 2 min).
           If a persistent connection is idle longer than the 
-          keep_alive_timeout the client will close the connection. 
-          The server may also have such a timeout but you should
+          keep_alive_timeout the client will close the connection.
+          The server may also have such a time out but you should
           not count on it!
 	MaxPipeline = integer() 
-        Default is 2. 
+        Default is 2.
           Maximum number of outstanding requests on a pipelined connection to a host.
         PipelineTimeout = integer() 
-        Default is 0, 
+        Default is 0,
           which will result in pipelining not being used. 
           If a persistent connection is idle longer than the 
-          pipeline_timeout the client will close the connection. 
+          pipeline_timeout the client will close the connection. 
         CookieMode = enabled | disabled | verify 
-        Default is disabled. 
+        Default is disabled.
           If Cookies are enabled all valid cookies will automatically be 
           saved in the client manager's cookie database. 
-          If the option verify is used the function http:verify_cookie/2 
-          has to be called for the cookie to be saved.
+          If the option verify is used the function store_cookies/2
+          has to be called for the cookies to be saved.
         IpFamily = inet | inet6 | inet6fb4 
-        By default inet. 
+        By default inet.
           When it is set to inet6fb4 you can use both ipv4 and ipv6. 
           It first tries inet6 and if that does not works falls back to inet. 
           The option is here to provide a workaround for buggy ipv6 stacks to ensure that 
           ipv4 will always work.
 	IpAddress = ip_address() 
         If the host has several network interfaces, this option specifies which one to use. 
-          See gen_tcp:connect/3,4 for more info. 
+          See gen_tcp:connect/3,4 for more info. 
 	Port = integer() 
         Specify which local port number to use. 
-          See gen_tcp:connect/3,4 for more info. 
+          See gen_tcp:connect/3,4 for more info. 
         VerboseMode = false | verbose | debug | trace 
-        Default is false. 
+        Default is false.
           This option is used to switch on (or off) 
           different levels of erlang trace on the client. 
           It is a debug feature.
@@ -523,14 +523,14 @@ apply(Module, Function, [ReplyInfo | Args])
             alive and use persistent connections
 	    with  or without pipeline depending on configuration
 	    and current circumstances. The HTTP/1.1 specification does not
-            provide a guideline for how many requests that would be
+            provide a guideline for how many requests would be
             ideal to be sent on a persistent connection,
 	    this very much depends on the
             application. Note that a very long queue of requests may cause a
             user perceived delay as earlier requests may take a long time
             to complete. The HTTP/1.1 specification does suggest a
             limit of 2 persistent connections per server, which is the
-            default value of the max_sessions option. 

+ default value of the max_sessions option.

@@ -549,14 +549,14 @@ apply(Module, Function, [ReplyInfo | Args])

Triggers the next message to be streamed, e.i. same behavior as active once for sockets.

- - + + - store_cookie(SetCookieHeaders, Url) -> - store_cookie(SetCookieHeaders, Url, Profile) -> ok | {error, Reason} + store_cookies(SetCookieHeaders, Url) -> + store_cookies(SetCookieHeaders, Url, Profile) -> ok | {error, Reason} Saves the cookies defined in SetCookieHeaders in the client profile's cookie database. SetCookieHeaders = headers() - where field = "set-cookie" @@ -566,7 +566,7 @@ apply(Module, Function, [ReplyInfo | Args])

Saves the cookies defined in SetCookieHeaders in the client profile's cookie database. You need to - call this function if you set the option cookies to verify. + call this function if you have set the option cookies to verify. If no profile is specified the default profile will be used.

@@ -578,14 +578,14 @@ apply(Module, Function, [ReplyInfo | Args]) cookie_header(Url) -> cookie_header(Url, Profile) -> header() | {error, Rason} Returns the cookie header that would be sent when - making a request to Url using the profile Profile. + making a request to Url using the profile Profile. Url = url() Profile = profile()

Returns the cookie header that would be sent - when making a request to Url using the profile Profile. + when making a request to Url using the profile Profile. If no profile is specified the default profile will be used.

@@ -602,7 +602,7 @@ apply(Module, Function, [ReplyInfo | Args]) Profile = profile()
-

Resets (clears) the cookie database for the specified Profile. +

Resets (clears) the cookie database for the specified Profile. If no profile is specified the default profile will be used.

diff --git a/lib/inets/src/http_client/httpc.erl b/lib/inets/src/http_client/httpc.erl index ae754fab94..04fae13b20 100644 --- a/lib/inets/src/http_client/httpc.erl +++ b/lib/inets/src/http_client/httpc.erl @@ -252,7 +252,7 @@ set_option(Key, Value, Profile) -> %% Description: Store the cookies from %% in the cookie database %% for the profile . This function shall be used when the option -%% cookie is set to verify. +%% cookies is set to verify. %%------------------------------------------------------------------------- store_cookies(SetCookieHeaders, Url) -> store_cookies(SetCookieHeaders, Url, default_profile()). -- cgit v1.2.3