src/server/httprequest.h

changeset 1
3c066d52342d
child 3
137197831306
equal deleted inserted replaced
0:4c89c7683fb6 1:3c066d52342d
1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 *
4 * Copyright 2011 Olaf Wintermann. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 #ifndef HTTPREQUEST_H
30 #define HTTPREQUEST_H
31
32 #include "sstring.h"
33 #include "sessionhandler.h"
34 #include "nsapi.h"
35 #include "pool.h"
36 #include "session.h"
37 #include "sstring.h"
38 #include "request.h"
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 typedef struct _http_request HTTPRequest;
45 typedef struct _header Header;
46 typedef struct _header_array HeaderArray;
47
48 struct _http_request {
49 Connection *connection;
50 sstr_t request_line;
51 sstr_t method;
52 sstr_t uri;
53 sstr_t httpv;
54 HeaderArray *headers;
55 netbuf *netbuf;
56 NSAPISession *sn;
57 NSAPIRequest *rq;
58 pool_handle_t *pool;
59 };
60
61 struct _header {
62 char *name;
63 char *value;
64 };
65
66 struct _header_array {
67 HeaderArray *next;
68 Header *headers;
69 int len;
70 int alloc;
71 };
72
73 HTTPRequest *http_request_new();
74
75 int handle_request(HTTPRequest *request);
76
77
78
79 void header_add(HeaderArray *hd, char *name, char *value);
80
81
82 /* request.h functions */
83 int request_initialize(
84 pool_handle_t *pool,
85 HTTPRequest *hrq,
86 NSAPIRequest *nrq);
87
88 #ifdef __cplusplus
89 }
90 #endif
91
92 #endif /* HTTPREQUEST_H */
93

mercurial