[MEDIUM] acl: implement matching on header values
hdr(x), hdr_reg(x), hdr_beg(x), hdr_end(x), hdr_sub(x), hdr_dir(x),
hdr_dom(x), hdr_cnt(x) and hdr_val(x) have been implemented. They
apply to any of the possibly multiple values of header <x>.
Right now, hdr_val() is limited to integer matching, but it should
reasonably be upgraded to match long long ints.
diff --git a/include/types/acl.h b/include/types/acl.h
index fe0ce5f..db76a27 100644
--- a/include/types/acl.h
+++ b/include/types/acl.h
@@ -102,13 +102,16 @@
* retrieving a value, and an acl_match_* function responsible for testing it.
*/
struct acl_test {
- int i; /* integer value */
- char *ptr; /* pointer to beginning of value */
- int len; /* length of value at ptr, otherwise ignored */
- int flags; /* ACL_TEST_F_* set to 0 on first call */
- union { /* fetch_* functions context for any purpose */
- void *p;
- int i;
+ int i; /* integer value */
+ char *ptr; /* pointer to beginning of value */
+ int len; /* length of value at ptr, otherwise ignored */
+ int flags; /* ACL_TEST_F_* set to 0 on first call */
+ union { /* fetch_* functions context for any purpose */
+ void *p; /* any pointer */
+ int i; /* any integer */
+ long long ll; /* any long long or smaller */
+ double d; /* any float or double */
+ void *a[8]; /* any array of up to 8 pointers */
} ctx;
};
diff --git a/include/types/proto_http.h b/include/types/proto_http.h
index 6e68362..c5e051e 100644
--- a/include/types/proto_http.h
+++ b/include/types/proto_http.h
@@ -243,6 +243,15 @@
unsigned int flags; /* transaction flags */
};
+/* This structure is used by http_find_header() to return values of headers.
+ * The header starts at <line>, the value at <line>+<val> for <vlen> bytes.
+ */
+struct hdr_ctx {
+ const char *line;
+ int idx;
+ int val; /* relative to line */
+ int vlen; /* relative to line+val */
+};
#endif /* _TYPES_PROTO_HTTP_H */