summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_http_parse.h
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2017-06-20 22:32:13 +0300
committerValentin Bartenev <vbart@nginx.com>2017-06-20 22:32:13 +0300
commitaccb489492bca709fbc8f06a9f911ce61faace70 (patch)
tree4b8dc7e8496be457afd1efa561e9067cd2ef58b3 /src/nxt_http_parse.h
parent1a22195830abf8b674963352e6e8e1aef49cb05d (diff)
downloadunit-accb489492bca709fbc8f06a9f911ce61faace70.tar.gz
unit-accb489492bca709fbc8f06a9f911ce61faace70.tar.bz2
HTTP parser: reduced memory consumption of header fields list.
Diffstat (limited to '')
-rw-r--r--src/nxt_http_parse.h68
1 files changed, 36 insertions, 32 deletions
diff --git a/src/nxt_http_parse.h b/src/nxt_http_parse.h
index 590101be..da8c4ce6 100644
--- a/src/nxt_http_parse.h
+++ b/src/nxt_http_parse.h
@@ -9,58 +9,57 @@
typedef struct nxt_http_request_parse_s nxt_http_request_parse_t;
+typedef struct nxt_http_field_s nxt_http_field_t;
typedef struct nxt_http_fields_hash_s nxt_http_fields_hash_t;
typedef union {
- u_char str[8];
- uint64_t ui64;
+ u_char str[8];
+ uint64_t ui64;
} nxt_http_ver_t;
-typedef struct {
- union {
- uint8_t str[32];
- uint64_t ui64[4];
- } key;
+struct nxt_http_request_parse_s {
+ nxt_int_t (*handler)(nxt_http_request_parse_t *rp,
+ u_char **pos, u_char *end);
- nxt_str_t name;
- nxt_str_t value;
-} nxt_http_field_t;
+ size_t offset;
+ nxt_str_t method;
-struct nxt_http_request_parse_s {
- nxt_int_t (*handler)(nxt_http_request_parse_t *rp,
- u_char **pos, u_char *end);
+ u_char *target_start;
+ u_char *target_end;
+ u_char *exten_start;
+ u_char *args_start;
- size_t offset;
+ nxt_http_ver_t version;
- nxt_str_t method;
+ union {
+ uint8_t str[32];
+ uint64_t ui64[4];
+ } field_key;
- u_char *target_start;
- u_char *target_end;
- u_char *exten_start;
- u_char *args_start;
+ nxt_str_t field_name;
+ nxt_str_t field_value;
- nxt_http_ver_t version;
+ nxt_http_fields_hash_t *fields_hash;
- nxt_http_field_t field;
- nxt_list_t *fields;
+ nxt_list_t *fields;
/* target with "/." */
- unsigned complex_target:1;
+ unsigned complex_target:1;
/* target with "%" */
- unsigned quoted_target:1;
+ unsigned quoted_target:1;
/* target with " " */
- unsigned space_in_target:1;
+ unsigned space_in_target:1;
/* target with "+" */
- unsigned plus_in_target:1;
+ unsigned plus_in_target:1;
};
typedef nxt_int_t (*nxt_http_field_handler_t)(void *ctx,
nxt_http_field_t *field,
- uintptr_t data, nxt_log_t *log);
+ nxt_log_t *log);
typedef struct {
@@ -70,6 +69,14 @@ typedef struct {
} nxt_http_fields_hash_entry_t;
+struct nxt_http_field_s {
+ nxt_str_t name;
+ nxt_str_t value;
+ nxt_http_field_handler_t handler;
+ uintptr_t data;
+};
+
+
nxt_inline nxt_int_t
nxt_http_parse_request_init(nxt_http_request_parse_t *rp, nxt_mp_t *mp)
{
@@ -87,11 +94,8 @@ nxt_int_t nxt_http_parse_request(nxt_http_request_parse_t *rp,
nxt_http_fields_hash_t *nxt_http_fields_hash_create(
nxt_http_fields_hash_entry_t *entries, nxt_mp_t *mp);
-nxt_http_fields_hash_entry_t *nxt_http_fields_hash_lookup(
- nxt_http_fields_hash_t *hash, nxt_http_field_t *field);
-
-nxt_int_t nxt_http_fields_process(nxt_list_t *fields,
- nxt_http_fields_hash_t *hash, void *ctx, nxt_log_t *log);
+nxt_int_t nxt_http_fields_process(nxt_list_t *fields, void *ctx,
+ nxt_log_t *log);
#endif /* _NXT_HTTP_PARSER_H_INCLUDED_ */