From 310f5363afe8ed31b6381ff002991d5c7cfa6d96 Mon Sep 17 00:00:00 2001 From: swhite Date: Tue, 13 Apr 2004 13:42:54 +0000 Subject: Made HTTPD to correctly describe interface by INCLUDE HEADER mechanism. Changed internal names of http_Auth.h http_Cookies.h http_Steer.h http_Content.h so that HTTPD thorn developers will be required to use this interface, rather than incorrectly explicitly including the source header files. * Protected SString against C++ name mangling * Gave exported functions the HTTP_ prefix * Wrote doc/Content.h * Fixed bug that disabled some steering functionality git-svn-id: http://svn.cactuscode.org/arrangements/CactusConnect/HTTPD/trunk@192 1faa4e14-9dd3-4be0-9f0e-ffe519881164 --- doc/Content.txt | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 doc/Content.txt (limited to 'doc') diff --git a/doc/Content.txt b/doc/Content.txt new file mode 100644 index 0000000..1149ea9 --- /dev/null +++ b/doc/Content.txt @@ -0,0 +1,97 @@ + /*@@ + @file Content.txt + @date 08.04.2004 + @author Steve White + @desc + Description of the Content interface + @enddesc + @version $Header$ + @@*/ + +There is an interface for setting HTML page content information, which is +accessed by including http_Content.h. + + +This provides functions + +int HTTP_SendString(httpRequest *request, const String* message); + +which sends the string message to HTTP, + +void HTTP_SetHeadInfo( String *header); + +which copies a string containing typical content of the HEAD element of +the standard Cactus HTTPD web pages. Particularly, it includes style +information, but not the title of the page. + +void HTTP_SetDoctype( String *header); + +which copies a standard DOCTYPE tag into the string. Typical use will +be to emit this string immediately before the first HTML tag of the +web page being generated. + +int HTTP_SetContentHeaderString(const cGH *cctkGH, int choice, String *mess, + const String *menu); + +This copies standard Cactus body HTML information into the string mess. +If choice is nonzero, the information is appropriate for a main page; +if it is 0, the information is appropriate for non-main pages. +If the menu argument is non-null, that string will be appended as +HTML to the standard menus. + +int HTTP_SetContentFooterString(const cGH *cctkGH, int choice, String *mess ); + +This copies standard Cactus footer HTML into the string mess; if choice is +nonzero, the information is appropriate for the main page. + +int HTTP_ContentSendFromFile(httpRequest *request, int filedes); + +which emits the entirety of the file referred to by file descriptor filedes +to HTTP, + +int HTTP_ContentLink(const char *URL, + const char *name, + const char *description, + int flags); + +which...I don't know what this does. + +The functions + +int HTTP_ContentHeader(const cGH *cctkGH, int choice, int len, char *mess, + const char *menu); +int HTTP_ContentFooter(const cGH *cctkGH, int choice, int len, char *mess); + +are a little dangerous. They are like the corresponding ContentHeader and +Footer calls above, with the len attribute indicating the length of the +character buffer mess. + +------------------------------------ +Other included functions + +int HTTP_SendString(httpRequest *request, const String* message); + + +Example: +-------- + +A web page is typically generated in the following sequence. +The HTTP connection has already been established and saved in the httpRequest +pointer, and a String instance 'message' has been created. + + 0) HTTP_Send_OK_Header( httpRequest ) + 1a) HTTP_SetDoctype( message ); + 1b) HTTP_SendString( httpRequest, message ); + 2) HTTP_Send( httpRequest, "\n" ); + 3) HTTP_Send( httpRequest, "My Title\n" ); + 4a) HTTP_HeadInfo( message ); + 4b) HTTP_SendString( httpRequest, message ); + 5) HTTP_Send( httpRequest, "\n" ); + 6) HTTP_HeadInfo( httpRequest ); + 7a) HTTP_SetContentHeaderString(cctkGH, choice, message, menu); + 7b) HTTP_SendString( httpRequest, message ); + 8) Page content + 9a) HTTP_SetContentFooterString(cctkGH, choice, message); + 9b) HTTP_SendString( httpRequest, message ); + 10) HTTP_Send( httpRequest, "\n" ); + -- cgit v1.2.3