1 #ifndef HTTP_REQUEST_H
 2 #define HTTP_REQUEST_H
 3 
 4 #include "http_header.h"
 5 #include "rh_chunk.h"
 6 #include "rh_stat.h"
 7 #include "queue.h"
 8 #include "handler.h"
 9 #include "rh_gmtime.h"
10 
11 typedef struct http_request http_request_t;
12         
13 SIMPLEQ_HEAD(http_request_list, http_request);
14 
15 struct http_request {
16         struct client                   *client;
17         http_header_t                   header_in;
18         http_header_t                   header_out;
19 
20         rh_chunk_t                      *chunk_current;
21         rh_chunk_t                      chunk_header;
22         rh_chunk_t                      chunk_content;
23 
24         rh_stat_t                       *st;
25 
26         rh_gmtime_t                     gmtime; /* current time */
27 
28         SIMPLEQ_ENTRY(http_request)     request;
29 
30         handler_base_t                  handler;
31 
32         int                             keepalive;
33         /* true if KeepAlive: Header should be send */
34         int                             keepalive_header;
35         int                             have_write_setup;
36 
37 
38 
39 #if 0
40         struct http_request             *parent;
41         struct http_request_list        sub_request;
42         
43         /* true if this is a sub request,
44          * for example a part of a multiple byte range.
45          *
46          * the sub request has only some headers.
47          * only the parent request has the full http header.
48          *
49          * sub requests count keepalive numbers
50          * 
51          */
52         int                             sub_request_number;
53 #endif
54 };
55 
56 http_request_t * http_request_alloc  (struct client *client);
57 http_request_t * http_sub_request_alloc (http_request_t *parent);
58 
59 void http_request_destroy (http_request_t *request);
60 void http_request_free    (http_request_t *request);
61 void http_request_reset   (http_request_t *request);
62 
63 void http_request_stat    (http_request_t *request);
64 int  http_request_stat_symlink (http_request_t *request);
65 
66 int http_request_write_setup (http_request_t *request);
67 
68 #define HTTP_REQUEST_PUSH(head,elm)     \
69         SIMPLEQ_INSERT_TAIL(head,elm,request)
70 
71 #define HTTP_REQUEST_TIME(_request)     \
72         ( (_request)->gmtime.t )
73 
74 #endif /* HTTP_REQUEST_H */


syntax highlighted by Code2HTML, v. 0.9.1