aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2011-03-18 14:47:29 +0100
committerMicael Karlberg <[email protected]>2011-03-18 14:47:29 +0100
commitf4b5ea566829cad609e14c2264158665b84800c1 (patch)
tree55fe591e7fc447e2bd8d5c636a7c431ee05dd15c
parente343c5b24ca4d642f327e6ec57d63094b28b2838 (diff)
parentb5aae77205c8081b79aa9ce1f1141f21f6e1fc2c (diff)
downloadotp-f4b5ea566829cad609e14c2264158665b84800c1.tar.gz
otp-f4b5ea566829cad609e14c2264158665b84800c1.tar.bz2
otp-f4b5ea566829cad609e14c2264158665b84800c1.zip
Merge branch 'bmk/inets/httpd/make_mod_esi_deliver_accept_binary_data/OTP-9123' into bmk/inets/inet56_integration
Conflicts: lib/inets/doc/src/notes.xml lib/inets/src/inets_app/inets.appup.src
-rw-r--r--lib/inets/doc/src/mod_esi.xml29
-rw-r--r--lib/inets/doc/src/notes.xml8
-rw-r--r--lib/inets/src/http_server/mod_esi.erl4
-rw-r--r--lib/inets/src/inets_app/inets.appup.src8
-rw-r--r--lib/inets/test/httpd_mod.erl5
5 files changed, 38 insertions, 16 deletions
diff --git a/lib/inets/doc/src/mod_esi.xml b/lib/inets/doc/src/mod_esi.xml
index 3c473d3f94..7b1e93e313 100644
--- a/lib/inets/doc/src/mod_esi.xml
+++ b/lib/inets/doc/src/mod_esi.xml
@@ -1,10 +1,10 @@
-<?xml version="1.0" encoding="latin1" ?>
+<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">
<erlref>
<header>
<copyright>
- <year>1997</year><year>2010</year>
+ <year>1997</year><year>2011</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -32,16 +32,19 @@
<modulesummary>Erlang Server Interface </modulesummary>
<description>
<p>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.</p>
+ Which is a more efficient way of writing erlang scripts
+ for your Inets web server than writing them as common CGI scripts.</p>
+
+ <marker id="deliver"></marker>
</description>
+
<funcs>
<func>
<name>deliver(SessionID, Data) -> ok | {error, Reason}</name>
<fsummary>Sends Data back to client.</fsummary>
<type>
<v>SessionID = term()</v>
- <v>Data = string() | io_list()</v>
+ <v>Data = string() | io_list() | binary()</v>
<v>Reason = term()</v>
</type>
<desc>
@@ -51,13 +54,15 @@
parts of the content to the user.</p>
<p>Sends data from a Erl Scheme script back to the client.</p>
- <note><p>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
- 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.</p></note>
+ <note>
+ <p>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.</p>
+ </note>
</desc>
</func>
</funcs>
diff --git a/lib/inets/doc/src/notes.xml b/lib/inets/doc/src/notes.xml
index e08d0180b6..5343d28976 100644
--- a/lib/inets/doc/src/notes.xml
+++ b/lib/inets/doc/src/notes.xml
@@ -52,6 +52,14 @@
<item>
<p>[ftp] Added (type) spec for all exported functions.</p>
<p>Own Id: OTP-9114 Aux Id: seq11799</p>
+
+ <item>
+ <p>[httpd]
+ <seealso marker="mod_esi#deliver">mod_esi:deliver/2</seealso>
+ made to accept binary data. </p>
+ <p>Bernard Duggan</p>
+ <p>Own Id: OTP-9123</p>
+ </item>
</item>
</list>
</section>
diff --git a/lib/inets/src/http_server/mod_esi.erl b/lib/inets/src/http_server/mod_esi.erl
index 929185a67a..b85c479693 100644
--- a/lib/inets/src/http_server/mod_esi.erl
+++ b/lib/inets/src/http_server/mod_esi.erl
@@ -452,6 +452,10 @@ handle_body(Pid, ModData, Body, Timeout, Size, IsDisableChunkedSend) ->
?hdrt("handle_body - send chunk", [{timeout, Timeout}, {size, Size}]),
httpd_response:send_chunk(ModData, Body, IsDisableChunkedSend),
receive
+ {esi_data, Data} when is_binary(Data) ->
+ ?hdrt("handle_body - received binary data (esi)", []),
+ handle_body(Pid, ModData, Data, Timeout, Size + byte_size(Data),
+ IsDisableChunkedSend);
{esi_data, Data} ->
?hdrt("handle_body - received data (esi)", []),
handle_body(Pid, ModData, Data, Timeout, Size + length(Data),
diff --git a/lib/inets/src/inets_app/inets.appup.src b/lib/inets/src/inets_app/inets.appup.src
index 2d12353e00..02b1826c5f 100644
--- a/lib/inets/src/inets_app/inets.appup.src
+++ b/lib/inets/src/inets_app/inets.appup.src
@@ -21,6 +21,7 @@
{"5.5.2",
[
{load_module, ftp, soft_purge, soft_purge, []},
+ {load_module, mod_esi, soft_purge, soft_purge, []},
{load_module, httpc, soft_purge, soft_purge, [httpc_handler]},
{load_module, httpc_request, soft_purge, soft_purge, []},
{update, httpc_handler, soft, soft_purge, soft_purge, [httpc_request]}
@@ -30,10 +31,11 @@
[
{load_module, ftp, soft_purge, soft_purge, []},
{load_module, http_chunk, soft_purge, soft_purge, []},
+ {load_module, mod_esi, soft_purge, soft_purge, []},
{load_module, httpc, soft_purge, soft_purge, [httpc_handler]},
{load_module, httpc_request, soft_purge, soft_purge, []},
{update, httpc_handler, soft, soft_purge, soft_purge,
- [httpc_request,http_chunk]}
+ [httpc_request, http_chunk]}
]
},
{"5.5",
@@ -51,6 +53,7 @@
{"5.5.2",
[
{load_module, ftp, soft_purge, soft_purge, []},
+ {load_module, mod_esi, soft_purge, soft_purge, []},
{load_module, httpc, soft_purge, soft_purge, [httpc_handler]},
{load_module, httpc_request, soft_purge, soft_purge, []},
{update, httpc_handler, soft, soft_purge, soft_purge, [httpc_request]}
@@ -60,10 +63,11 @@
[
{load_module, ftp, soft_purge, soft_purge, []},
{load_module, http_chunk, soft_purge, soft_purge, []},
+ {load_module, mod_esi, soft_purge, soft_purge, []},
{load_module, httpc, soft_purge, soft_purge, [httpc_handler]},
{load_module, httpc_request, soft_purge, soft_purge, []},
{update, httpc_handler, soft, soft_purge, soft_purge,
- [httpc_request,http_chunk]}
+ [httpc_request, http_chunk]}
]
},
{"5.5",
diff --git a/lib/inets/test/httpd_mod.erl b/lib/inets/test/httpd_mod.erl
index f2c1fd6a65..1754cec7bc 100644
--- a/lib/inets/test/httpd_mod.erl
+++ b/lib/inets/test/httpd_mod.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2005-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -19,7 +19,6 @@
%%
-module(httpd_mod).
--author('[email protected]').
-include("test_server.hrl").
-include("test_server_line.hrl").
@@ -815,6 +814,8 @@ esi(Type, Port, Host, Node) ->
[{statuscode, 302},
{version, "HTTP/1.0"}]),
ok.
+
+
%%--------------------------------------------------------------------
get(Type, Port, Host, Node) ->
ok = httpd_test_lib:verify_request(Type, Host, Port, Node,