BILKENT UNIVERSITY
CS533 Information Retrieval Systems
Technical Presentation Web Site
Barýþ UZ
 
Index of
this page
Introduction
Push Technologies
Channels
CGI
ASP
Java
Streaming Media
 
Overview
Specifications
Getting information from the server
Sending information back to the user
Forms and other usages of CGI programs
Form and other examples and Links
 
The most common error that beginners do is about the output formatting. The output should be properly formatted so that the server can understand it. 

A CGI program can return almost any kind of documents. However, the client must know what kind of document you are sending so that it can present it accordingly. 

To tell the server about the type of the document you are sending back, whether it be a full document or a reference to one, CGI requires you to place a short header on your output. This is a header composed of ASCII text, consisting of lines sepearated by either LF and/or CR followed by a single blank line. 
 

    A full document with a corresponding MIME type 

    Content-type:   text/html 

    .............HTML file contents............. 
     

    A reference to another document 

    Instead of outputting the document, you can just tell the browser where to get the new one, or have the server automatically output the new one for you. 

    Content-type:   text/html 
    Location:  gopher://gopher.cs.bilkent.edu.tr/0 

    .............HTML file contents............. 

    Nowadays, we don't need to explicitly tell the user to go another location; instead, the browser performs the same job for us. 

    If another file is wanted to be referenced which is obviously not protected by authentication rules and accessible, you should just output a partial (virtual) URL, such as the following: 

    Location:   /dir1/dir2/html1.html 
     
     

    The server thinks that you requested: 

    http://yourserver/dir1/dir2/html1.html

 
PREVIOUS TOPIC
UP
(First page of this topic)
NEXT TOPIC
PREVIOUS PAGE 
(of this topic)
NEXT PAGE 
(of this topic)