Network Programming

Homework 4
Frequently Asked Questions

Question:  cgi.cs.rpi.edu is down! Can we get an extension?
Answer:  OK, but anything submitted after Monday will get a 25% late penalty.
 
Question:  My delete links currently look something like this:
 
 hw4.cgi?action=delete&count=2&name=Joe

My question is that for my Session ID I am simply passing the user's name to each page, and so I just add this name onto the link for deleting since it wont be getting passed in through the form. I know this is not very secure, since you could just start guessing at what name could equal, but is this acceptable for the project, or will points be deducted for insecurity?

Answer:  Security is not an issue for HW4 (but it's great to hear that you are aware of the issue!). We will not deduct points for guessable URLs
 
Question:  My perl program won't run - all I get is Internal Server Error!
Answer:  A few things to look for:
  • Make sure the first line is #!/usr/local/bin/perl
  • Make sure you can execupt the program by name (from the command line). If you need to type perl hw4.cgi to get it to run - the web server won't be able to run it.
  • Make sure you don't have DOS stuff (CRs) in the file. This can mess up how the shell deals with the file (and whether it can figure out that it is really a perl script). I suggest doing the following to remove all CRs:
    tr -d '\r' < hw4.cgi > foo
    mv foo hw4.cgi
    
 
Question:  Can I use ASP? JSP? Java Servlets?
Answer:  Yes, the TA grading this project (Ling Zhang, zhangl@cs.rpi.edu) has decided to accept ASP and Java submissions. Remember that you must supply a URL to your running system (and there is no ASP capable server in the CS department, nor is there a public servlet server as far as I know).
 
Question:  Can I use PHP?
Answer:  No, Ling doesn't know PHP and will not grade any PHP submissions.
 
Question:  Can we just use hidden fields to create a session, or do we have to use cookies?
Answer:  

This is up to you - either is fine. Personally, I never pass up an opportunity to use the word "cookie" if I can help it... (but you could always confuse the issue and name your hidden field cookie). You could also make sure you include lots of cookie images...

 
Question:  Why doesn't my CGI program run on www.cs.rpi.edu?
Answer:  www.cs.rpi.edu will not run user CGI programs. cgi.cs.rpi.edu will - use that web server (they both look at the same files, your files should be in ~/public.html/). For more info check out the Guide to CGI programming and cgi.cs.rpi.edu
 
Question:  Where do I keep the address list, can I just keep a data structure in my program that holds the address list or do I need to write it to disk (and later read it from disk)?
Answer:  Each time a request is made to your CGI program(s) the program is started and finishes. You can't keep address lists in memory, since they will not be there the next time your program is run. So - you need to store lists to disk and read lists from disk.
 
Question:  How do I write code that will save an address list to disk/ read an address list from disk?
Answer:  It is assumed that you are capable of handling this. We don't care how you do it (flat files are fine), but you should certainly be capable of figuring this out. If not - ask any CS2 student... (neither Dave nor the TAs are CS2 students)