blob: cb2a4f5ce359329c03ce22fa859f7764dee74526 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
/*@@
@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)(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__ */
|