xref: /lighttpd1.4/src/http_header.h (revision 15cdc313)
1 #ifndef INCLUDED_HTTP_HEADER_H
2 #define INCLUDED_HTTP_HEADER_H
3 #include "first.h"
4 
5 #include "base_decls.h"
6 #include "buffer.h"
7 
8 /* Note: must be kept in sync with http_header.c http_headers[] */
9 /* Note: when adding new items, must replace OTHER in existing code for item */
10 enum http_header_e {
11   HTTP_HEADER_UNSPECIFIED       = -1
12  ,HTTP_HEADER_OTHER             = 0x00000000
13  ,HTTP_HEADER_ACCEPT_ENCODING   = 0x00000001
14  ,HTTP_HEADER_AUTHORIZATION     = 0x00000002
15  ,HTTP_HEADER_CACHE_CONTROL     = 0x00000004
16  ,HTTP_HEADER_CONNECTION        = 0x00000008
17  ,HTTP_HEADER_CONTENT_ENCODING  = 0x00000010
18  ,HTTP_HEADER_CONTENT_LENGTH    = 0x00000020
19  ,HTTP_HEADER_CONTENT_LOCATION  = 0x00000040
20  ,HTTP_HEADER_CONTENT_TYPE      = 0x00000080
21  ,HTTP_HEADER_COOKIE            = 0x00000100
22  ,HTTP_HEADER_DATE              = 0x00000200
23  ,HTTP_HEADER_ETAG              = 0x00000400
24  ,HTTP_HEADER_EXPECT            = 0x00000800
25  ,HTTP_HEADER_FORWARDED         = 0x00001000
26  ,HTTP_HEADER_HOST              = 0x00002000
27  ,HTTP_HEADER_IF_MODIFIED_SINCE = 0x00004000
28  ,HTTP_HEADER_IF_NONE_MATCH     = 0x00008000
29  ,HTTP_HEADER_LAST_MODIFIED     = 0x00010000
30  ,HTTP_HEADER_LOCATION          = 0x00020000
31  ,HTTP_HEADER_RANGE             = 0x00040000
32  ,HTTP_HEADER_SERVER            = 0x00080000
33  ,HTTP_HEADER_SET_COOKIE        = 0x00100000
34  ,HTTP_HEADER_STATUS            = 0x00200000
35  ,HTTP_HEADER_TRANSFER_ENCODING = 0x00400000
36  ,HTTP_HEADER_UPGRADE           = 0x00800000
37  ,HTTP_HEADER_VARY              = 0x01000000
38  ,HTTP_HEADER_X_FORWARDED_FOR   = 0x02000000
39  ,HTTP_HEADER_X_FORWARDED_PROTO = 0x04000000
40 };
41 
42 __attribute_pure__
43 enum http_header_e http_header_hkey_get(const char *s, size_t slen);
44 
45 buffer * http_header_response_get(connection *con, enum http_header_e id, const char *k, size_t klen);
46 void http_header_response_unset(connection *con, enum http_header_e id, const char *k, size_t klen);
47 void http_header_response_set(connection *con, enum http_header_e id, const char *k, size_t klen, const char *v, size_t vlen);
48 void http_header_response_append(connection *con, enum http_header_e id, const char *k, size_t klen, const char *v, size_t vlen);
49 void http_header_response_insert(connection *con, enum http_header_e id, const char *k, size_t klen, const char *v, size_t vlen);
50 
51 buffer * http_header_request_get(connection *con, enum http_header_e id, const char *k, size_t klen);
52 void http_header_request_unset(connection *con, enum http_header_e id, const char *k, size_t klen);
53 void http_header_request_set(connection *con, enum http_header_e id, const char *k, size_t klen, const char *v, size_t vlen);
54 void http_header_request_append(connection *con, enum http_header_e id, const char *k, size_t klen, const char *v, size_t vlen);
55 
56 buffer * http_header_env_get(connection *con, const char *k, size_t klen);
57 void http_header_env_set(connection *con, const char *k, size_t klen, const char *v, size_t vlen);
58 void http_header_env_append(connection *con, const char *k, size_t klen, const char *v, size_t vlen);
59 
60 #endif
61