45 typedef struct _header Header; |
45 typedef struct _header Header; |
46 typedef struct _header_array HeaderArray; |
46 typedef struct _header_array HeaderArray; |
47 |
47 |
48 struct _http_request { |
48 struct _http_request { |
49 Connection *connection; |
49 Connection *connection; |
50 sstr_t request_line; |
50 cxmutstr request_line; |
51 sstr_t method; |
51 cxmutstr method; |
52 sstr_t uri; |
52 cxmutstr uri; |
53 sstr_t httpv; |
53 cxmutstr httpv; |
54 HeaderArray *headers; |
54 HeaderArray *headers; |
55 netbuf *netbuf; |
55 netbuf *netbuf; |
56 time_t req_start; |
56 time_t req_start; |
57 }; |
57 }; |
58 |
58 |
59 struct _header { |
59 struct _header { |
60 sstr_t name; |
60 cxmutstr name; |
61 sstr_t value; |
61 cxmutstr value; |
62 }; |
62 }; |
63 |
63 |
64 struct _header_array { |
64 struct _header_array { |
65 HeaderArray *next; |
65 HeaderArray *next; |
66 Header *headers; |
66 Header *headers; |
69 }; |
69 }; |
70 |
70 |
71 void http_request_init(HTTPRequest *req); |
71 void http_request_init(HTTPRequest *req); |
72 void http_request_cleanup(HTTPRequest *req); |
72 void http_request_cleanup(HTTPRequest *req); |
73 |
73 |
74 sstr_t http_request_get_abspath(HTTPRequest *req); |
74 cxmutstr http_request_get_abspath(HTTPRequest *req); |
75 |
75 |
76 |
76 |
77 NSAPISession* nsapisession_create(pool_handle_t *pool); |
77 NSAPISession* nsapisession_create(pool_handle_t *pool); |
78 int nsapisession_setconnection(NSAPISession *sn, Connection *conn, netbuf *inbuf, IOStream **io); |
78 int nsapisession_setconnection(NSAPISession *sn, Connection *conn, netbuf *inbuf, IOStream **io); |
79 |
79 |
85 */ |
85 */ |
86 int handle_request(HTTPRequest *request, threadpool_t *pool, EventHandler *ev); |
86 int handle_request(HTTPRequest *request, threadpool_t *pool, EventHandler *ev); |
87 |
87 |
88 |
88 |
89 |
89 |
90 void header_add(HeaderArray *hd, sstr_t name, sstr_t value); |
90 void header_add(HeaderArray *hd, cxmutstr name, cxmutstr value); |
91 void header_array_free(HeaderArray *hd); |
91 void header_array_free(HeaderArray *hd); |
92 |
92 |
93 int nsapi_handle_request(NSAPISession *sn, NSAPIRequest *rq); |
93 int nsapi_handle_request(NSAPISession *sn, NSAPIRequest *rq); |
94 int nsapi_finish_request(NSAPISession *sn, NSAPIRequest *rq); |
94 int nsapi_finish_request(NSAPISession *sn, NSAPIRequest *rq); |
95 |
95 |
130 NSAPIRequest *rq, |
130 NSAPIRequest *rq, |
131 char *name, |
131 char *name, |
132 char *path); |
132 char *path); |
133 |
133 |
134 int method_match(char *cmp, char *method); |
134 int method_match(char *cmp, char *method); |
135 int contenttype_match(sstr_t cmp, sstr_t ctype); |
135 int contenttype_match(cxstring cmp, cxstring ctype); |
136 |
136 |
137 /* request.h functions */ |
137 /* request.h functions */ |
138 int request_initialize( |
138 int request_initialize( |
139 pool_handle_t *pool, |
139 pool_handle_t *pool, |
140 HTTPRequest *hrq, |
140 HTTPRequest *hrq, |