|
contents intro dyno cgi |
Dyno CGI: CGI HeaderThe first thing the CGI must return to the browser is the CGI header. The simplest and most common form is "Content-Type: text/html" followed by two CRLF's. You can accomplish this by calling:
That's it. You just need to call this at the beginning of your CGI. If you need to produce a more complex header, you can build it yourself, or if you just need to specify a different content type (for example, if you are not return HTML data but rather another data type, such as a graphic image) you can just call:
When you call Normally you are not responsible for returning the HTTP result string that looks like this:
because it is done by the web server. However, there is something called "non-parsed headers" (NPH) which is a way of configuring a server and a CGI such that the CGI is required to provide the HTTP result string. If you need to do this, you can call:
where the result is a proper numeric code such as 200 for success, 404 for not found, etc. ExampleHere is a minimal Hello World program that uses Dyno CGI to deal with the CGI headers, as well as two Dyno CGI functions that print out the HTML syntax that is required to wrap your body content. (In addition to your body content, the output should include the <HTML>, <HEAD>, <TITLE>, and <BODY> tags. This is handled by
|