CS320 - Computer Networks and Internets

HW16


Written Assignment

  1. Comer, Chapter 36, problem 36.1. Create a file called xxx.cgi with content as shown here. Treat this a cgi file as you did in HW09, Machine Problem 1, with the env.cgi file. Be sure that the file has execute permission. Report your results when you try to execute it.
  2. Comer, Chapter 36, problem 36.3.
  3. Comer, Chapter 36, problem 36.5.

Put your answers to this assignment in a document called hw16.doc.

Machine Problem 1

The Common Gateway Interface (CGI) is a standard protocol for interfacing external application software with an information server, commonly a web server. This allows the server to pass requests from a client web browser to the external application. The web server can then return the output from the application to the web browser.

This problem implements a CGI script that records when computers contact your web site.

The Task

You will implement a CGI program in your UNIX account. It is implemented as a shell script. The file you will use is called example.cgi and is available here. You will also need the file named ipaddrs. This is the program illustrated in Figure 36.3 in Comer. You will download the files to your PC and place them in your UNIX account.

Do the following:

  1. Download the files example.cgi and ipaddrs to your PC. Note in which directory you placed the file.
  2. Use the FTP client to move the example.cgi file and ipaddrs file to your UNIX account. The files should be moved to the public_html folder.

  1. In the FTP client Remote Site window, right click on the example.cgi file name. This will open a dialog box that will allow you to change properties associated with the file. Select chmod (UNIX). This will open a dialog box entitled Remote File Permissions. Click on the Other | Execute check box. Click OK. This will allow the newly downloaded file to be executed.

  1.  In the FTP client Remote Site window, right click on the ipaddrs file name. This will open a dialog box that will allow you to change properties associated with the file. Select chmod (UNIX). This will open a dialog box entitled Remote File Permissions. Click on the Other | Write check box. Click OK. This will allow the newly downloaded file to be written to.

  1. To test the CGI file, in your browser enter http://anvil.emporia.edu/~your_user_id/example.cgi. For Harry's page you would see:

What You'll Turn in For This Problem

What You'll Submit to the Homework Submission System

Use a file compression utility like WinZip (available here or here) and create a file called hw16.zip containing the file hw16.doc. Submit the zipped file to the homework submission system.