/*@@ @header http_Request.h @date Wed Sep 13 23:49:30 2000 @author Tom Goodale @desc @enddesc @version $Header$ @@*/ #include "util_Hash.h" #ifndef __HTTP_REQUEST_H__ #define __HTTP_REQUEST_H__ 1 typedef struct HTTPArg { /* Public data */ char *arg; char *value; /* Private data */ struct HTTPArg *next; struct HTTPArg *all_next; } httpArg; /* This is the main structure for storing data about a request. */ typedef struct { /* Public members of the structure. */ char *body; /* The body of the request */ int body_length; /* How long the body is */ char *method; /* The HTTP method */ char *uri; /* The URI */ char *residual; /* What's left of the URI after subtracting the found page */ /* HTTP version numbers */ int http_major_version; int http_minor_version; /* How many arguments there are */ int n_arguments; /* These are all private members of this structure */ /* The connection data */ void *connection; /* The request header lines */ uHash *headers; /* Stuff for arguments */ /* First a hash table to look the data up quickly */ uHash *arguments; /* Now a linked list to allow walking. */ httpArg *firstarg; httpArg *lastarg; httpArg *currentarg; } httpRequest; #ifdef __cplusplus extern "C" { #endif int HTTP_RegisterPage(const char *path, int (*function)(const cGH *, httpRequest *, void *), void *data); const char *HTTP_ArgumentValue(const httpRequest *request, const char *arg); const httpArg *HTTP_ArgumentWalk(httpRequest *request, int first); const char *HTTP_HeaderValue(const httpRequest *request, const char *header); int HTTP_Write(httpRequest *request, const char *buffer, size_t count); int HTTP_Read(httpRequest *request, char *buffer, size_t count); unsigned long int HTTP_Port(void); #ifdef __cplusplus } #endif #endif /* __HTTP_REQUEST_H__ */