blob: 65dfd0c85f58fe54ea24982d962f4f19e601cd27 (
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
|
/* -*- c++ -*- */
// Hey, Emacs! This is a C++ file!
// $Id$
// ============================================================================
//
// = LIBRARY
// jaws
//
// = FILENAME
// HTTP_Response.h
//
// = AUTHOR
// James Hu
//
// ============================================================================
#if !defined (HTTP_RESPONSE_H)
#define HTTP_RESPONSE_H
class JAWS_IO;
class HTTP_Request;
class HTTP_Response
// = TITLE
// Abstraction for HTTP responses.
//
// = DESCRIPTION
// Provides an encapsulation of responses to HTTP requests.
// For instance, given an HTTP GET request, it will produce
// header and body suitable for returning to the client who made
// the request.
{
public:
HTTP_Response (JAWS_IO &io,
HTTP_Request &request);
HTTP_Response (HTTP_Request &request, JAWS_IO &io);
~HTTP_Response (void);
void process_request (void);
// This is called by the handler to initiate a response.
void error_response (int status,
const char *log_message);
// This returns an error response for cases where there is a problem
// with the request, logging the log_message.
private:
void normal_response (void);
// Called by process_request when the request is a normal request.
void cgi_response (void);
// Called by process_request when the request is a cgi request.
private:
static void process_request (HTTP_Response &response);
// static version of process_request, just in case.
void build_headers (void);
// creates the appropriate header information for responses.
private:
// James, please document this.
JAWS_IO &io_;
HTTP_Request &request_;
char *HTTP_HEADER;
char *HTTP_TRAILER;
int HTTP_HEADER_LENGTH;
int HTTP_TRAILER_LENGTH;
};
#endif /* HTTP_RESPONSE_H */
|