Browse Source

[core] separate http_header_e from _htags bitmask

separate http_header_e index from r->{rqst,resp}_htags bitmask
(allows http_header_e remain 32-bit and to be used in array indexes
 while also allowing r->{rqst,resp}_htags to grow to 64-bits wide
 in the future, without requiring invasive changes)
master
Glenn Strauss 1 year ago
parent
commit
babf0d0e4c
  1. 8
      src/buffer.h
  2. 60
      src/http_header.h

8
src/buffer.h

@ -217,10 +217,10 @@ static inline int light_isalnum(int c) {
#define light_isupper(c) ((uint32_t)(c)-'A' <= 'Z'-'A')
#define light_islower(c) ((uint32_t)(c)-'a' <= 'z'-'a')
#define light_bshift(b) (b)
#define light_btst(a,b) ((a) & (b))
#define light_bclr(a,b) ((a) &= ~(b))
#define light_bset(a,b) ((a) |= (b))
#define light_bshift(b) (1u << (b))
#define light_btst(a,b) ((a) & (1u << (b)))
#define light_bclr(a,b) ((a) &= ~(1u << (b)))
#define light_bset(a,b) ((a) |= (1u << (b)))
__attribute_pure__

60
src/http_header.h

@ -9,36 +9,36 @@
/* Note: when adding new items, must replace OTHER in existing code for item */
enum http_header_e {
HTTP_HEADER_UNSPECIFIED = -1
,HTTP_HEADER_OTHER = 0x00000000
,HTTP_HEADER_ACCEPT_ENCODING = 0x00000001
,HTTP_HEADER_AUTHORIZATION = 0x00000002
,HTTP_HEADER_CACHE_CONTROL = 0x00000004
,HTTP_HEADER_CONNECTION = 0x00000008
,HTTP_HEADER_CONTENT_ENCODING = 0x00000010
,HTTP_HEADER_CONTENT_LENGTH = 0x00000020
,HTTP_HEADER_CONTENT_LOCATION = 0x00000040
,HTTP_HEADER_CONTENT_TYPE = 0x00000080
,HTTP_HEADER_COOKIE = 0x00000100
,HTTP_HEADER_DATE = 0x00000200
,HTTP_HEADER_ETAG = 0x00000400
,HTTP_HEADER_EXPECT = 0x00000800
,HTTP_HEADER_FORWARDED = 0x00001000
,HTTP_HEADER_HOST = 0x00002000
,HTTP_HEADER_IF_MODIFIED_SINCE = 0x00004000
,HTTP_HEADER_IF_NONE_MATCH = 0x00008000
,HTTP_HEADER_LAST_MODIFIED = 0x00010000
,HTTP_HEADER_LOCATION = 0x00020000
,HTTP_HEADER_RANGE = 0x00040000
,HTTP_HEADER_SERVER = 0x00080000
,HTTP_HEADER_SET_COOKIE = 0x00100000
,HTTP_HEADER_STATUS = 0x00200000
,HTTP_HEADER_TRANSFER_ENCODING = 0x00400000
,HTTP_HEADER_UPGRADE = 0x00800000
,HTTP_HEADER_USER_AGENT = 0x01000000
,HTTP_HEADER_VARY = 0x02000000
,HTTP_HEADER_X_FORWARDED_FOR = 0x04000000
,HTTP_HEADER_X_FORWARDED_PROTO = 0x08000000
,HTTP_HEADER_HTTP2_SETTINGS = 0x10000000
,HTTP_HEADER_OTHER = 0
,HTTP_HEADER_ACCEPT_ENCODING
,HTTP_HEADER_AUTHORIZATION
,HTTP_HEADER_CACHE_CONTROL
,HTTP_HEADER_CONNECTION
,HTTP_HEADER_CONTENT_ENCODING
,HTTP_HEADER_CONTENT_LENGTH
,HTTP_HEADER_CONTENT_LOCATION
,HTTP_HEADER_CONTENT_TYPE
,HTTP_HEADER_COOKIE
,HTTP_HEADER_DATE
,HTTP_HEADER_ETAG
,HTTP_HEADER_EXPECT
,HTTP_HEADER_FORWARDED
,HTTP_HEADER_HOST
,HTTP_HEADER_IF_MODIFIED_SINCE
,HTTP_HEADER_IF_NONE_MATCH
,HTTP_HEADER_LAST_MODIFIED
,HTTP_HEADER_LOCATION
,HTTP_HEADER_RANGE
,HTTP_HEADER_SERVER
,HTTP_HEADER_SET_COOKIE
,HTTP_HEADER_STATUS
,HTTP_HEADER_TRANSFER_ENCODING
,HTTP_HEADER_UPGRADE
,HTTP_HEADER_USER_AGENT
,HTTP_HEADER_VARY
,HTTP_HEADER_X_FORWARDED_FOR
,HTTP_HEADER_X_FORWARDED_PROTO
,HTTP_HEADER_HTTP2_SETTINGS
};
__attribute_pure__

Loading…
Cancel
Save