cgistarthdrs(), cgiendhdrs() - start/end HTTP headers

SYNOPSIS

#include "cgi.h"

int  cgistarthdrs(cp, type)
CGI  *cp;
char *type;

int  cgiendhdrs(cp)
CGI  *cp;


DESCRIPTION
The cgistarthdrs() function is called to start printing the HTTP headers for the CGI program's output. As it begins the headers, it must be called before any other output is printed. The type parameter is a string indicating what Content-Type should be printed; it defaults to "text/html" if CHARPN is given. Further headers (if any) can be printed after the cgistarthdrs() call.

The cgiendhdrs() function is called after all headers are printed, and before the CGI program's document content is printed; it prints a newline to indicate the end of headers. Both cgistarthdrs() and cgiendhdrs() return 1 if successful and 0 on error.


CAVEATS
Even if a given CGI program doesn't make use of HTTP headers directly, it should still call cgistarthdrs() and cgiendhdrs(). Among other things, this will allow the state variables set with putcgi() to be sent/saved; otherwise they may be lost.


SEE ALSO
cgiputcookie()


Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.