nxt_http_parse.h (1459:358b957ca294) nxt_http_parse.h (1505:d18f2b38596b)
1
2/*
3 * Copyright (C) NGINX, Inc.
4 * Copyright (C) Valentin V. Bartenev
5 */
6
7#ifndef _NXT_HTTP_PARSER_H_INCLUDED_
8#define _NXT_HTTP_PARSER_H_INCLUDED_

--- 76 unchanged lines hidden (view full) ---

85 uint8_t hopbyhop:1;
86 uint8_t name_length;
87 uint32_t value_length;
88 u_char *name;
89 u_char *value;
90};
91
92
1
2/*
3 * Copyright (C) NGINX, Inc.
4 * Copyright (C) Valentin V. Bartenev
5 */
6
7#ifndef _NXT_HTTP_PARSER_H_INCLUDED_
8#define _NXT_HTTP_PARSER_H_INCLUDED_

--- 76 unchanged lines hidden (view full) ---

85 uint8_t hopbyhop:1;
86 uint8_t name_length;
87 uint32_t value_length;
88 u_char *name;
89 u_char *value;
90};
91
92
93typedef struct {
94 u_char *pos;
95 nxt_mp_t *mem_pool;
96
97 uint64_t chunk_size;
98
99 uint8_t state;
100 uint8_t last; /* 1 bit */
101 uint8_t chunk_error; /* 1 bit */
102 uint8_t error; /* 1 bit */
103} nxt_http_chunk_parse_t;
104
105
93#define NXT_HTTP_FIELD_HASH_INIT 159406U
94#define nxt_http_field_hash_char(h, c) (((h) << 4) + (h) + (c))
95#define nxt_http_field_hash_end(h) (((h) >> 16) ^ (h))
96
97
98nxt_int_t nxt_http_parse_request_init(nxt_http_request_parse_t *rp,
99 nxt_mp_t *mp);
100nxt_int_t nxt_http_parse_request(nxt_http_request_parse_t *rp,
101 nxt_buf_mem_t *b);
102nxt_int_t nxt_http_parse_fields(nxt_http_request_parse_t *rp,
103 nxt_buf_mem_t *b);
104
105nxt_int_t nxt_http_fields_hash(nxt_lvlhsh_t *hash,
106 nxt_http_field_proc_t items[], nxt_uint_t count);
107nxt_uint_t nxt_http_fields_hash_collisions(nxt_lvlhsh_t *hash,
108 nxt_http_field_proc_t items[], nxt_uint_t count, nxt_bool_t level);
109nxt_int_t nxt_http_fields_process(nxt_list_t *fields, nxt_lvlhsh_t *hash,
110 void *ctx);
111
106#define NXT_HTTP_FIELD_HASH_INIT 159406U
107#define nxt_http_field_hash_char(h, c) (((h) << 4) + (h) + (c))
108#define nxt_http_field_hash_end(h) (((h) >> 16) ^ (h))
109
110
111nxt_int_t nxt_http_parse_request_init(nxt_http_request_parse_t *rp,
112 nxt_mp_t *mp);
113nxt_int_t nxt_http_parse_request(nxt_http_request_parse_t *rp,
114 nxt_buf_mem_t *b);
115nxt_int_t nxt_http_parse_fields(nxt_http_request_parse_t *rp,
116 nxt_buf_mem_t *b);
117
118nxt_int_t nxt_http_fields_hash(nxt_lvlhsh_t *hash,
119 nxt_http_field_proc_t items[], nxt_uint_t count);
120nxt_uint_t nxt_http_fields_hash_collisions(nxt_lvlhsh_t *hash,
121 nxt_http_field_proc_t items[], nxt_uint_t count, nxt_bool_t level);
122nxt_int_t nxt_http_fields_process(nxt_list_t *fields, nxt_lvlhsh_t *hash,
123 void *ctx);
124
125nxt_buf_t *nxt_http_chunk_parse(nxt_task_t *task, nxt_http_chunk_parse_t *hcp,
126 nxt_buf_t *in);
112
127
128
113extern const nxt_lvlhsh_proto_t nxt_http_fields_hash_proto;
114
115nxt_inline nxt_int_t
116nxt_http_field_process(nxt_http_field_t *field, nxt_lvlhsh_t *hash, void *ctx)
117{
118 nxt_lvlhsh_query_t lhq;
119 nxt_http_field_proc_t *proc;
120

--- 17 unchanged lines hidden ---
129extern const nxt_lvlhsh_proto_t nxt_http_fields_hash_proto;
130
131nxt_inline nxt_int_t
132nxt_http_field_process(nxt_http_field_t *field, nxt_lvlhsh_t *hash, void *ctx)
133{
134 nxt_lvlhsh_query_t lhq;
135 nxt_http_field_proc_t *proc;
136

--- 17 unchanged lines hidden ---