[erlang-questions] Using mod_esi:deliver() ?

Robert Raschke <>
Mon Apr 7 12:44:55 CEST 2008


I'm trying out the httpd of inets using the Erl Scheme Interface in
R12B. But I don't quite understand how the mod_esi:deliver() mechanism
works. I appear to get no response back from the httpd when using it.

My trivial test module is this:

-export([start/0, stop/1, test1/2, test2/3]).

start() ->
	case application:get_application(inets) of
		{ok, inets} ->
		undefined ->
			ok = inets:start()
	{ok, Pid} = inets:start(httpd, [
			{port, 8989},
			{bind_address, "localhost"},
			{modules, [mod_log, mod_esi]},
			{log_format, common},
			{error_log, "error.log"},
			{security_log, "security.log"},
			{transfer_log, "transfer.log"},
			{erl_script_alias, {"/example", [test01]}},
			{erl_script_nocache, true}

stop(Pid) ->
	ok = inets:stop(httpd, Pid).

test1(Env, Input) ->
text/plain\r\n\r\nTEST1\r\n\r\n~p\r\n\r\n~p\r\n", [Env, Input]).

test2(SessionID, Env, Input) ->
	mod_esi:deliver(SessionID, "Content-Type: text/plain\r\n\r\n"),
io_lib:format("TEST2\r\n\r\n~p\r\n\r\n~p\r\n", [Env, Input])).

And http://localhost:8989/example/test01:test1?BlaBla gives me the
anticipated response, but
http://localhost:8989/example/test01:test2?SomethingElse does not
return any response at all. Both GETs are shown in the transfer log,
no errors as far as I can see.

Do I need to deliver some kind of EOF?

Thanks for all pointers,

More information about the erlang-questions mailing list