From f9ec3cbca0f05fd9640bbd5cd3e21942c4512d3d Mon Sep 17 00:00:00 2001
From: Filipe David Manana
Date: Sun, 26 Sep 2010 11:58:45 +0100
Subject: httpc: allow streaming of PUT and POST request bodies
This is a must when uploading large bodies that are to large to store
in a string or binary.
Besides a string or binary, a body can now be a function and
an accumulator.
Example:
-module(httpc_post_stream_test).
-compile(export_all).
-define(LEN, 1024 * 1024).
prepare_data() ->
{ok, Fd} = file:open("test_data.dat", [binary, write]),
ok = file:write(Fd, lists:duplicate(?LEN, "1")),
ok = file:close(Fd).
test() ->
inets:start(),
ok = prepare_data(),
{ok, Fd1} = file:open("test_data.dat", [binary, read]),
BodyFun = fun(Fd) ->
case file:read(Fd, 512) of
eof ->
eof;
{ok, Data} ->
{ok, Data, Fd}
end
end,
{ok, {{_,200,_}, _, _}} = httpc:request(post, {"http://localhost:8888",
[{"content-length", integer_to_list(?LEN)}], "text/plain", {BodyFun, Fd1}}, [], []),
ok = file:close(Fd1).
---
lib/inets/doc/src/httpc.xml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'lib/inets/doc')
diff --git a/lib/inets/doc/src/httpc.xml b/lib/inets/doc/src/httpc.xml
index 9c8df28fec..df333074cd 100644
--- a/lib/inets/doc/src/httpc.xml
+++ b/lib/inets/doc/src/httpc.xml
@@ -89,7 +89,9 @@ headers() = [header()]
header() = {field(), value()}
field() = string()
value() = string()
-body() = string() | binary()
+body() = string() | binary() | {fun(acc()) -> send_fun_result(), acc()}
+send_fun_result() = eof | {ok, iolist(), acc()}
+acc() = term()
filename() = string()
]]>
--
cgit v1.2.3
From 6951ed1075b8c36d5b6f51e5e5df7bd14602c1d8 Mon Sep 17 00:00:00 2001
From: Filipe David Manana
Date: Tue, 5 Oct 2010 00:26:33 +0100
Subject: httpc: add option to do automatic chunked transfer-encoding
This is specially useful when a client doesn't know in advance the
length of the payload (so that it can't set the
Content-Length header).
Example:
-module(httpc_post_stream_test).
-compile(export_all).
prepare_data() ->
crypto:start(),
{ok, Fd} = file:open("test_data.dat", [binary, write]),
ok = file:write(Fd, lists:duplicate(crypto:rand_uniform(8182, 32768), "1")),
ok = file:close(Fd).
test() ->
inets:start(),
ok = prepare_data(),
{ok, Fd1} = file:open("test_data.dat", [binary, read]),
BodyFun = fun(Fd) ->
case file:read(Fd, 512) of
eof ->
eof;
{ok, Data} ->
{ok, Data, Fd}
end
end,
%% header 'Transfer-Encoding: chunked' is added by httpc
{ok, {{_,200,_}, _, _}} = httpc:request(post, {"http://localhost:8888",
[], "text/plain", {chunkify, BodyFun, Fd1}}, [], []),
ok = file:close(Fd1).
---
lib/inets/doc/src/httpc.xml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'lib/inets/doc')
diff --git a/lib/inets/doc/src/httpc.xml b/lib/inets/doc/src/httpc.xml
index df333074cd..8b04b4c7f3 100644
--- a/lib/inets/doc/src/httpc.xml
+++ b/lib/inets/doc/src/httpc.xml
@@ -89,7 +89,9 @@ headers() = [header()]
header() = {field(), value()}
field() = string()
value() = string()
-body() = string() | binary() | {fun(acc()) -> send_fun_result(), acc()}
+body() = string() | binary() |
+ {fun(acc()) -> send_fun_result(), acc()} |
+ {chunkify, fun(acc()) -> send_fun_result(), acc()}
send_fun_result() = eof | {ok, iolist(), acc()}
acc() = term()
filename() = string()
--
cgit v1.2.3
From 73f261d2f44a58fda92e3d6e035051c11c3e4521 Mon Sep 17 00:00:00 2001
From: Bernard Duggan
Date: Wed, 23 Feb 2011 15:55:37 +1100
Subject: Modify mod_esi:deliver/2 to accept binary data
This change allows for more efficient delivery of large amounts of
data through the mod_esi interface when the handling process has that
data in binary format. It avoids the need to convert to list and the
extra memory involved in passing that list between processes.
---
lib/inets/doc/src/mod_esi.xml | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
(limited to 'lib/inets/doc')
diff --git a/lib/inets/doc/src/mod_esi.xml b/lib/inets/doc/src/mod_esi.xml
index 3c473d3f94..e063088eb4 100644
--- a/lib/inets/doc/src/mod_esi.xml
+++ b/lib/inets/doc/src/mod_esi.xml
@@ -41,7 +41,7 @@
Sends Data back to client.
SessionID = term()
- Data = string() | io_list()
+ Data = string() | io_list() | binary()
Reason = term()
@@ -54,7 +54,9 @@
Note
that if any HTTP-header fields should be added by the
script they must be in the first call to deliver/2 and the
- data in the call must be a string. Do not
+ data in the call must be a string. Calls after the headers
+ are complete may contain binary data to reduce copying
+ overhead. Do not
assume anything about the data type of SessionID, the
SessionID must be the value given as input to the esi
call back function that you implemented.
--
cgit v1.2.3
From db29f9ede14ff5b8d747230fcad8ffa1b157f1e1 Mon Sep 17 00:00:00 2001
From: Micael Karlberg
Date: Mon, 7 Mar 2011 14:52:30 +0100
Subject: Adding missing "send loop" for raw sending. Also fixed some of the
documentation (types).
---
lib/inets/doc/src/httpc.xml | 52 +++++++++++++++------------
lib/inets/doc/src/notes.xml | 85 +++++++++++++++++++++++++++++++--------------
2 files changed, 87 insertions(+), 50 deletions(-)
(limited to 'lib/inets/doc')
diff --git a/lib/inets/doc/src/httpc.xml b/lib/inets/doc/src/httpc.xml
index 6dcf2d6d17..12f4fa535e 100644
--- a/lib/inets/doc/src/httpc.xml
+++ b/lib/inets/doc/src/httpc.xml
@@ -76,25 +76,29 @@ socket_opt() = See the Options used by gen_tcp(3) and
For more information about HTTP see rfc 2616
send_fun_result(), acc()} |
- {chunkify, fun(acc()) -> send_fun_result(), acc()}
-send_fun_result() = eof | {ok, iolist(), acc()}
-acc() = term()
-filename() = string()
+method() = head | get | put | post | trace | options | delete
+request() = {url(), headers()} |
+ {url(), headers(), content_type(), body()}
+url() = string() - Syntax according to the URI definition in rfc 2396, ex: "http://www.erlang.org"
+status_line() = {http_version(), status_code(), reason_phrase()}
+http_version() = string() ex: "HTTP/1.1"
+status_code() = integer()
+reason_phrase() = string()
+content_type() = string()
+headers() = [header()]
+header() = {field(), value()}
+field() = string()
+value() = string()
+body() = string() |
+ binary() |
+ {fun(accumulator()) -> body_processing_result(),
+ accumulator()} |
+ {chunkify,
+ fun(accumulator()) -> body_processing_result(),
+ accumulator()}
+body_processing_result() = eof | {ok, iolist(), accumulator()}
+accumulator() = term()
+filename() = string()
]]>
@@ -146,8 +150,9 @@ ssl_options() = {verify, code()} |
Sends a get HTTP-request
Url = url()
- Result = {status_line(), headers(), body()} |
- {status_code(), body()} | request_id()
+ Result = {status_line(), headers(), Body} |
+ {status_code(), Body} | request_id()
+ Body = string() | binary()
Profile = profile()
Reason = term()
@@ -195,8 +200,9 @@ ssl_options() = {verify, code()} |
Function = atom()
Args = list()
body_format() = string | binary
- Result = {status_line(), headers(), body()} |
- {status_code(), body()} | request_id()
+ Result = {status_line(), headers(), Body} |
+ {status_code(), Body} | request_id()
+ Body = string() | binary()
Profile = profile()
Reason = {connect_failed, term()} |
{send_failed, term()} | term()
diff --git a/lib/inets/doc/src/notes.xml b/lib/inets/doc/src/notes.xml
index 11b0af4310..8c0d683a90 100644
--- a/lib/inets/doc/src/notes.xml
+++ b/lib/inets/doc/src/notes.xml
@@ -1,4 +1,4 @@
-
+
@@ -32,50 +32,80 @@
notes.xml
- Inets 5.5.1
+ Inets 5.6
- Fixed Bugs and Malfunctions
+ Improvements and New Features
+
-
-
Fix format_man_pages so it handles all man sections
- and remove warnings/errors in various man pages.
-
- Own Id: OTP-8600
+ [httpc] Add support for upload body streaming (PUT and POST).
+ For more info,
+ see the definition of the Body argument of the
+ request/4,5
+ function.
+ Filipe David Manana
+ Own Id: OTP-9094
+
+
+
+ Fixed Bugs and Malfunctions
+ -
+
+
+
+
+
+ Inets 5.5.1
+
Improvements and New Features
-
-
- Miscellaneous inet6 related problems.
-
- Own Id: OTP-8927
+ Miscellaneous inet6 related problems.
+ Own Id: OTP-8927
-
-
- Updated http-server to make sure URLs in error-messages
- are URL-encoded. Added support in http-client to use
- URL-encoding. Also added the missing include directory
- for the inets application.
-
- Own Id: OTP-8940 Aux Id: seq11735
+ Updated http-server to make sure URLs in error-messages
+ are URL-encoded. Added support in http-client to use
+ URL-encoding. Also added the missing include directory
+ for the inets application.
+ Own Id: OTP-8940, Aux Id: seq11735
-
+ Fixed Bugs and Malfunctions
+
+ -
+
Fix format_man_pages so it handles all man sections
+ and remove warnings/errors in various man pages.
+ Own Id: OTP-8600
+
+ -
+
[httpc] Pipelined and queued requests not processed when
+ connection closed remotelly.
+ Own Id: OTP-8906
+
+
+
+
+
+
-Inets 5.5
+ Inets 5.5
Fixed Bugs and Malfunctions
@@ -120,9 +150,10 @@
-
+
+
-Inets 5.4
+ Inets 5.4
Improvements and New Features
+
+
+ -
+
[ftp] Added (type) spec for all exported functions.
+ Own Id: OTP-9114 Aux Id: seq11799
+
+
+
+
+
+ Fixed Bugs and Malfunctions
+ -
+
+
+
+
+
+
+
Inets 5.5.2
Improvements and New Features
--
cgit v1.2.3
From 52b0134e8f7b871051af9be6cb7354553a0f72cd Mon Sep 17 00:00:00 2001
From: Micael Karlberg
Date: Thu, 10 Mar 2011 11:20:16 +0100
Subject: Added proper release notes, appup and version.
---
lib/inets/doc/src/mod_esi.xml | 29 ++++++++++++++++-------------
lib/inets/doc/src/notes.xml | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+), 13 deletions(-)
(limited to 'lib/inets/doc')
diff --git a/lib/inets/doc/src/mod_esi.xml b/lib/inets/doc/src/mod_esi.xml
index e063088eb4..7b1e93e313 100644
--- a/lib/inets/doc/src/mod_esi.xml
+++ b/lib/inets/doc/src/mod_esi.xml
@@ -1,10 +1,10 @@
-
+
- 19972010
+ 19972011
Ericsson AB. All Rights Reserved.
@@ -32,9 +32,12 @@
Erlang Server Interface
This module defines the API - Erlang Server Interface (ESI).
- Which is a more efficient way of writing erlang scripts
- for your Inets web server than writing them as common CGI scripts.
+ Which is a more efficient way of writing erlang scripts
+ for your Inets web server than writing them as common CGI scripts.
+
+
+
deliver(SessionID, Data) -> ok | {error, Reason}
@@ -51,15 +54,15 @@
parts of the content to the user.
Sends data from a Erl Scheme script back to the client.
- Note
- that if any HTTP-header fields should be added by the
- script they must be in the first call to deliver/2 and the
- data in the call must be a string. Calls after the headers
- are complete may contain binary data to reduce copying
- overhead. Do not
- assume anything about the data type of SessionID, the
- SessionID must be the value given as input to the esi
- call back function that you implemented.
+
+ Note that if any HTTP-header fields should be added by the
+ script they must be in the first call to deliver/2 and the
+ data in the call must be a string. Calls after the headers
+ are complete may contain binary data to reduce copying
+ overhead. Do not assume anything about the data type of
+ SessionID, the SessionID must be the value given as input to
+ the esi call back function that you implemented.
+
diff --git a/lib/inets/doc/src/notes.xml b/lib/inets/doc/src/notes.xml
index 5da9d98002..8e1acba9b8 100644
--- a/lib/inets/doc/src/notes.xml
+++ b/lib/inets/doc/src/notes.xml
@@ -32,6 +32,45 @@
notes.xml
+ Inets 5.6
+
+ Improvements and New Features
+
+
+
+ -
+
[httpd]
+ mod_esi:deliver/2
+ made to accept binary data.
+ Own Id: OTP-9123
+
+
+
+
+
+ Fixed Bugs and Malfunctions
+ -
+
+
+
+
+
+
Inets 5.5.2
Improvements and New Features
--
cgit v1.2.3
From 0422eb9016dd7bea2dff4004895ed45815ef0f48 Mon Sep 17 00:00:00 2001
From: Micael Karlberg
Date: Thu, 10 Mar 2011 16:15:35 +0100
Subject: Added proper release notes, appup and version.
---
lib/inets/doc/src/notes.xml | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
(limited to 'lib/inets/doc')
diff --git a/lib/inets/doc/src/notes.xml b/lib/inets/doc/src/notes.xml
index 5da9d98002..5dbe761988 100644
--- a/lib/inets/doc/src/notes.xml
+++ b/lib/inets/doc/src/notes.xml
@@ -32,6 +32,47 @@
notes.xml
+ Inets 5.6
+
+ Improvements and New Features
+
+
+
+ -
+
[httpd] Prevent XSS in error pages.
+ Prevent user controlled input from being interpreted
+ as HTML in error pages by encoding the reserved HTML
+ characters.
+ Michael Santos
+ Own Id: OTP-9124
+
+
+
+
+
+ Fixed Bugs and Malfunctions
+ -
+
+
+
+
+
+
Inets 5.5.2
Improvements and New Features
--
cgit v1.2.3
From a5d14f14e04ca7ca5fd34a7811cefbccdd024ce4 Mon Sep 17 00:00:00 2001
From: Micael Karlberg
Date: Thu, 10 Mar 2011 16:19:20 +0100
Subject: Add original auther (Bernard Duggan) in release notes.
---
lib/inets/doc/src/notes.xml | 1 +
1 file changed, 1 insertion(+)
(limited to 'lib/inets/doc')
diff --git a/lib/inets/doc/src/notes.xml b/lib/inets/doc/src/notes.xml
index 8e1acba9b8..50dbb7d3da 100644
--- a/lib/inets/doc/src/notes.xml
+++ b/lib/inets/doc/src/notes.xml
@@ -44,6 +44,7 @@
[httpd]
mod_esi:deliver/2
made to accept binary data.
+ Bernard Duggan
Own Id: OTP-9123
--
cgit v1.2.3
From 61c6577254568abd92c2d8d00c948cf230e602ca Mon Sep 17 00:00:00 2001
From: Micael Karlberg
Date: Mon, 14 Mar 2011 12:17:12 +0100
Subject: Used the wrong security property names in documentation.
---
lib/inets/doc/src/httpd.xml | 12 ++++++------
lib/inets/doc/src/mod_security.xml | 4 ++--
lib/inets/doc/src/notes.xml | 37 +++++++++++++++++++++++++++++++++++++
3 files changed, 45 insertions(+), 8 deletions(-)
(limited to 'lib/inets/doc')
diff --git a/lib/inets/doc/src/httpd.xml b/lib/inets/doc/src/httpd.xml
index 62f4e18f82..91a55f6920 100644
--- a/lib/inets/doc/src/httpd.xml
+++ b/lib/inets/doc/src/httpd.xml
@@ -4,7 +4,7 @@
@@ -162,7 +176,8 @@
are URL-encoded. Added support in http-client to use
URL-encoding. Also added the missing include directory
for the inets application.
- Own Id: OTP-8940 Aux Id: seq11735
+ Own Id: OTP-8940
+ Aux Id: seq11735
--
cgit v1.2.3
From 5488c7843c8930d14d1d0d2ec0aa23d0d491afbc Mon Sep 17 00:00:00 2001
From: Micael Karlberg
Date: Tue, 19 Apr 2011 13:37:06 +0200
Subject: Default ssl kind changed to essl (from ossl).
---
lib/inets/doc/src/httpc.xml | 21 ++++++---------------
lib/inets/doc/src/httpd.xml | 2 +-
lib/inets/doc/src/notes.xml | 13 +++++++++++++
3 files changed, 20 insertions(+), 16 deletions(-)
(limited to 'lib/inets/doc')
diff --git a/lib/inets/doc/src/httpc.xml b/lib/inets/doc/src/httpc.xml
index 532f5eefde..f6b6827e93 100644
--- a/lib/inets/doc/src/httpc.xml
+++ b/lib/inets/doc/src/httpc.xml
@@ -105,17 +105,8 @@ filename() = string()
SSL DATA TYPES
- Some type definitions relevant when using https,
- for details ssl(3):
-
+ See ssl(3) for information
+ about ssl options (ssloptions()).
@@ -175,9 +166,9 @@ ssl_options() = {verify, code()} |
http_options() = [http_option()]
http_option() = {timeout, timeout()} |
{connect_timeout, timeout()} |
- {ssl, ssl_options()} |
- {ossl, ssl_options()} |
- {essl, ssl_options()} |
+ {ssl, ssloptions()} |
+ {ossl, ssloptions()} |
+ {essl, ssloptions()} |
{autoredirect, boolean()} |
{proxy_auth, {userstring(), passwordstring()}} |
{version, http_version()} |
@@ -236,7 +227,7 @@ ssl_options() = {verify, code()} |
-
This is the default ssl config option, currently defaults to
- ossl, see below.
+ essl, see below.
Defaults to [].
diff --git a/lib/inets/doc/src/httpd.xml b/lib/inets/doc/src/httpd.xml
index ac49a37296..edacb73b65 100644
--- a/lib/inets/doc/src/httpd.xml
+++ b/lib/inets/doc/src/httpd.xml
@@ -154,7 +154,7 @@
ossl specifically uses the OpenSSL based (old) SSL.
essl specifically uses the Erlang based (new) SSL.
When using ssl it currently defaults to
- ossl.
+ essl.
Defaults to ip_comm.
diff --git a/lib/inets/doc/src/notes.xml b/lib/inets/doc/src/notes.xml
index df3bf19066..b885bcbcdb 100644
--- a/lib/inets/doc/src/notes.xml
+++ b/lib/inets/doc/src/notes.xml
@@ -91,6 +91,19 @@
Aux Id: seq11819
+ -
+
The default ssl kind has now been changed to essl.
+ ossl will work for as long as the ssl application
+ supports it.
+ See the httpd
+ socket_type
+ communication property or the httpc
+ request/4,5 function
+ for more info.
+ Own Id: OTP-9230
+ *** POTENTIAL INCOMPATIBILITY ***
+
+
--
cgit v1.2.3
From 416668b76a84d39855b8d78b84838b8a80f40db9 Mon Sep 17 00:00:00 2001
From: Micael Karlberg
Date: Wed, 11 May 2011 16:55:21 +0200
Subject: Also updated release notes.
---
lib/inets/doc/src/notes.xml | 12 ++++++++++++
1 file changed, 12 insertions(+)
(limited to 'lib/inets/doc')
diff --git a/lib/inets/doc/src/notes.xml b/lib/inets/doc/src/notes.xml
index b885bcbcdb..edb994a91b 100644
--- a/lib/inets/doc/src/notes.xml
+++ b/lib/inets/doc/src/notes.xml
@@ -104,6 +104,18 @@
*** POTENTIAL INCOMPATIBILITY ***
+ -
+
[httpc] httpc manager crashes.
+ When a request results in a retry, the request id will be "reused"
+ in the previous implementation a race condition could occur causing
+ the manager to crash.
+ This is now avoided by using proc_lib:init_ack and
+ gen_server:enter_loop to allow mor advanced initialization of
+ httpc_handlers without blocking the httpc_manger and eliminating
+ extra processes that can cause race conditions.
+ Own Id: OTP-9246
+
+
--
cgit v1.2.3
From d3d5b4fcf3e07c22e61c2c9a410d365178b12945 Mon Sep 17 00:00:00 2001
From: Micael Karlberg
Date: Thu, 12 May 2011 14:06:12 +0200
Subject: Calling gen_tcp:connect with option {ip, {127,0,0,1}} results in an
exit with reason badarg. Neither SSL nor INETS catches this, resulting in
crashes with incomprehensible reasons.
OTP-9289
---
lib/inets/doc/src/notes.xml | 37 +++++++++++++++++++++++++------------
1 file changed, 25 insertions(+), 12 deletions(-)
(limited to 'lib/inets/doc')
diff --git a/lib/inets/doc/src/notes.xml b/lib/inets/doc/src/notes.xml
index edb994a91b..0926df8581 100644
--- a/lib/inets/doc/src/notes.xml
+++ b/lib/inets/doc/src/notes.xml
@@ -104,18 +104,6 @@
*** POTENTIAL INCOMPATIBILITY ***
- -
-
[httpc] httpc manager crashes.
- When a request results in a retry, the request id will be "reused"
- in the previous implementation a race condition could occur causing
- the manager to crash.
- This is now avoided by using proc_lib:init_ack and
- gen_server:enter_loop to allow mor advanced initialization of
- httpc_handlers without blocking the httpc_manger and eliminating
- extra processes that can cause race conditions.
- Own Id: OTP-9246
-
-
@@ -147,6 +135,31 @@
Bernard Duggan
Own Id: OTP-9158
+
+ -
+
[httpc] httpc manager crashes.
+ When a request results in a retry, the request id will be "reused"
+ in the previous implementation a race condition could occur causing
+ the manager to crash.
+ This is now avoided by using proc_lib:init_ack and
+ gen_server:enter_loop to allow mor advanced initialization of
+ httpc_handlers without blocking the httpc_manger and eliminating
+ extra processes that can cause race conditions.
+ Own Id: OTP-9246
+
+
+ -
+
[httpc] Issuing a request (httpc:request) to an
+ host with the ssl option
+ {ip, {127,0,0,1}} results in an handler crash.
+ The reason was that the connect call resulted in an exit with
+ reason badarg
+ (this was the same for both ssl and gen_tcp).
+ Exits was not catched. This has now been improved.
+ Own Id: OTP-9289
+ Aux Id: seq11845
+
+
--
cgit v1.2.3