--- src/yaws_cgi.erl 2004-09-02 10:31:02.000000000 +0200 +++ src/yaws_cgi.erl 2005-02-09 16:17:31.000000000 +0100 @@ -1,12 +1,13 @@ -module(yaws_cgi). -author('carsten@codimi.de'). +-include_lib("yaws/include/yaws.hrl"). -include_lib("yaws/include/yaws_api.hrl"). -include("yaws_debug.hrl"). -export([call_cgi/4, call_cgi/3, call_cgi/2]). --export([cgi_worker/5]). +-export([cgi_worker/6]). % TO DO: Handle failure and timeouts. @@ -41,7 +42,7 @@ exit(normal) end; _ -> - Worker = start_worker(Arg, Exefilename, Scriptfilename, Pathinfo), + Worker = start_worker(Arg, Exefilename, Scriptfilename, Pathinfo, get(sc)), handle_clidata(Arg, Worker) end. @@ -68,7 +69,7 @@ end. -start_worker(Arg, Exefilename, Scriptfilename, Pathinfo) -> +start_worker(Arg, Exefilename, Scriptfilename, Pathinfo, SC) -> ExeFN = case Exefilename of undefined -> Scriptfilename; "" -> Scriptfilename; @@ -79,7 +80,7 @@ OK -> OK end, Worker = spawn(?MODULE, cgi_worker, - [self(), Arg, ExeFN, Scriptfilename, PI]), + [self(), Arg, ExeFN, Scriptfilename, PI, SC]), Worker. @@ -162,7 +163,7 @@ yaws:fmt_ip(IP). -cgi_env(Arg, Scriptfilename, Pathinfo) -> +cgi_env(Arg, Scriptfilename, Pathinfo, SC) -> H = Arg#arg.headers, R = Arg#arg.req, case R#http_request.path of @@ -175,7 +176,7 @@ Hostport = case Hosttail of [$: | P] -> P; - [] -> "80" + [] -> integer_to_list(SC#sconf.port) end, PeerAddr = get_socket_peername(Arg#arg.clisock), Scriptname = deep_drop_prefix(Arg#arg.docroot, Arg#arg.fullpath), @@ -297,8 +298,8 @@ end. -cgi_worker(Parent, Arg, Exefilename, Scriptfilename, Pathinfo) -> - Env = cgi_env(Arg, Scriptfilename, Pathinfo), +cgi_worker(Parent, Arg, Exefilename, Scriptfilename, Pathinfo, SC) -> + Env = cgi_env(Arg, Scriptfilename, Pathinfo, SC), ?Debug("~p~n", [Env]), CGIPort = open_port({spawn, Exefilename}, [{env, Env},