Exemplo n.º 1
0
        /* This method will process a script file and send the results as the
         * body of the response */
        private void _GenerateScriptResult(Socket socket, string path, Dictionary <string, string> requestParameters)
        {
            /* get a script result from the script processor using the request parameter dictionary */
            ScriptResult result = _scriptProcessor.ProcessScript(path, requestParameters);

            /* if the result was an error, send an HTTP Error (500) along with a summary of
             * what went wrong as the body */
            if (result.Error)
            {
                _SendResponse(socket, Encoding.ASCII.GetBytes(result.Result), "text/html; charset=utf8", ResponseType.ERROR);
            }
            else
            {
                /* send a response with the results of the script evaluation */
                _SendResponse(socket, Encoding.ASCII.GetBytes(result.Result), "text/html; charset=utf8", ResponseType.OK);
            }
        }
Exemplo n.º 2
0
        private void _GenerateDynamicResult(IScriptProcessor processor, Socket socket, string path, Dictionary<string, string> requestParameters)
        {
            /* get a script result from the scrupt processor using the request parameter dictionary */
            ScriptResult result = processor.ProcessScript(path, requestParameters);

            /* if the result was an error, send an HTTP Error (500) along wiht a summary of
             * what went wrong as the body */
            if (result.Error)
            {
                _SendResponse(socket, Encoding.ASCII.GetBytes(result.Result), "text/html; charset=utf8", ResponseType.ERROR);
            }
            else
            {
                /* send a response with the results of the script evaluation */
                _SendResponse(socket, Encoding.ASCII.GetBytes(result.Result), "text/html; charset=utf8", ResponseType.OK);
            }
        }