# File lib_doc/rucy/cgi.rb, line 97
    def publish(script_name, request, response, logger)
      logger.debug("[#{Time.now.httpdate}] enter document: #{self.class}")
      cgi_script_name, cgi_local_path = scan_cgi(script_name, request.path)
      cgi_args = parse_args(request.query)
      cgi_env = { 'PATH' => ENV['PATH'] }
      cgi_env.update(@env)
      cgi_env.update(request.cgi_env(cgi_script_name, @pass_auth))
      cgi_env['SCRIPT_FILENAME'] = cgi_local_path
      response.doc_path = cgi_script_name
      response.local_path = cgi_local_path
      cgi_open(cgi_local_path, cgi_args, cgi_env) { |cgi_io|
        # request message body
        if (request.has_body?) then
          request.each_body do |req_messg_body|
            cgi_io.write(req_messg_body)
          end
        end
        cgi_io.flush
        cgi_io.close_write

        # response message head
        response.parse_line(cgi_io) if @nph
        response.parse_header(cgi_io)
        unless (@nph) then
          response.parse_status
          response.absolute_location(request)
        end

        # response message body
        response.start_body
        while (res_messg_body = cgi_io.read(1024*16))
          response.write(res_messg_body)
        end
      }
      nil
    end