annotate src/http.h @ 4:9e054c002489
fixed the header parsing bugs
author |
John Tsiombikas <nuclear@member.fsf.org> |
date |
Thu, 16 Apr 2015 17:34:15 +0300 |
parents |
7bb4c2a0a360 |
children |
def49a046566 |
rev |
line source |
nuclear@1
|
1 #ifndef HTTP_H_
|
nuclear@1
|
2 #define HTTP_H_
|
nuclear@1
|
3
|
nuclear@1
|
4 enum http_method {
|
nuclear@1
|
5 HTTP_UNKNOWN,
|
nuclear@1
|
6 HTTP_OPTIONS,
|
nuclear@1
|
7 HTTP_GET,
|
nuclear@1
|
8 HTTP_HEAD,
|
nuclear@1
|
9 HTTP_POST,
|
nuclear@1
|
10 HTTP_PUT,
|
nuclear@1
|
11 HTTP_DELETE,
|
nuclear@1
|
12 HTTP_TRACE,
|
nuclear@1
|
13 HTTP_CONNECT,
|
nuclear@1
|
14
|
nuclear@1
|
15 NUM_HTTP_METHODS
|
nuclear@1
|
16 };
|
nuclear@1
|
17
|
nuclear@1
|
18 struct http_req_header {
|
nuclear@1
|
19 enum http_method method;
|
nuclear@1
|
20 char *uri;
|
nuclear@1
|
21 int ver_major, ver_minor; /* http version */
|
nuclear@2
|
22 char **hdrfields;
|
nuclear@2
|
23 int num_hdrfields;
|
nuclear@3
|
24 int body_offset;
|
nuclear@1
|
25 };
|
nuclear@1
|
26
|
nuclear@3
|
27 #define HTTP_HDR_OK 0
|
nuclear@3
|
28 #define HTTP_HDR_INVALID -1
|
nuclear@3
|
29 #define HTTP_HDR_NOMEM -2
|
nuclear@3
|
30 #define HTTP_HDR_PARTIAL -3
|
nuclear@1
|
31
|
nuclear@2
|
32 int http_parse_header(struct http_req_header *hdr, const char *buf, int bufsz);
|
nuclear@3
|
33 void http_print_header(struct http_req_header *hdr);
|
nuclear@3
|
34 void http_destroy_header(struct http_req_header *hdr);
|
nuclear@2
|
35
|
nuclear@2
|
36 const char *http_strmsg(int code);
|
nuclear@2
|
37
|
nuclear@1
|
38 #endif /* HTTP_H_ */
|