quick server pages
   
Manual page for Content(types)

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:

Content-Type: application/vnd.ms-excel

The portion of the statement following the colon is from a standardized controlled vocabulary of content types called mime types.

There are a number of other possible HTTP header statements. One is Set-Cookie, which is discussed here. 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.

By default, QUISP will assume you are generating HTML content and create a Content-type: text/html header automatically. You can output one or more Set-Cookie 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 <html> tag.

If you wish to generate content other than HTML, you need to do the following:

  • include contenthtml=0 in the URL - this turns off QUISP's automatic behavior
  • output your own Content-Type: header and any other HTTP header statements
  • output the all-important blank line
  • output your content.. for binary content the #cat directive may be useful.


quick server pages    
Copyright Steve Grubb    


Markup created by unroff 1.0,    August 05, 2004.