uintptr_t
-ngx_http_v3_encode_header_block_prefix(u_char *p, ngx_uint_t insert_count,
+ngx_http_v3_encode_field_section_prefix(u_char *p, ngx_uint_t insert_count,
ngx_uint_t sign, ngx_uint_t delta_base)
{
if (p == NULL) {
uintptr_t
-ngx_http_v3_encode_header_ri(u_char *p, ngx_uint_t dynamic, ngx_uint_t index)
+ngx_http_v3_encode_field_ri(u_char *p, ngx_uint_t dynamic, ngx_uint_t index)
{
- /* Indexed Header Field */
+ /* Indexed Field Line */
if (p == NULL) {
return ngx_http_v3_encode_prefix_int(NULL, index, 6);
uintptr_t
-ngx_http_v3_encode_header_lri(u_char *p, ngx_uint_t dynamic, ngx_uint_t index,
+ngx_http_v3_encode_field_lri(u_char *p, ngx_uint_t dynamic, ngx_uint_t index,
u_char *data, size_t len)
{
- /* Literal Header Field With Name Reference */
+ /* Literal Field Line With Name Reference */
if (p == NULL) {
return ngx_http_v3_encode_prefix_int(NULL, index, 4)
uintptr_t
-ngx_http_v3_encode_header_l(u_char *p, ngx_str_t *name, ngx_str_t *value)
+ngx_http_v3_encode_field_l(u_char *p, ngx_str_t *name, ngx_str_t *value)
{
- /* Literal Header Field Without Name Reference */
+ /* Literal Field Line With Literal Name */
if (p == NULL) {
return ngx_http_v3_encode_prefix_int(NULL, name->len, 3)
uintptr_t
-ngx_http_v3_encode_header_pbi(u_char *p, ngx_uint_t index)
+ngx_http_v3_encode_field_pbi(u_char *p, ngx_uint_t index)
{
- /* Indexed Header Field With Post-Base Index */
+ /* Indexed Field Line With Post-Base Index */
if (p == NULL) {
return ngx_http_v3_encode_prefix_int(NULL, index, 4);
uintptr_t
-ngx_http_v3_encode_header_lpbi(u_char *p, ngx_uint_t index, u_char *data,
+ngx_http_v3_encode_field_lpbi(u_char *p, ngx_uint_t index, u_char *data,
size_t len)
{
- /* Literal Header Field With Post-Base Name Reference */
+ /* Literal Field Line With Post-Base Name Reference */
if (p == NULL) {
return ngx_http_v3_encode_prefix_int(NULL, index, 3)
uintptr_t ngx_http_v3_encode_prefix_int(u_char *p, uint64_t value,
ngx_uint_t prefix);
-uintptr_t ngx_http_v3_encode_header_block_prefix(u_char *p,
+uintptr_t ngx_http_v3_encode_field_section_prefix(u_char *p,
ngx_uint_t insert_count, ngx_uint_t sign, ngx_uint_t delta_base);
-uintptr_t ngx_http_v3_encode_header_ri(u_char *p, ngx_uint_t dynamic,
+uintptr_t ngx_http_v3_encode_field_ri(u_char *p, ngx_uint_t dynamic,
ngx_uint_t index);
-uintptr_t ngx_http_v3_encode_header_lri(u_char *p, ngx_uint_t dynamic,
+uintptr_t ngx_http_v3_encode_field_lri(u_char *p, ngx_uint_t dynamic,
ngx_uint_t index, u_char *data, size_t len);
-uintptr_t ngx_http_v3_encode_header_l(u_char *p, ngx_str_t *name,
+uintptr_t ngx_http_v3_encode_field_l(u_char *p, ngx_str_t *name,
ngx_str_t *value);
-uintptr_t ngx_http_v3_encode_header_pbi(u_char *p, ngx_uint_t index);
-uintptr_t ngx_http_v3_encode_header_lpbi(u_char *p, ngx_uint_t index,
+uintptr_t ngx_http_v3_encode_field_pbi(u_char *p, ngx_uint_t index);
+uintptr_t ngx_http_v3_encode_field_lpbi(u_char *p, ngx_uint_t index,
u_char *data, size_t len);
}
}
- len = ngx_http_v3_encode_header_block_prefix(NULL, 0, 0, 0);
+ len = ngx_http_v3_encode_field_section_prefix(NULL, 0, 0, 0);
if (r->headers_out.status == NGX_HTTP_OK) {
- len += ngx_http_v3_encode_header_ri(NULL, 0,
- NGX_HTTP_V3_HEADER_STATUS_200);
+ len += ngx_http_v3_encode_field_ri(NULL, 0,
+ NGX_HTTP_V3_HEADER_STATUS_200);
} else {
- len += ngx_http_v3_encode_header_lri(NULL, 0,
- NGX_HTTP_V3_HEADER_STATUS_200,
- NULL, 3);
+ len += ngx_http_v3_encode_field_lri(NULL, 0,
+ NGX_HTTP_V3_HEADER_STATUS_200,
+ NULL, 3);
}
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
n = sizeof("nginx") - 1;
}
- len += ngx_http_v3_encode_header_lri(NULL, 0,
- NGX_HTTP_V3_HEADER_SERVER,
- NULL, n);
+ len += ngx_http_v3_encode_field_lri(NULL, 0,
+ NGX_HTTP_V3_HEADER_SERVER,
+ NULL, n);
}
if (r->headers_out.date == NULL) {
- len += ngx_http_v3_encode_header_lri(NULL, 0, NGX_HTTP_V3_HEADER_DATE,
- NULL, ngx_cached_http_time.len);
+ len += ngx_http_v3_encode_field_lri(NULL, 0, NGX_HTTP_V3_HEADER_DATE,
+ NULL, ngx_cached_http_time.len);
}
if (r->headers_out.content_type.len) {
n += sizeof("; charset=") - 1 + r->headers_out.charset.len;
}
- len += ngx_http_v3_encode_header_lri(NULL, 0,
+ len += ngx_http_v3_encode_field_lri(NULL, 0,
NGX_HTTP_V3_HEADER_CONTENT_TYPE_TEXT_PLAIN,
NULL, n);
}
if (r->headers_out.content_length == NULL) {
if (r->headers_out.content_length_n > 0) {
- len += ngx_http_v3_encode_header_lri(NULL, 0,
+ len += ngx_http_v3_encode_field_lri(NULL, 0,
NGX_HTTP_V3_HEADER_CONTENT_LENGTH_ZERO,
NULL, NGX_OFF_T_LEN);
} else if (r->headers_out.content_length_n == 0) {
- len += ngx_http_v3_encode_header_ri(NULL, 0,
+ len += ngx_http_v3_encode_field_ri(NULL, 0,
NGX_HTTP_V3_HEADER_CONTENT_LENGTH_ZERO);
}
}
if (r->headers_out.last_modified == NULL
&& r->headers_out.last_modified_time != -1)
{
- len += ngx_http_v3_encode_header_lri(NULL, 0,
+ len += ngx_http_v3_encode_field_lri(NULL, 0,
NGX_HTTP_V3_HEADER_LAST_MODIFIED, NULL,
sizeof("Mon, 28 Sep 1970 06:00:00 GMT") - 1);
}
n += sizeof(":65535") - 1;
}
- len += ngx_http_v3_encode_header_lri(NULL, 0,
+ len += ngx_http_v3_encode_field_lri(NULL, 0,
NGX_HTTP_V3_HEADER_LOCATION, NULL, n);
} else {
#if (NGX_HTTP_GZIP)
if (r->gzip_vary) {
if (clcf->gzip_vary) {
- len += ngx_http_v3_encode_header_ri(NULL, 0,
+ len += ngx_http_v3_encode_field_ri(NULL, 0,
NGX_HTTP_V3_HEADER_VARY_ACCEPT_ENCODING);
} else {
continue;
}
- len += ngx_http_v3_encode_header_l(NULL, &header[i].key,
- &header[i].value);
+ len += ngx_http_v3_encode_field_l(NULL, &header[i].key,
+ &header[i].value);
}
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 header len:%uz", len);
return NGX_ERROR;
}
- b->last = (u_char *) ngx_http_v3_encode_header_block_prefix(b->last,
- 0, 0, 0);
+ b->last = (u_char *) ngx_http_v3_encode_field_section_prefix(b->last,
+ 0, 0, 0);
if (r->headers_out.status == NGX_HTTP_OK) {
- b->last = (u_char *) ngx_http_v3_encode_header_ri(b->last, 0,
+ b->last = (u_char *) ngx_http_v3_encode_field_ri(b->last, 0,
NGX_HTTP_V3_HEADER_STATUS_200);
} else {
- b->last = (u_char *) ngx_http_v3_encode_header_lri(b->last, 0,
+ b->last = (u_char *) ngx_http_v3_encode_field_lri(b->last, 0,
NGX_HTTP_V3_HEADER_STATUS_200,
NULL, 3);
b->last = ngx_sprintf(b->last, "%03ui", r->headers_out.status);
n = sizeof("nginx") - 1;
}
- b->last = (u_char *) ngx_http_v3_encode_header_lri(b->last, 0,
+ b->last = (u_char *) ngx_http_v3_encode_field_lri(b->last, 0,
NGX_HTTP_V3_HEADER_SERVER,
p, n);
}
if (r->headers_out.date == NULL) {
- b->last = (u_char *) ngx_http_v3_encode_header_lri(b->last, 0,
+ b->last = (u_char *) ngx_http_v3_encode_field_lri(b->last, 0,
NGX_HTTP_V3_HEADER_DATE,
ngx_cached_http_time.data,
ngx_cached_http_time.len);
n += sizeof("; charset=") - 1 + r->headers_out.charset.len;
}
- b->last = (u_char *) ngx_http_v3_encode_header_lri(b->last, 0,
+ b->last = (u_char *) ngx_http_v3_encode_field_lri(b->last, 0,
NGX_HTTP_V3_HEADER_CONTENT_TYPE_TEXT_PLAIN,
NULL, n);
p = ngx_sprintf(b->last, "%O", r->headers_out.content_length_n);
n = p - b->last;
- b->last = (u_char *) ngx_http_v3_encode_header_lri(b->last, 0,
+ b->last = (u_char *) ngx_http_v3_encode_field_lri(b->last, 0,
NGX_HTTP_V3_HEADER_CONTENT_LENGTH_ZERO,
NULL, n);
r->headers_out.content_length_n);
} else if (r->headers_out.content_length_n == 0) {
- b->last = (u_char *) ngx_http_v3_encode_header_ri(b->last, 0,
+ b->last = (u_char *) ngx_http_v3_encode_field_ri(b->last, 0,
NGX_HTTP_V3_HEADER_CONTENT_LENGTH_ZERO);
}
}
if (r->headers_out.last_modified == NULL
&& r->headers_out.last_modified_time != -1)
{
- b->last = (u_char *) ngx_http_v3_encode_header_lri(b->last, 0,
+ b->last = (u_char *) ngx_http_v3_encode_field_lri(b->last, 0,
NGX_HTTP_V3_HEADER_LAST_MODIFIED, NULL,
sizeof("Mon, 28 Sep 1970 06:00:00 GMT") - 1);
n += ngx_sprintf(b->last, ":%ui", port) - b->last;
}
- b->last = (u_char *) ngx_http_v3_encode_header_lri(b->last, 0,
+ b->last = (u_char *) ngx_http_v3_encode_field_lri(b->last, 0,
NGX_HTTP_V3_HEADER_LOCATION,
NULL, n);
#if (NGX_HTTP_GZIP)
if (r->gzip_vary) {
- b->last = (u_char *) ngx_http_v3_encode_header_ri(b->last, 0,
+ b->last = (u_char *) ngx_http_v3_encode_field_ri(b->last, 0,
NGX_HTTP_V3_HEADER_VARY_ACCEPT_ENCODING);
}
#endif
continue;
}
- b->last = (u_char *) ngx_http_v3_encode_header_l(b->last,
- &header[i].key,
- &header[i].value);
+ b->last = (u_char *) ngx_http_v3_encode_field_l(b->last,
+ &header[i].key,
+ &header[i].value);
}
if (r->header_only) {
len = ngx_http_v3_encode_varlen_int(NULL, push_id);
- len += ngx_http_v3_encode_header_block_prefix(NULL, 0, 0, 0);
+ len += ngx_http_v3_encode_field_section_prefix(NULL, 0, 0, 0);
- len += ngx_http_v3_encode_header_ri(NULL, 0,
- NGX_HTTP_V3_HEADER_METHOD_GET);
+ len += ngx_http_v3_encode_field_ri(NULL, 0,
+ NGX_HTTP_V3_HEADER_METHOD_GET);
- len += ngx_http_v3_encode_header_lri(NULL, 0,
- NGX_HTTP_V3_HEADER_AUTHORITY,
- NULL, r->headers_in.server.len);
+ len += ngx_http_v3_encode_field_lri(NULL, 0,
+ NGX_HTTP_V3_HEADER_AUTHORITY,
+ NULL, r->headers_in.server.len);
if (path->len == 1 && path->data[0] == '/') {
- len += ngx_http_v3_encode_header_ri(NULL, 0,
- NGX_HTTP_V3_HEADER_PATH_ROOT);
+ len += ngx_http_v3_encode_field_ri(NULL, 0,
+ NGX_HTTP_V3_HEADER_PATH_ROOT);
} else {
- len += ngx_http_v3_encode_header_lri(NULL, 0,
- NGX_HTTP_V3_HEADER_PATH_ROOT,
- NULL, path->len);
+ len += ngx_http_v3_encode_field_lri(NULL, 0,
+ NGX_HTTP_V3_HEADER_PATH_ROOT,
+ NULL, path->len);
}
if (r->schema.len == 5 && ngx_strncmp(r->schema.data, "https", 5) == 0) {
- len += ngx_http_v3_encode_header_ri(NULL, 0,
- NGX_HTTP_V3_HEADER_SCHEME_HTTPS);
+ len += ngx_http_v3_encode_field_ri(NULL, 0,
+ NGX_HTTP_V3_HEADER_SCHEME_HTTPS);
} else if (r->schema.len == 4
&& ngx_strncmp(r->schema.data, "http", 4) == 0)
{
- len += ngx_http_v3_encode_header_ri(NULL, 0,
- NGX_HTTP_V3_HEADER_SCHEME_HTTP);
+ len += ngx_http_v3_encode_field_ri(NULL, 0,
+ NGX_HTTP_V3_HEADER_SCHEME_HTTP);
} else {
- len += ngx_http_v3_encode_header_lri(NULL, 0,
- NGX_HTTP_V3_HEADER_SCHEME_HTTP,
- NULL, r->schema.len);
+ len += ngx_http_v3_encode_field_lri(NULL, 0,
+ NGX_HTTP_V3_HEADER_SCHEME_HTTP,
+ NULL, r->schema.len);
}
if (r->headers_in.accept_encoding) {
- len += ngx_http_v3_encode_header_lri(NULL, 0,
+ len += ngx_http_v3_encode_field_lri(NULL, 0,
NGX_HTTP_V3_HEADER_ACCEPT_ENCODING, NULL,
r->headers_in.accept_encoding->value.len);
}
if (r->headers_in.accept_language) {
- len += ngx_http_v3_encode_header_lri(NULL, 0,
+ len += ngx_http_v3_encode_field_lri(NULL, 0,
NGX_HTTP_V3_HEADER_ACCEPT_LANGUAGE, NULL,
r->headers_in.accept_language->value.len);
}
if (r->headers_in.user_agent) {
- len += ngx_http_v3_encode_header_lri(NULL, 0,
+ len += ngx_http_v3_encode_field_lri(NULL, 0,
NGX_HTTP_V3_HEADER_USER_AGENT, NULL,
r->headers_in.user_agent->value.len);
}
b->last = (u_char *) ngx_http_v3_encode_varlen_int(b->last, push_id);
- b->last = (u_char *) ngx_http_v3_encode_header_block_prefix(b->last,
- 0, 0, 0);
+ b->last = (u_char *) ngx_http_v3_encode_field_section_prefix(b->last,
+ 0, 0, 0);
- b->last = (u_char *) ngx_http_v3_encode_header_ri(b->last, 0,
+ b->last = (u_char *) ngx_http_v3_encode_field_ri(b->last, 0,
NGX_HTTP_V3_HEADER_METHOD_GET);
- b->last = (u_char *) ngx_http_v3_encode_header_lri(b->last, 0,
+ b->last = (u_char *) ngx_http_v3_encode_field_lri(b->last, 0,
NGX_HTTP_V3_HEADER_AUTHORITY,
r->headers_in.server.data,
r->headers_in.server.len);
if (path->len == 1 && path->data[0] == '/') {
- b->last = (u_char *) ngx_http_v3_encode_header_ri(b->last, 0,
+ b->last = (u_char *) ngx_http_v3_encode_field_ri(b->last, 0,
NGX_HTTP_V3_HEADER_PATH_ROOT);
} else {
- b->last = (u_char *) ngx_http_v3_encode_header_lri(b->last, 0,
+ b->last = (u_char *) ngx_http_v3_encode_field_lri(b->last, 0,
NGX_HTTP_V3_HEADER_PATH_ROOT,
path->data, path->len);
}
if (r->schema.len == 5 && ngx_strncmp(r->schema.data, "https", 5) == 0) {
- b->last = (u_char *) ngx_http_v3_encode_header_ri(b->last, 0,
+ b->last = (u_char *) ngx_http_v3_encode_field_ri(b->last, 0,
NGX_HTTP_V3_HEADER_SCHEME_HTTPS);
} else if (r->schema.len == 4
&& ngx_strncmp(r->schema.data, "http", 4) == 0)
{
- b->last = (u_char *) ngx_http_v3_encode_header_ri(b->last, 0,
+ b->last = (u_char *) ngx_http_v3_encode_field_ri(b->last, 0,
NGX_HTTP_V3_HEADER_SCHEME_HTTP);
} else {
- b->last = (u_char *) ngx_http_v3_encode_header_lri(b->last, 0,
+ b->last = (u_char *) ngx_http_v3_encode_field_lri(b->last, 0,
NGX_HTTP_V3_HEADER_SCHEME_HTTP,
r->schema.data, r->schema.len);
}
if (r->headers_in.accept_encoding) {
- b->last = (u_char *) ngx_http_v3_encode_header_lri(b->last, 0,
+ b->last = (u_char *) ngx_http_v3_encode_field_lri(b->last, 0,
NGX_HTTP_V3_HEADER_ACCEPT_ENCODING,
r->headers_in.accept_encoding->value.data,
r->headers_in.accept_encoding->value.len);
}
if (r->headers_in.accept_language) {
- b->last = (u_char *) ngx_http_v3_encode_header_lri(b->last, 0,
+ b->last = (u_char *) ngx_http_v3_encode_field_lri(b->last, 0,
NGX_HTTP_V3_HEADER_ACCEPT_LANGUAGE,
r->headers_in.accept_language->value.data,
r->headers_in.accept_language->value.len);
}
if (r->headers_in.user_agent) {
- b->last = (u_char *) ngx_http_v3_encode_header_lri(b->last, 0,
+ b->last = (u_char *) ngx_http_v3_encode_field_lri(b->last, 0,
NGX_HTTP_V3_HEADER_USER_AGENT,
r->headers_in.user_agent->value.data,
r->headers_in.user_agent->value.len);
static ngx_int_t ngx_http_v3_parse_prefix_int(ngx_connection_t *c,
ngx_http_v3_parse_prefix_int_t *st, ngx_uint_t prefix, u_char ch);
-static ngx_int_t ngx_http_v3_parse_header_block_prefix(ngx_connection_t *c,
- ngx_http_v3_parse_header_block_prefix_t *st, u_char ch);
-static ngx_int_t ngx_http_v3_parse_header_rep(ngx_connection_t *c,
- ngx_http_v3_parse_header_rep_t *st, ngx_uint_t base, u_char ch);
+static ngx_int_t ngx_http_v3_parse_field_section_prefix(ngx_connection_t *c,
+ ngx_http_v3_parse_field_section_prefix_t *st, u_char ch);
+static ngx_int_t ngx_http_v3_parse_field_rep(ngx_connection_t *c,
+ ngx_http_v3_parse_field_rep_t *st, ngx_uint_t base, u_char ch);
static ngx_int_t ngx_http_v3_parse_literal(ngx_connection_t *c,
ngx_http_v3_parse_literal_t *st, u_char ch);
-static ngx_int_t ngx_http_v3_parse_header_ri(ngx_connection_t *c,
- ngx_http_v3_parse_header_t *st, u_char ch);
-static ngx_int_t ngx_http_v3_parse_header_lri(ngx_connection_t *c,
- ngx_http_v3_parse_header_t *st, u_char ch);
-static ngx_int_t ngx_http_v3_parse_header_l(ngx_connection_t *c,
- ngx_http_v3_parse_header_t *st, u_char ch);
-static ngx_int_t ngx_http_v3_parse_header_pbi(ngx_connection_t *c,
- ngx_http_v3_parse_header_t *st, u_char ch);
-static ngx_int_t ngx_http_v3_parse_header_lpbi(ngx_connection_t *c,
- ngx_http_v3_parse_header_t *st, u_char ch);
+static ngx_int_t ngx_http_v3_parse_field_ri(ngx_connection_t *c,
+ ngx_http_v3_parse_field_t *st, u_char ch);
+static ngx_int_t ngx_http_v3_parse_field_lri(ngx_connection_t *c,
+ ngx_http_v3_parse_field_t *st, u_char ch);
+static ngx_int_t ngx_http_v3_parse_field_l(ngx_connection_t *c,
+ ngx_http_v3_parse_field_t *st, u_char ch);
+static ngx_int_t ngx_http_v3_parse_field_pbi(ngx_connection_t *c,
+ ngx_http_v3_parse_field_t *st, u_char ch);
+static ngx_int_t ngx_http_v3_parse_field_lpbi(ngx_connection_t *c,
+ ngx_http_v3_parse_field_t *st, u_char ch);
static ngx_int_t ngx_http_v3_parse_control(ngx_connection_t *c,
ngx_http_v3_parse_control_t *st, u_char ch);
static ngx_int_t ngx_http_v3_parse_encoder(ngx_connection_t *c,
ngx_http_v3_parse_encoder_t *st, u_char ch);
-static ngx_int_t ngx_http_v3_parse_header_inr(ngx_connection_t *c,
- ngx_http_v3_parse_header_t *st, u_char ch);
-static ngx_int_t ngx_http_v3_parse_header_iwnr(ngx_connection_t *c,
- ngx_http_v3_parse_header_t *st, u_char ch);
+static ngx_int_t ngx_http_v3_parse_field_inr(ngx_connection_t *c,
+ ngx_http_v3_parse_field_t *st, u_char ch);
+static ngx_int_t ngx_http_v3_parse_field_iln(ngx_connection_t *c,
+ ngx_http_v3_parse_field_t *st, u_char ch);
static ngx_int_t ngx_http_v3_parse_decoder(ngx_connection_t *c,
ngx_http_v3_parse_decoder_t *st, u_char ch);
sw_skip,
sw_prefix,
sw_verify,
- sw_header_rep,
+ sw_field_rep,
sw_done
};
return NGX_HTTP_V3_ERR_FRAME_ERROR;
}
- rc = ngx_http_v3_parse_header_block_prefix(c, &st->prefix, ch);
+ rc = ngx_http_v3_parse_field_section_prefix(c, &st->prefix, ch);
if (rc != NGX_DONE) {
return rc;
}
return rc;
}
- st->state = sw_header_rep;
+ st->state = sw_field_rep;
/* fall through */
- case sw_header_rep:
+ case sw_field_rep:
- rc = ngx_http_v3_parse_header_rep(c, &st->header_rep, st->prefix.base,
- ch);
+ rc = ngx_http_v3_parse_field_rep(c, &st->field_rep, st->prefix.base,
+ ch);
if (--st->length == 0 && rc == NGX_AGAIN) {
return NGX_HTTP_V3_ERR_FRAME_ERROR;
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 parse headers done");
if (st->prefix.insert_count > 0) {
- if (ngx_http_v3_send_ack_header(c, c->quic->id) != NGX_OK) {
+ if (ngx_http_v3_send_ack_section(c, c->quic->id) != NGX_OK) {
return NGX_ERROR;
}
}
static ngx_int_t
-ngx_http_v3_parse_header_block_prefix(ngx_connection_t *c,
- ngx_http_v3_parse_header_block_prefix_t *st, u_char ch)
+ngx_http_v3_parse_field_section_prefix(ngx_connection_t *c,
+ ngx_http_v3_parse_field_section_prefix_t *st, u_char ch)
{
ngx_int_t rc;
enum {
case sw_start:
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "http3 parse header block prefix");
+ "http3 parse field section prefix");
st->state = sw_req_insert_count;
}
ngx_log_debug4(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "http3 parse header block prefix done "
+ "http3 parse field section prefix done "
"insert_count:%ui, sign:%ui, delta_base:%ui, base:%ui",
st->insert_count, st->sign, st->delta_base, st->base);
static ngx_int_t
-ngx_http_v3_parse_header_rep(ngx_connection_t *c,
- ngx_http_v3_parse_header_rep_t *st, ngx_uint_t base, u_char ch)
+ngx_http_v3_parse_field_rep(ngx_connection_t *c,
+ ngx_http_v3_parse_field_rep_t *st, ngx_uint_t base, u_char ch)
{
ngx_int_t rc;
enum {
sw_start = 0,
- sw_header_ri,
- sw_header_lri,
- sw_header_l,
- sw_header_pbi,
- sw_header_lpbi
+ sw_field_ri,
+ sw_field_lri,
+ sw_field_l,
+ sw_field_pbi,
+ sw_field_lpbi
};
if (st->state == sw_start) {
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "http3 parse header representation");
+ "http3 parse field representation");
- ngx_memzero(&st->header, sizeof(ngx_http_v3_parse_header_t));
+ ngx_memzero(&st->field, sizeof(ngx_http_v3_parse_field_t));
- st->header.base = base;
+ st->field.base = base;
if (ch & 0x80) {
- /* Indexed Header Field */
+ /* Indexed Field Line */
- st->state = sw_header_ri;
+ st->state = sw_field_ri;
} else if (ch & 0x40) {
- /* Literal Header Field With Name Reference */
+ /* Literal Field Line With Name Reference */
- st->state = sw_header_lri;
+ st->state = sw_field_lri;
} else if (ch & 0x20) {
- /* Literal Header Field Without Name Reference */
+ /* Literal Field Line With Literal Name */
- st->state = sw_header_l;
+ st->state = sw_field_l;
} else if (ch & 0x10) {
- /* Indexed Header Field With Post-Base Index */
+ /* Indexed Field Line With Post-Base Index */
- st->state = sw_header_pbi;
+ st->state = sw_field_pbi;
} else {
- /* Literal Header Field With Post-Base Name Reference */
+ /* Literal Field Line With Post-Base Name Reference */
- st->state = sw_header_lpbi;
+ st->state = sw_field_lpbi;
}
}
switch (st->state) {
- case sw_header_ri:
- rc = ngx_http_v3_parse_header_ri(c, &st->header, ch);
+ case sw_field_ri:
+ rc = ngx_http_v3_parse_field_ri(c, &st->field, ch);
break;
- case sw_header_lri:
- rc = ngx_http_v3_parse_header_lri(c, &st->header, ch);
+ case sw_field_lri:
+ rc = ngx_http_v3_parse_field_lri(c, &st->field, ch);
break;
- case sw_header_l:
- rc = ngx_http_v3_parse_header_l(c, &st->header, ch);
+ case sw_field_l:
+ rc = ngx_http_v3_parse_field_l(c, &st->field, ch);
break;
- case sw_header_pbi:
- rc = ngx_http_v3_parse_header_pbi(c, &st->header, ch);
+ case sw_field_pbi:
+ rc = ngx_http_v3_parse_field_pbi(c, &st->field, ch);
break;
- case sw_header_lpbi:
- rc = ngx_http_v3_parse_header_lpbi(c, &st->header, ch);
+ case sw_field_lpbi:
+ rc = ngx_http_v3_parse_field_lpbi(c, &st->field, ch);
break;
default:
}
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "http3 parse header representation done");
+ "http3 parse field representation done");
st->state = sw_start;
return NGX_DONE;
if (n > cscf->large_client_header_buffers.size) {
ngx_log_error(NGX_LOG_INFO, c->log, 0,
- "client sent too large header field");
+ "client sent too large field line");
return NGX_HTTP_V3_ERR_EXCESSIVE_LOAD;
}
static ngx_int_t
-ngx_http_v3_parse_header_ri(ngx_connection_t *c, ngx_http_v3_parse_header_t *st,
+ngx_http_v3_parse_field_ri(ngx_connection_t *c, ngx_http_v3_parse_field_t *st,
u_char ch)
{
ngx_int_t rc;
case sw_start:
- ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 parse header ri");
+ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 parse field ri");
st->dynamic = (ch & 0x40) ? 0 : 1;
st->state = sw_index;
done:
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "http3 parse header ri done %s%ui]",
+ "http3 parse field ri done %s%ui]",
st->dynamic ? "dynamic[-" : "static[", st->index);
if (st->dynamic) {
static ngx_int_t
-ngx_http_v3_parse_header_lri(ngx_connection_t *c,
- ngx_http_v3_parse_header_t *st, u_char ch)
+ngx_http_v3_parse_field_lri(ngx_connection_t *c,
+ ngx_http_v3_parse_field_t *st, u_char ch)
{
ngx_int_t rc;
enum {
case sw_start:
- ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 parse header lri");
+ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 parse field lri");
st->dynamic = (ch & 0x10) ? 0 : 1;
st->state = sw_index;
done:
ngx_log_debug3(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "http3 parse header lri done %s%ui] \"%V\"",
+ "http3 parse field lri done %s%ui] \"%V\"",
st->dynamic ? "dynamic[-" : "static[",
st->index, &st->value);
static ngx_int_t
-ngx_http_v3_parse_header_l(ngx_connection_t *c,
- ngx_http_v3_parse_header_t *st, u_char ch)
+ngx_http_v3_parse_field_l(ngx_connection_t *c,
+ ngx_http_v3_parse_field_t *st, u_char ch)
{
ngx_int_t rc;
enum {
case sw_start:
- ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 parse header l");
+ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 parse field l");
st->literal.huffman = (ch & 0x08) ? 1 : 0;
st->state = sw_name_len;
done:
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "http3 parse header l done \"%V\" \"%V\"",
+ "http3 parse field l done \"%V\" \"%V\"",
&st->name, &st->value);
st->state = sw_start;
static ngx_int_t
-ngx_http_v3_parse_header_pbi(ngx_connection_t *c,
- ngx_http_v3_parse_header_t *st, u_char ch)
+ngx_http_v3_parse_field_pbi(ngx_connection_t *c,
+ ngx_http_v3_parse_field_t *st, u_char ch)
{
ngx_int_t rc;
enum {
case sw_start:
- ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 parse header pbi");
+ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 parse field pbi");
st->state = sw_index;
done:
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "http3 parse header pbi done dynamic[+%ui]", st->index);
+ "http3 parse field pbi done dynamic[+%ui]", st->index);
rc = ngx_http_v3_parse_lookup(c, 1, st->base + st->index, &st->name,
&st->value);
static ngx_int_t
-ngx_http_v3_parse_header_lpbi(ngx_connection_t *c,
- ngx_http_v3_parse_header_t *st, u_char ch)
+ngx_http_v3_parse_field_lpbi(ngx_connection_t *c,
+ ngx_http_v3_parse_field_t *st, u_char ch)
{
ngx_int_t rc;
enum {
case sw_start:
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "http3 parse header lpbi");
+ "http3 parse field lpbi");
st->state = sw_index;
done:
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "http3 parse header lpbi done dynamic[+%ui] \"%V\"",
+ "http3 parse field lpbi done dynamic[+%ui] \"%V\"",
st->index, &st->value);
rc = ngx_http_v3_parse_lookup(c, 1, st->base + st->index, &st->name, NULL);
enum {
sw_start = 0,
sw_inr,
- sw_iwnr,
+ sw_iln,
sw_capacity,
sw_duplicate
};
st->state = sw_inr;
} else if (ch & 0x40) {
- /* Insert Without Name Reference */
+ /* Insert With Literal Name */
- st->state = sw_iwnr;
+ st->state = sw_iln;
} else if (ch & 0x20) {
- /* Set Dynamic Table Capacity */
+ /* Set Dynamic Table Capacity */
st->state = sw_capacity;
case sw_inr:
- rc = ngx_http_v3_parse_header_inr(c, &st->header, ch);
+ rc = ngx_http_v3_parse_field_inr(c, &st->field, ch);
if (rc != NGX_DONE) {
return rc;
}
goto done;
- case sw_iwnr:
+ case sw_iln:
- rc = ngx_http_v3_parse_header_iwnr(c, &st->header, ch);
+ rc = ngx_http_v3_parse_field_iln(c, &st->field, ch);
if (rc != NGX_DONE) {
return rc;
}
static ngx_int_t
-ngx_http_v3_parse_header_inr(ngx_connection_t *c,
- ngx_http_v3_parse_header_t *st, u_char ch)
+ngx_http_v3_parse_field_inr(ngx_connection_t *c,
+ ngx_http_v3_parse_field_t *st, u_char ch)
{
ngx_int_t rc;
enum {
case sw_start:
- ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 parse header inr");
+ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 parse field inr");
st->dynamic = (ch & 0x40) ? 0 : 1;
st->state = sw_name_index;
done:
ngx_log_debug3(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "http3 parse header inr done %s[%ui] \"%V\"",
+ "http3 parse field inr done %s[%ui] \"%V\"",
st->dynamic ? "dynamic" : "static",
st->index, &st->value);
static ngx_int_t
-ngx_http_v3_parse_header_iwnr(ngx_connection_t *c,
- ngx_http_v3_parse_header_t *st, u_char ch)
+ngx_http_v3_parse_field_iln(ngx_connection_t *c,
+ ngx_http_v3_parse_field_t *st, u_char ch)
{
ngx_int_t rc;
enum {
case sw_start:
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "http3 parse header iwnr");
+ "http3 parse field iln");
st->literal.huffman = (ch & 0x20) ? 1 : 0;
st->state = sw_name_len;
done:
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "http3 parse header iwnr done \"%V\":\"%V\"",
+ "http3 parse field iln done \"%V\":\"%V\"",
&st->name, &st->value);
rc = ngx_http_v3_insert(c, &st->name, &st->value);
ngx_int_t rc;
enum {
sw_start = 0,
- sw_ack_header,
+ sw_ack_section,
sw_cancel_stream,
sw_inc_insert_count
};
"http3 parse decoder instruction");
if (ch & 0x80) {
- /* Header Acknowledgement */
+ /* Section Acknowledgment */
- st->state = sw_ack_header;
+ st->state = sw_ack_section;
} else if (ch & 0x40) {
/* Stream Cancellation */
switch (st->state) {
- case sw_ack_header:
+ case sw_ack_section:
rc = ngx_http_v3_parse_prefix_int(c, &st->pint, 7, ch);
if (rc != NGX_DONE) {
return rc;
}
- rc = ngx_http_v3_ack_header(c, st->pint.value);
+ rc = ngx_http_v3_ack_section(c, st->pint.value);
if (rc != NGX_OK) {
return rc;
}
ngx_uint_t sign;
ngx_uint_t base;
ngx_http_v3_parse_prefix_int_t pint;
-} ngx_http_v3_parse_header_block_prefix_t;
+} ngx_http_v3_parse_field_section_prefix_t;
typedef struct {
ngx_http_v3_parse_prefix_int_t pint;
ngx_http_v3_parse_literal_t literal;
-} ngx_http_v3_parse_header_t;
+} ngx_http_v3_parse_field_t;
typedef struct {
ngx_uint_t state;
- ngx_http_v3_parse_header_t header;
-} ngx_http_v3_parse_header_rep_t;
+ ngx_http_v3_parse_field_t field;
+} ngx_http_v3_parse_field_rep_t;
typedef struct {
ngx_uint_t type;
ngx_uint_t length;
ngx_http_v3_parse_varlen_int_t vlint;
- ngx_http_v3_parse_header_block_prefix_t prefix;
- ngx_http_v3_parse_header_rep_t header_rep;
+ ngx_http_v3_parse_field_section_prefix_t prefix;
+ ngx_http_v3_parse_field_rep_t field_rep;
} ngx_http_v3_parse_headers_t;
typedef struct {
ngx_uint_t state;
- ngx_http_v3_parse_header_t header;
+ ngx_http_v3_parse_field_t field;
ngx_http_v3_parse_prefix_int_t pint;
} ngx_http_v3_parse_encoder_t;
/* rc == NGX_OK || rc == NGX_DONE */
- if (ngx_http_v3_process_header(r, &st->header_rep.header.name,
- &st->header_rep.header.value)
+ if (ngx_http_v3_process_header(r, &st->field_rep.field.name,
+ &st->field_rep.field.value)
!= NGX_OK)
{
break;
ngx_int_t
-ngx_http_v3_send_ack_header(ngx_connection_t *c, ngx_uint_t stream_id)
+ngx_http_v3_send_ack_section(ngx_connection_t *c, ngx_uint_t stream_id)
{
u_char buf[NGX_HTTP_V3_PREFIX_INT_LEN];
size_t n;
ngx_connection_t *dc;
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "http3 client ack header %ui", stream_id);
+ "http3 client ack section %ui", stream_id);
dc = ngx_http_v3_get_uni_stream(c, NGX_HTTP_V3_STREAM_DECODER);
if (dc == NULL) {
ngx_int_t ngx_http_v3_send_set_capacity(ngx_connection_t *c,
ngx_uint_t capacity);
ngx_int_t ngx_http_v3_send_duplicate(ngx_connection_t *c, ngx_uint_t index);
-ngx_int_t ngx_http_v3_send_ack_header(ngx_connection_t *c,
+ngx_int_t ngx_http_v3_send_ack_section(ngx_connection_t *c,
ngx_uint_t stream_id);
ngx_int_t ngx_http_v3_send_cancel_stream(ngx_connection_t *c,
ngx_uint_t stream_id);
static ngx_int_t ngx_http_v3_evict(ngx_connection_t *c, size_t need);
static void ngx_http_v3_unblock(void *data);
-static ngx_int_t ngx_http_v3_new_header(ngx_connection_t *c);
+static ngx_int_t ngx_http_v3_new_entry(ngx_connection_t *c);
typedef struct {
} ngx_http_v3_block_t;
-static ngx_http_v3_header_t ngx_http_v3_static_table[] = {
+static ngx_http_v3_field_t ngx_http_v3_static_table[] = {
{ ngx_string(":authority"), ngx_string("") },
{ ngx_string(":path"), ngx_string("/") },
{
u_char *p;
size_t size;
- ngx_http_v3_header_t *h;
+ ngx_http_v3_field_t *field;
ngx_http_v3_session_t *h3c;
ngx_http_v3_dynamic_table_t *dt;
"http3 insert [%ui] \"%V\":\"%V\", size:%uz",
dt->base + dt->nelts, name, value, size);
- p = ngx_alloc(sizeof(ngx_http_v3_header_t) + name->len + value->len,
+ p = ngx_alloc(sizeof(ngx_http_v3_field_t) + name->len + value->len,
c->log);
if (p == NULL) {
return NGX_ERROR;
}
- h = (ngx_http_v3_header_t *) p;
+ field = (ngx_http_v3_field_t *) p;
- h->name.data = p + sizeof(ngx_http_v3_header_t);
- h->name.len = name->len;
- h->value.data = ngx_cpymem(h->name.data, name->data, name->len);
- h->value.len = value->len;
- ngx_memcpy(h->value.data, value->data, value->len);
+ field->name.data = p + sizeof(ngx_http_v3_field_t);
+ field->name.len = name->len;
+ field->value.data = ngx_cpymem(field->name.data, name->data, name->len);
+ field->value.len = value->len;
+ ngx_memcpy(field->value.data, value->data, value->len);
- dt->elts[dt->nelts++] = h;
+ dt->elts[dt->nelts++] = field;
dt->size += size;
/* TODO increment can be sent less often */
return NGX_ERROR;
}
- if (ngx_http_v3_new_header(c) != NGX_OK) {
+ if (ngx_http_v3_new_entry(c) != NGX_OK) {
return NGX_ERROR;
}
ngx_http_v3_set_capacity(ngx_connection_t *c, ngx_uint_t capacity)
{
ngx_uint_t max, prev_max;
- ngx_http_v3_header_t **elts;
+ ngx_http_v3_field_t **elts;
ngx_http_v3_session_t *h3c;
ngx_http_v3_srv_conf_t *h3scf;
ngx_http_v3_dynamic_table_t *dt;
{
size_t size, target;
ngx_uint_t n;
- ngx_http_v3_header_t *h;
+ ngx_http_v3_field_t *field;
ngx_http_v3_session_t *h3c;
ngx_http_v3_dynamic_table_t *dt;
n = 0;
while (dt->size > target) {
- h = dt->elts[n++];
- size = ngx_http_v3_table_entry_size(&h->name, &h->value);
+ field = dt->elts[n++];
+ size = ngx_http_v3_table_entry_size(&field->name, &field->value);
ngx_log_debug4(NGX_LOG_DEBUG_HTTP, c->log, 0,
"http3 evict [%ui] \"%V\":\"%V\" size:%uz",
- dt->base, &h->name, &h->value, size);
+ dt->base, &field->name, &field->value, size);
- ngx_free(h);
+ ngx_free(field);
dt->size -= size;
}
ngx_int_t
-ngx_http_v3_ack_header(ngx_connection_t *c, ngx_uint_t stream_id)
+ngx_http_v3_ack_section(ngx_connection_t *c, ngx_uint_t stream_id)
{
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "http3 ack header %ui", stream_id);
+ "http3 ack section %ui", stream_id);
/* we do not use dynamic tables */
ngx_http_v3_lookup_static(ngx_connection_t *c, ngx_uint_t index,
ngx_str_t *name, ngx_str_t *value)
{
- ngx_uint_t nelts;
- ngx_http_v3_header_t *h;
+ ngx_uint_t nelts;
+ ngx_http_v3_field_t *field;
nelts = sizeof(ngx_http_v3_static_table)
/ sizeof(ngx_http_v3_static_table[0]);
return NGX_ERROR;
}
- h = &ngx_http_v3_static_table[index];
+ field = &ngx_http_v3_static_table[index];
ngx_log_debug3(NGX_LOG_DEBUG_HTTP, c->log, 0,
"http3 static[%ui] lookup \"%V\":\"%V\"",
- index, &h->name, &h->value);
+ index, &field->name, &field->value);
if (name) {
- *name = h->name;
+ *name = field->name;
}
if (value) {
- *value = h->value;
+ *value = field->value;
}
return NGX_OK;
ngx_http_v3_lookup(ngx_connection_t *c, ngx_uint_t index, ngx_str_t *name,
ngx_str_t *value)
{
- ngx_http_v3_header_t *h;
+ ngx_http_v3_field_t *field;
ngx_http_v3_session_t *h3c;
ngx_http_v3_dynamic_table_t *dt;
return NGX_ERROR;
}
- h = dt->elts[index - dt->base];
+ field = dt->elts[index - dt->base];
ngx_log_debug3(NGX_LOG_DEBUG_HTTP, c->log, 0,
"http3 dynamic[%ui] lookup \"%V\":\"%V\"",
- index, &h->name, &h->value);
+ index, &field->name, &field->value);
if (name) {
- *name = h->name;
+ *name = field->name;
}
if (value) {
- *value = h->value;
+ *value = field->value;
}
return NGX_OK;
static ngx_int_t
-ngx_http_v3_new_header(ngx_connection_t *c)
+ngx_http_v3_new_entry(ngx_connection_t *c)
{
ngx_queue_t *q;
ngx_connection_t *bc;
h3c = ngx_http_v3_get_session(c);
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "http3 new dynamic header, blocked:%ui", h3c->nblocked);
+ "http3 new dynamic entry, blocked:%ui", h3c->nblocked);
while (!ngx_queue_empty(&h3c->blocked)) {
q = ngx_queue_head(&h3c->blocked);
typedef struct {
ngx_str_t name;
ngx_str_t value;
-} ngx_http_v3_header_t;
+} ngx_http_v3_field_t;
typedef struct {
- ngx_http_v3_header_t **elts;
+ ngx_http_v3_field_t **elts;
ngx_uint_t nelts;
ngx_uint_t base;
size_t size;
ngx_str_t *value);
ngx_int_t ngx_http_v3_set_capacity(ngx_connection_t *c, ngx_uint_t capacity);
ngx_int_t ngx_http_v3_duplicate(ngx_connection_t *c, ngx_uint_t index);
-ngx_int_t ngx_http_v3_ack_header(ngx_connection_t *c, ngx_uint_t stream_id);
+ngx_int_t ngx_http_v3_ack_section(ngx_connection_t *c, ngx_uint_t stream_id);
ngx_int_t ngx_http_v3_inc_insert_count(ngx_connection_t *c, ngx_uint_t inc);
ngx_int_t ngx_http_v3_lookup_static(ngx_connection_t *c, ngx_uint_t index,
ngx_str_t *name, ngx_str_t *value);