CGIParse

CGIParse project is a C class library for parsing the input of a cgi program.
Download

CGIParse Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Price:
  • FREE
  • Publisher Name:
  • Rasmus Toftdahl Olesen
  • Publisher web site:
  • http://halfdans.net/wiki.py/pythondr

CGIParse Tags


CGIParse Description

CGIParse project is a C class library for parsing the input of a cgi program. CGIParse project is a C class library for parsing the input of a cgi program.StartingTo start using CGIParse you first have to include the cgiparse.h header: #include < cgiparse.h > Thereafter you have to define the CGIParse object: CGIParse cgi; The CGIParse object then automatically reads the headers and the variables parsed to the program using environment variables and (if using POST or PUT) standard input. Now the library has been initialized and we are ready to use it. HeaderThe headers parsed to CGIParse is easily available to the programmer after the library has been initialized. To retrieve them CGIParse provides functions named after the environment variable it retrieves. Fx. to retrieve the SERVER_SOFTWARE environment variable, you use the function server_software(). The functions providing these environment variables are: char* server_software(void); char* server_name(void); char* gateway_interface(void); char* server_protocol(void); int server_port(void); int request_method(void); char* request_methodc(void); char* path_info(void); char* path_translated(void); char* script_name(void); char* query_string(void); char* remote_host(void); char* remote_addr(void); char* auth_type(void); char* remote_user(void); char* remote_ident(void); char* content_type(void); int content_length(void); char* http_accept(void); char* http_user_agent(void); char* http_referer(void); char* input(void);It is important to note that if the environment variable you are trying to access doesn't exist, the function will return NULL if you were trying to retrieve a char* and -1 if it's a int. VariablesThe variables from the browser can of course also be accessed by CGIParse.To retrieve the number of variables, you can use the int num() function, and to retrieve the variable names and parameters number i, you user the functions: char* name ( int i ); char* parm ( int i ); You can also use the function char* parm ( const char *n ); to retrieve the parameter of the variable with name n. DebuggingWhen debugging your CGI application it can sometimes be useful to see what is transfered to the CGI application. You could of course program this yourself, but for your ease some functions for it has been provided the function htable() draws a html table with the header retrieved from CGI. CGIParse also provide you with a function called ptable() which prints the variables sent to the CGI application.


CGIParse Related Software