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

Robert Raschke rtrlists@REDACTED
Mon Apr 7 12:44:55 CEST 2008


Hi,

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:

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

start() ->
	case application:get_application(inets) of
		{ok, inets} ->
			ok;
		undefined ->
			ok = inets:start()
	end,
	{ok, Pid} = inets:start(httpd, [
			{port, 8989},
			{server_name,"httpd_test"},
			{server_root,"."},
			{document_root,"."},
			{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}
			]),
	Pid.

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


test1(Env, Input) ->
	io_lib:format("Content-Type:
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"),
	mod_esi:deliver(SessionID,
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,
Robby



More information about the erlang-questions mailing list