[cs631apue] final project questions

Jan Schaumann jschauma at stevens.edu
Sat Nov 19 22:22:31 EST 2011

afonsec1 <afonsec1 at stevens.edu> wrote:

> 1. Since we are using http/1.0, For line-requests, do we have to add the 
> string 'HTTP/1.0'? What happen if omitted?

A proper HTTP/1.0 request is defined in RFC1945.  Section 3 elaborates
on the protocol parameters.  In short, the protocol version is required.
(Even though your version is not required to be able to understand
earlier versions and respond in kind, you should be able to parse the
request using the given required syntax.)

> 2. I cannot find http 1.0 servers to test, so I noticed that http/1.1  
> servers do accept conditional HEAD.
> Based on the http 1.0 documentation, there is no conditional HTTP/1.0  
> HEAD it just simple ignored, is that correct?

Section 8.2 of the RFC covers this.

> 3. Directory indexing should list files one line by line?

How you handle directory indexing is really up to you.  As usual, think
about what is most useful to the user.

> 4. Recognizing a cgi script is done by calling any file from the  
> directory given by option -c, or the .cgi extension?

The manual page states:

| Instead of returning the contents of each file under the directory
| specified via the -c flag, they are executed and any output
| generated is returned instead.

That is, the filename extension is irrelevant.

> 5. parsing cgi arguments is done thru enviroment variables or command  
> arguments?

The CGI definition as well as the wikipedia entry at
https://en.wikipedia.org/wiki/Common_Gateway_Interface cover this.

> 7. The output from cgi should be formatted with html tags?

Read the definition of what CGI programs are and what they do again.  Is
there any mention of or requirement that the output generated by the
program needs to be HTML?  Is there any requirement that *any* content
retrieved via HTTP needs to be HTML?

> 6. Can you provide cgi scripts example that should run on sws with  
> inputs and expected output?

You can find plenty of example by searching the internet.  But that is
entirely irrelevant -- your server has the requirement to execute the
requested program.  Your program does not need to concern itself with
what the output of the program might be (other than as far as argument
passing is concerned).  That is, after all, the whole point of executing
the program rather than generating output yourself (as would be the case
for things like server-side scripting).


More information about the cs631apue mailing list