The University of Texas at Austin- What Starts Here Changes the World
Services Navigation


HTTP Headers

HyperText Transfer Protocol (HTTP) is the method by which Web servers and Web browsers communicate with each other. Web pages are composed of a header and a body. The header contains information about the body so that the Web browser will know how to treat the body of the page.

Using HTTP Headers

When a Web browser requests a simple HTML page, the Web server generates the HTTP header information, and the body is the content of the HTML page requested. When the Web browser requests a CGI script, the CGI programmer must supply the header and body information.

An HTTP header is separated from the body of the page by a blank line. In Perl, two newline characters, \n\n, indicate this line.

The following are some of the HTTP headers most commonly used by CGI programmers:

Content-type: type/subtype

The Content-type header indicates the kind of content included in the body of the page. The type/subtype declaration is also known as a MIME type.

If the body of the Web page is going to be HTML content, use the following header:

Content-type: text/HTML
Location: uri

The Location header indicates the absolute URI of a Web page. A URI stands for Universal Resource Indicator; in most cases this is a URL.

More information

HTTP/1.1 includes the complete specification for HTTP. This is a very technical document, and is more detailed than most CGI programmers usually need.

Local information about MIME types is available within the UT Web Central FAQS.

 

 

 


  Updated 2006 August 14
  Comments to TeamWeb