/*
** Generate a test pages of HTML.
**
** To disable these tests change the WEBPAGE in the comment headers
** to WEB*PAGE and comment out the code.
*/
#include "config.h"
#include "test.h"
/*
** Generate an output page that contains information about the
** current environment.
*/
void test_cgi_vardump(void){
int i;
extern char **environ;
char zPwd[1000];
getcwd(zPwd, sizeof(zPwd));
@
@
Test Page
@
@ Test Page
cgi_print_all();
@ Environment variables:
@
for(i=0; environ[i]; i++){
@ %h(environ[i])
}
@
@ Working directory and user id
@
@ pwd = %s(zPwd)
@ uid = %d(getpid())
@ euid = %d(geteuid())
@ argc = %d(g.argc)
for(i=0; i
}
@
@
}
/*
** WEBPAGE: /test
*/
void test_page(void){
login_check_credentials();
if( !g.okSetup ){ login_needed(); return; }
test_cgi_vardump();
}
/*
** WEBPAGE: /formtest1
*/
void form_test_1(void){
login_check_credentials();
if( !g.okSetup ){ login_needed(); return; }
@
@
@ Parameters:
cgi_print_all();
@ New Form:
@
}
/*
** WEBPAGE: /test2
*/
void test_page_2(void){
cgi_redirect("test");
}
/*
** WEBPAGE: /endlessloop
*/
void endlessloop_page(void){
while(1){sleep(5);}
}
/*
** WEBPAGE: /setcookie
*/
void set_cookie_page(void){
const char *zName = PD("name","C_NAME");
const char *zVal = PD("value","C_VALUE");
login_check_credentials();
if( !g.okSetup ){ login_needed(); return; }
cgi_set_cookie(zName, zVal, 0, 0);
cgi_redirect("");
}