This example is simpler than later ones since the input to randurl is not form information. The input is a get_page message. Also the output is simpler: a Web page is not output by randurl, only a URL string.
If you click here, a randomly chosen CoE student Web page will be loaded.
If you look at the source of this page and, in particular, at the HTML for the last paragraph, you will see the URL:
http://coe.psu.ac.th/cgi-bin/students/randurl
When you click on "here", a get_page request is sent to the fivedots server, to the program randurl in the Web directory cgi-bin/students. This directory is actually:
/var/web/cgi-bin/studentsLook in this directory and you will find randurl.
When the get_page request arrives at the program, it is ignored and instead the program scans a file of URLs (stored in RANDS). A URL is randomly chosen from the file, and sent back to the client as the reply:
Location: URLThe server treats such a message as a request to load the URL.
You should have a look at randurl.c and names.txt (the file of URLs).
The stages outlined above can be viewed as:
Back to the Main Random URL Page