Module HTML.CGI

Library to support CGI programming in the HTML library. It is only intended as an auxiliary library to implement dynamic web pages according to the HTML library. It contains a simple script that is installed for a dynamic web page and which sends the user input to the real application server implementing the application.

Author: Michael Hanus

Version: November 2018

Summary of exported operations:

readCgiServerMsg :: Handle -> IO (Maybe CgiServerMsg)   
Reads a line from a handle and check whether it is a syntactically correct cgi server message.
submitForm :: [String] -> IO ()   
runCgiServerCmd :: String -> CgiServerMsg -> IO String   
Executes a specific command for a cgi server and returns the command output.
noHandlerPage :: String -> String -> String   
registerCgiServer :: String -> String -> IO ()   
unregisterCgiServer :: String -> IO ()   

Exported datatypes:


CgiServerMsg

The messages to comunicate between the cgi script and the server program. CgiSubmit env cgienv nextpage - pass the environment and show next page, where env are the values of the environment variables of the web script (e.g., QUERYSTRING, REMOTEHOST, REMOTE_ADDR), cgienv are the values in the current form submitted by the client, and nextpage is the answer text to be shown in the next web page

Constructors:

  • CgiSubmit :: [(String,String)] -> [(String,String)] -> CgiServerMsg
  • GetLoad :: CgiServerMsg : get info about the current load of the server process
  • SketchStatus :: CgiServerMsg : get a sketch of the status of the server
  • SketchHandlers :: CgiServerMsg : get a sketch of all event handlers of the server
  • ShowStatus :: CgiServerMsg : show the status of the server with all event handlers
  • CleanServer :: CgiServerMsg : clean up the server (with possible termination)
  • StopCgiServer :: CgiServerMsg : stop the server

Exported operations:

readCgiServerMsg :: Handle -> IO (Maybe CgiServerMsg)   

Reads a line from a handle and check whether it is a syntactically correct cgi server message.

submitForm :: [String] -> IO ()   

runCgiServerCmd :: String -> CgiServerMsg -> IO String   

Executes a specific command for a cgi server and returns the command output.

noHandlerPage :: String -> String -> String   

registerCgiServer :: String -> String -> IO ()   

unregisterCgiServer :: String -> IO ()