anchor.diff:  	  ([
   	    {"SERVER_SOFTWARE", "Yaws/"++yaws_generated:version()},
   	    {"SERVER_NAME", Hostname},
  -        {"HTTP_HOST", Hostname},
  +	    {"HTTP_HOST", Hostname},
   	    {"GATEWAY_INTERFACE", "CGI/1.1"},
   	    {"SERVER_PROTOCOL", "HTTP/" ++ integer_to_list(Maj) ++ "." ++ integer_to_list(Min)},
   	    {"SERVER_PORT", Hostport},
   	    {"REQUEST_METHOD", yaws:to_list(R#http_request.method)},
   	    {"REQUEST_URI", RequestURI},
   	    {"DOCUMENT_ROOT", 	Arg#arg.docroot},
  -		{"DOCUMENT_ROOT_MOUNT", Arg#arg.docroot_mount},
  +	    {"DOCUMENT_ROOT_MOUNT", Arg#arg.docroot_mount},
   	    {"SCRIPT_FILENAME", Scriptfilename},    % For PHP 4.3.2 and higher
  -						    	% see http://bugs.php.net/bug.php?id=28227
  -						    	% (Sergei Golovan).
  -	    						% {"SCRIPT_TRANSLATED", Scriptfilename},   %IIS6+ 
  +						% see http://bugs.php.net/bug.php?id=28227
  +						% (Sergei Golovan).
  +						% {"SCRIPT_TRANSLATED", Scriptfilename},   %IIS6+ 
   	    {"PATH_INFO",		Pathinfo2},
   	    {"PATH_TRANSLATED",	PathTranslated},  
  -								%<JMN_2007-02> 
  -								% CGI/1.1 spec says PATH_TRANSLATED should be NULL or unset if PATH_INFO is NULL
  -								% This is in contrast to IIS behaviour - and may break some apps.
  -								% broken apps that expect it to always correspond to path of script
  -								% should be modified to use SCRIPT_FILENAME instead - or be wrapped.
  -								%</JMN_2007-02>
  -								%--------------------
  -								% <pre_2007-02_comments>
  -								% This seems not to
  -								% correspond to the
  -								% documentation I have
  -								% read, but it works
  -								% with PHP.
  -								%
  -								% (Not with PHP 4.3.10-16) from
  -								% Debian sarge (Sergei Golovan).
  -								% </pre_2007-02_comments>
  -								%---------------------
  +	    %% <JMN_2007-02> 
  +	    %%  CGI/1.1 spec says PATH_TRANSLATED should be NULL or unset if PATH_INFO is NULL
  +	    %%  This is in contrast to IIS behaviour - and may break some apps.
  +	    %%  broken apps that expect it to always correspond to path of script
  +	    %%  should be modified to use SCRIPT_FILENAME instead - or be wrapped.
  +	    %% </JMN_2007-02>
  +	    %% --------------------
  +	    %%  <pre_2007-02_comments>
  +	    %%  This seems not to
  +	    %%  correspond to the
  +	    %%  documentation I have
  +	    %%  read, but it works
  +	    %%  with PHP.
  +	    %% 
  +	    %%  (Not with PHP 4.3.10-16) from
  +	    %%  Debian sarge (Sergei Golovan).
  +	    %%  </pre_2007-02_comments>
  +	    %% ---------------------
   	    {"SCRIPT_NAME", Scriptname},
  -        {"REMOTE_ADDR", PeerAddr},
  -		{"REMOTE_HOST", PeerAddr},  % We SHOULD send this
  -									% Resolving DNS not practical for performance reasons 
  -									% - at least on 1st contact from a particular host.
  -									% we could do background lookup so that it's available for subsequent invocations,
  -									% but it hardly seems worthwhile. We are permitted by the CGI/1.1 spec to substitute REMOTE_ADDR
  -        {"SERVER_ADDR", LocalAddr},   %Apache compat
  -		{"LOCAL_ADDR", LocalAddr},    %IIS compat
  +	    {"REMOTE_ADDR", PeerAddr},
  +	    {"REMOTE_HOST", PeerAddr},  %%  We SHOULD send this
  +	    %%  Resolving DNS not practical for performance reasons 
  +	    %%  - at least on 1st contact from a particular host.
  +	    %%  we could do background lookup so that it's available for subsequent invocations,
  +	    %%  but it hardly seems worthwhile. We are permitted by the CGI/1.1 spec to substitute REMOTE_ADDR
  +	    {"SERVER_ADDR", LocalAddr},   %% Apache compat
  +	    {"LOCAL_ADDR", LocalAddr},    %% IIS compat
   	    {"QUERY_STRING", checkdef(Arg#arg.querydata)},
   	    {"CONTENT_TYPE", H#headers.content_type},
   	    {"CONTENT_LENGTH", H#headers.content_length},
  
positive.code: 	    ok
      end.
  
      
  do_work(Parent, Arg, Port) ->
      header_loop(Parent, Arg, {start, Port}).
  
  
negative.code: -export([cgi_worker/7]).
  
  
  %%  TO DO:  Handle failure and timeouts.
  
  %%  call_cgi calls the script `Scriptfilename' (full path).
  %%  If `Exefilename' is given, it is the executable to handle this, 
  %%  otherwise `Scriptfilame' is assumed to be executable itself.
  %%  
  %%  Corresponding to a URI of
  %%     `http://somehost/some/dir/script.cgi/path/info', 
  %%  `Pathinfo' should be set to `/path/info'.
  
  %%  These functions can be used from a `.yaws' file.
  %%  Note however, that they usually generate stream content.
  
  call_cgi(Arg, Scriptfilename) ->				     
      call_cgi(Arg, undefined, Scriptfilename, undefined, []).
  