diff --git a/src/http/v3/ngx_http_v3_encode.c b/src/http/v3/ngx_http_v3_encode.c index b7bc3dd7c..2740ccffa 100644 --- a/src/http/v3/ngx_http_v3_encode.c +++ b/src/http/v3/ngx_http_v3_encode.c @@ -100,7 +100,7 @@ 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, 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) { @@ -119,9 +119,9 @@ ngx_http_v3_encode_header_block_prefix(u_char *p, ngx_uint_t insert_count, 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); @@ -134,10 +134,10 @@ ngx_http_v3_encode_header_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, 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) @@ -160,9 +160,9 @@ ngx_http_v3_encode_header_lri(u_char *p, ngx_uint_t dynamic, ngx_uint_t index, 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) @@ -187,9 +187,9 @@ ngx_http_v3_encode_header_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) +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); @@ -202,10 +202,10 @@ 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, 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) diff --git a/src/http/v3/ngx_http_v3_encode.h b/src/http/v3/ngx_http_v3_encode.h index 583c5675b..fca376da5 100644 --- a/src/http/v3/ngx_http_v3_encode.h +++ b/src/http/v3/ngx_http_v3_encode.h @@ -18,16 +18,16 @@ uintptr_t ngx_http_v3_encode_varlen_int(u_char *p, uint64_t value); 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); diff --git a/src/http/v3/ngx_http_v3_filter_module.c b/src/http/v3/ngx_http_v3_filter_module.c index db40e3737..52db65736 100644 --- a/src/http/v3/ngx_http_v3_filter_module.c +++ b/src/http/v3/ngx_http_v3_filter_module.c @@ -159,16 +159,16 @@ ngx_http_v3_header_filter(ngx_http_request_t *r) } } - 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); @@ -184,14 +184,14 @@ ngx_http_v3_header_filter(ngx_http_request_t *r) 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) { @@ -203,19 +203,19 @@ ngx_http_v3_header_filter(ngx_http_request_t *r) 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); } } @@ -223,7 +223,7 @@ ngx_http_v3_header_filter(ngx_http_request_t *r) 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); } @@ -267,7 +267,7 @@ ngx_http_v3_header_filter(ngx_http_request_t *r) 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 { @@ -278,7 +278,7 @@ ngx_http_v3_header_filter(ngx_http_request_t *r) #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 { @@ -306,8 +306,8 @@ ngx_http_v3_header_filter(ngx_http_request_t *r) 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); @@ -317,15 +317,15 @@ ngx_http_v3_header_filter(ngx_http_request_t *r) 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); @@ -345,13 +345,13 @@ ngx_http_v3_header_filter(ngx_http_request_t *r) 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); @@ -366,7 +366,7 @@ ngx_http_v3_header_filter(ngx_http_request_t *r) 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); @@ -394,7 +394,7 @@ ngx_http_v3_header_filter(ngx_http_request_t *r) 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); @@ -402,7 +402,7 @@ ngx_http_v3_header_filter(ngx_http_request_t *r) 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); } } @@ -410,7 +410,7 @@ ngx_http_v3_header_filter(ngx_http_request_t *r) 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); @@ -425,7 +425,7 @@ ngx_http_v3_header_filter(ngx_http_request_t *r) 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); @@ -449,7 +449,7 @@ ngx_http_v3_header_filter(ngx_http_request_t *r) #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 @@ -473,9 +473,9 @@ ngx_http_v3_header_filter(ngx_http_request_t *r) 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) { @@ -1065,55 +1065,55 @@ ngx_http_v3_create_push_promise(ngx_http_request_t *r, ngx_str_t *path, 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); } @@ -1125,59 +1125,59 @@ ngx_http_v3_create_push_promise(ngx_http_request_t *r, ngx_str_t *path, 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); diff --git a/src/http/v3/ngx_http_v3_parse.c b/src/http/v3/ngx_http_v3_parse.c index 5951dff10..c5fc24482 100644 --- a/src/http/v3/ngx_http_v3_parse.c +++ b/src/http/v3/ngx_http_v3_parse.c @@ -19,22 +19,22 @@ static ngx_int_t ngx_http_v3_parse_varlen_int(ngx_connection_t *c, 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); @@ -43,10 +43,10 @@ static ngx_int_t ngx_http_v3_parse_settings(ngx_connection_t *c, 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); @@ -201,7 +201,7 @@ ngx_http_v3_parse_headers(ngx_connection_t *c, ngx_http_v3_parse_headers_t *st, sw_skip, sw_prefix, sw_verify, - sw_header_rep, + sw_field_rep, sw_done }; @@ -277,7 +277,7 @@ ngx_http_v3_parse_headers(ngx_connection_t *c, ngx_http_v3_parse_headers_t *st, 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; } @@ -292,14 +292,14 @@ ngx_http_v3_parse_headers(ngx_connection_t *c, ngx_http_v3_parse_headers_t *st, 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; @@ -323,7 +323,7 @@ done: 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; } } @@ -334,8 +334,8 @@ done: 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 { @@ -350,7 +350,7 @@ ngx_http_v3_parse_header_block_prefix(ngx_connection_t *c, 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; @@ -401,7 +401,7 @@ done: } 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); @@ -411,75 +411,75 @@ done: 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: @@ -491,7 +491,7 @@ ngx_http_v3_parse_header_rep(ngx_connection_t *c, } 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; @@ -523,7 +523,7 @@ ngx_http_v3_parse_literal(ngx_connection_t *c, ngx_http_v3_parse_literal_t *st, 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; } @@ -578,7 +578,7 @@ done: 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; @@ -591,7 +591,7 @@ ngx_http_v3_parse_header_ri(ngx_connection_t *c, ngx_http_v3_parse_header_t *st, 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; @@ -614,7 +614,7 @@ ngx_http_v3_parse_header_ri(ngx_connection_t *c, ngx_http_v3_parse_header_t *st, 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) { @@ -633,8 +633,8 @@ done: 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 { @@ -649,7 +649,7 @@ ngx_http_v3_parse_header_lri(ngx_connection_t *c, 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; @@ -705,7 +705,7 @@ ngx_http_v3_parse_header_lri(ngx_connection_t *c, 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); @@ -724,8 +724,8 @@ done: 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 { @@ -741,7 +741,7 @@ ngx_http_v3_parse_header_l(ngx_connection_t *c, 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; @@ -812,7 +812,7 @@ ngx_http_v3_parse_header_l(ngx_connection_t *c, 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; @@ -821,8 +821,8 @@ done: 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 { @@ -834,7 +834,7 @@ ngx_http_v3_parse_header_pbi(ngx_connection_t *c, 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; @@ -856,7 +856,7 @@ ngx_http_v3_parse_header_pbi(ngx_connection_t *c, 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); @@ -870,8 +870,8 @@ done: 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 { @@ -887,7 +887,7 @@ ngx_http_v3_parse_header_lpbi(ngx_connection_t *c, 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; @@ -942,7 +942,7 @@ ngx_http_v3_parse_header_lpbi(ngx_connection_t *c, 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); @@ -1260,7 +1260,7 @@ ngx_http_v3_parse_encoder(ngx_connection_t *c, ngx_http_v3_parse_encoder_t *st, enum { sw_start = 0, sw_inr, - sw_iwnr, + sw_iln, sw_capacity, sw_duplicate }; @@ -1276,12 +1276,12 @@ ngx_http_v3_parse_encoder(ngx_connection_t *c, ngx_http_v3_parse_encoder_t *st, 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; @@ -1296,16 +1296,16 @@ ngx_http_v3_parse_encoder(ngx_connection_t *c, ngx_http_v3_parse_encoder_t *st, 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; } @@ -1354,8 +1354,8 @@ done: 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 { @@ -1370,7 +1370,7 @@ ngx_http_v3_parse_header_inr(ngx_connection_t *c, 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; @@ -1427,7 +1427,7 @@ ngx_http_v3_parse_header_inr(ngx_connection_t *c, 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); @@ -1442,8 +1442,8 @@ done: 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 { @@ -1460,7 +1460,7 @@ ngx_http_v3_parse_header_iwnr(ngx_connection_t *c, 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; @@ -1532,7 +1532,7 @@ ngx_http_v3_parse_header_iwnr(ngx_connection_t *c, 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); @@ -1552,7 +1552,7 @@ ngx_http_v3_parse_decoder(ngx_connection_t *c, ngx_http_v3_parse_decoder_t *st, ngx_int_t rc; enum { sw_start = 0, - sw_ack_header, + sw_ack_section, sw_cancel_stream, sw_inc_insert_count }; @@ -1563,9 +1563,9 @@ ngx_http_v3_parse_decoder(ngx_connection_t *c, ngx_http_v3_parse_decoder_t *st, "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 */ @@ -1581,14 +1581,14 @@ ngx_http_v3_parse_decoder(ngx_connection_t *c, ngx_http_v3_parse_decoder_t *st, 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; } diff --git a/src/http/v3/ngx_http_v3_parse.h b/src/http/v3/ngx_http_v3_parse.h index c187b7bc2..5ca3a410f 100644 --- a/src/http/v3/ngx_http_v3_parse.h +++ b/src/http/v3/ngx_http_v3_parse.h @@ -41,7 +41,7 @@ typedef struct { 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 { @@ -65,13 +65,13 @@ 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 { @@ -79,14 +79,14 @@ 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; diff --git a/src/http/v3/ngx_http_v3_request.c b/src/http/v3/ngx_http_v3_request.c index 9d7ca952d..5fc6e233b 100644 --- a/src/http/v3/ngx_http_v3_request.c +++ b/src/http/v3/ngx_http_v3_request.c @@ -304,8 +304,8 @@ ngx_http_v3_process_request(ngx_event_t *rev) /* 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; diff --git a/src/http/v3/ngx_http_v3_streams.c b/src/http/v3/ngx_http_v3_streams.c index 8b2047f43..fa39be78a 100644 --- a/src/http/v3/ngx_http_v3_streams.c +++ b/src/http/v3/ngx_http_v3_streams.c @@ -603,14 +603,14 @@ 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_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) { diff --git a/src/http/v3/ngx_http_v3_streams.h b/src/http/v3/ngx_http_v3_streams.h index a2126a7f8..4f7290e4c 100644 --- a/src/http/v3/ngx_http_v3_streams.h +++ b/src/http/v3/ngx_http_v3_streams.h @@ -34,7 +34,7 @@ ngx_int_t ngx_http_v3_send_insert(ngx_connection_t *c, ngx_str_t *name, 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); diff --git a/src/http/v3/ngx_http_v3_tables.c b/src/http/v3/ngx_http_v3_tables.c index 8f4e28edd..348088774 100644 --- a/src/http/v3/ngx_http_v3_tables.c +++ b/src/http/v3/ngx_http_v3_tables.c @@ -15,7 +15,7 @@ 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 { @@ -25,7 +25,7 @@ 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("/") }, @@ -198,7 +198,7 @@ ngx_http_v3_insert(ngx_connection_t *c, ngx_str_t *name, ngx_str_t *value) { 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; @@ -215,21 +215,21 @@ ngx_http_v3_insert(ngx_connection_t *c, ngx_str_t *name, ngx_str_t *value) "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 */ @@ -238,7 +238,7 @@ ngx_http_v3_insert(ngx_connection_t *c, ngx_str_t *name, ngx_str_t *value) return NGX_ERROR; } - if (ngx_http_v3_new_header(c) != NGX_OK) { + if (ngx_http_v3_new_entry(c) != NGX_OK) { return NGX_ERROR; } @@ -250,7 +250,7 @@ ngx_int_t 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; @@ -323,7 +323,7 @@ ngx_http_v3_evict(ngx_connection_t *c, size_t need) { 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; @@ -340,14 +340,14 @@ ngx_http_v3_evict(ngx_connection_t *c, size_t need) 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; } @@ -388,10 +388,10 @@ 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_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 */ @@ -415,8 +415,8 @@ ngx_int_t 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]); @@ -428,18 +428,18 @@ ngx_http_v3_lookup_static(ngx_connection_t *c, ngx_uint_t index, 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; @@ -450,7 +450,7 @@ ngx_int_t 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; @@ -464,18 +464,18 @@ ngx_http_v3_lookup(ngx_connection_t *c, ngx_uint_t index, ngx_str_t *name, 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; @@ -617,7 +617,7 @@ ngx_http_v3_unblock(void *data) 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; @@ -627,7 +627,7 @@ ngx_http_v3_new_header(ngx_connection_t *c) 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); diff --git a/src/http/v3/ngx_http_v3_tables.h b/src/http/v3/ngx_http_v3_tables.h index 36589f171..991cc12c9 100644 --- a/src/http/v3/ngx_http_v3_tables.h +++ b/src/http/v3/ngx_http_v3_tables.h @@ -17,11 +17,11 @@ 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; @@ -36,7 +36,7 @@ ngx_int_t ngx_http_v3_insert(ngx_connection_t *c, ngx_str_t *name, 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);