.ig >>
<STYLE TYPE="text/css">
<!--
        A:link{text-decoration:none}
        A:visited{text-decoration:none}
        A:active{text-decoration:none}
        OL,UL,P,BODY,TD,TR,TH,FORM { font-family: arial,helvetica,sans-serif;; font-size:small; color: #333333; }

        H1 { font-size: x-large; font-family: arial,helvetica,sans-serif; }
        H2 { font-size: large; font-family: arial,helvetica,sans-serif; }
        H3 { font-size: medium; font-family: arial,helvetica,sans-serif; }
        H4 { font-size: small; font-family: arial,helvetica,sans-serif; }
-->
</STYLE>
<title>quisp: content types and http headers</title>
<body bgcolor=99cc99 vlink=0000FF>
<br>
<br>
<center>
<table cellpadding=2 bgcolor=FFFFFF width=550 ><tr>
<td align=right><a href="quisp_home.html">
<img src="img/quisp2.gif" border=0><br><small>quick server pages</a> &nbsp; &nbsp; </td></tr>
<td>
.>>

.TH Content types and HTTP headers TDH "05-AUG-2004   TDH scg@jax.org" 

.SH Content-type:
Most of the time dynamic web content systems such as QUISP generate HTML.
But it is also possible to generate other content types such as a PNG image, plain text,
or an MS Excel spreadsheet.
In a web environment you usually need to tell the user's browser what type the content is so
that it can respond appropriately.. eg. for an Excel spreadsheet it would launch Excel if possible 
to display the content.  Informing the browser is accomplished using an HTTP header statement 
(in plain text) that looks like this:
.IP
\fCContent-Type: application/vnd.ms-excel\fR
.LP
The portion of the statement following the colon is from a standardized controlled vocabulary of content
types called \fBmime types\fR.
.LP
There are a number of other possible HTTP header statements.  One is \fCSet-Cookie\fR, which is discussed
.ig >>
<a href="cgivar.html#cookie">
.>>
\0here.
.ig >>
</a>
.>>
HTTP headers generally tell the user's browser to do something, or provide it with some sort of information.
HTTP headers must be the first content received by the user's browser when a page (or other content) is loaded.
Each header statement is plain text and is terminated by a newline. 
The HTTP headers section is terminated by a blank line 
(two consecutive newlines)... and failure to provide this results in a 500 "server error" message.
.LP
By default, QUISP will assume you are generating HTML content and create a \fCContent-type: text/html\fR header 
automatically.  You can output one or more \fCSet-Cookie\fR header statements as the first printable content
on your page; QUISP will automatically add the blank line terminating the HTTP header section, and generate an
\fC<html>\fR tag.
.LP
If you wish to generate content other than HTML, you need to do the following:
.IP \(bu
include \fCcontenthtml=0\fR in the URL - this turns off QUISP's automatic behavior
.IP \(bu
output your own \fCContent-Type:\fR header and any other HTTP header statements
.IP \(bu
output the all-important blank line
.IP \(bu
output your content.. for binary content the 
.ig >>
<a href="io.html">
.>>
\0#cat
.ig >>
</a>
.>>
directive may be useful.

.ig >>
<br>
<br>
</td></tr>
<td align=right>
<a href="quisp_home.html">
<img src="img/quisp2.gif" border=0></a><br>
<small>quick server pages &nbsp; &nbsp;<br>
<a href="Copyright.html">Copyright Steve Grubb</a> &nbsp; &nbsp;
</td></tr>
</table>
.>>

