mirror of
https://github.com/nginx/nginx.git
synced 2025-06-22 22:10:45 +08:00
Removed support of drafts older than currently latest 27.
This commit is contained in:
parent
26b7056972
commit
e34161c3d5
@ -1903,10 +1903,6 @@ ngx_quic_crypto_input(ngx_connection_t *c, ngx_quic_frame_t *frame)
|
|||||||
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
||||||
"handshake completed successfully");
|
"handshake completed successfully");
|
||||||
|
|
||||||
#if (NGX_QUIC_DRAFT_VERSION >= 27)
|
|
||||||
{
|
|
||||||
ngx_quic_frame_t *frame;
|
|
||||||
|
|
||||||
frame = ngx_quic_alloc_frame(c, 0);
|
frame = ngx_quic_alloc_frame(c, 0);
|
||||||
if (frame == NULL) {
|
if (frame == NULL) {
|
||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
@ -1917,8 +1913,6 @@ ngx_quic_crypto_input(ngx_connection_t *c, ngx_quic_frame_t *frame)
|
|||||||
frame->type = NGX_QUIC_FT_HANDSHAKE_DONE;
|
frame->type = NGX_QUIC_FT_HANDSHAKE_DONE;
|
||||||
ngx_sprintf(frame->info, "HANDSHAKE DONE on handshake completed");
|
ngx_sprintf(frame->info, "HANDSHAKE DONE on handshake completed");
|
||||||
ngx_quic_queue_frame(c->quic, frame);
|
ngx_quic_queue_frame(c->quic, frame);
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generating next keys before a key update is received.
|
* Generating next keys before a key update is received.
|
||||||
|
@ -61,7 +61,6 @@ static u_char *ngx_quic_parse_int_multi(u_char *pos, u_char *end, ...);
|
|||||||
static void ngx_quic_build_int(u_char **pos, uint64_t value);
|
static void ngx_quic_build_int(u_char **pos, uint64_t value);
|
||||||
|
|
||||||
static u_char *ngx_quic_read_uint8(u_char *pos, u_char *end, uint8_t *value);
|
static u_char *ngx_quic_read_uint8(u_char *pos, u_char *end, uint8_t *value);
|
||||||
/*static*/ u_char *ngx_quic_read_uint16(u_char *pos, u_char *end, uint16_t *value); // usage depends on NGX_QUIC_VERSION
|
|
||||||
static u_char *ngx_quic_read_uint32(u_char *pos, u_char *end, uint32_t *value);
|
static u_char *ngx_quic_read_uint32(u_char *pos, u_char *end, uint32_t *value);
|
||||||
static u_char *ngx_quic_read_bytes(u_char *pos, u_char *end, size_t len,
|
static u_char *ngx_quic_read_bytes(u_char *pos, u_char *end, size_t len,
|
||||||
u_char **out);
|
u_char **out);
|
||||||
@ -182,19 +181,6 @@ ngx_quic_read_uint8(u_char *pos, u_char *end, uint8_t *value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*static*/ ngx_inline u_char *
|
|
||||||
ngx_quic_read_uint16(u_char *pos, u_char *end, uint16_t *value)
|
|
||||||
{
|
|
||||||
if ((size_t)(end - pos) < sizeof(uint16_t)) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
*value = ngx_quic_parse_uint16(pos);
|
|
||||||
|
|
||||||
return pos + sizeof(uint16_t);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static ngx_inline u_char *
|
static ngx_inline u_char *
|
||||||
ngx_quic_read_uint32(u_char *pos, u_char *end, uint32_t *value)
|
ngx_quic_read_uint32(u_char *pos, u_char *end, uint32_t *value)
|
||||||
{
|
{
|
||||||
@ -1452,55 +1438,9 @@ ngx_int_t
|
|||||||
ngx_quic_parse_transport_params(u_char *p, u_char *end, ngx_quic_tp_t *tp,
|
ngx_quic_parse_transport_params(u_char *p, u_char *end, ngx_quic_tp_t *tp,
|
||||||
ngx_log_t *log)
|
ngx_log_t *log)
|
||||||
{
|
{
|
||||||
|
uint64_t id, len;
|
||||||
ngx_int_t rc;
|
ngx_int_t rc;
|
||||||
|
|
||||||
#if (NGX_QUIC_DRAFT_VERSION < 27)
|
|
||||||
|
|
||||||
uint16_t id, len, tp_len;
|
|
||||||
|
|
||||||
p = ngx_quic_read_uint16(p, end, &tp_len);
|
|
||||||
if (p == NULL) {
|
|
||||||
ngx_log_error(NGX_LOG_INFO, log, 0,
|
|
||||||
"failed to parse total transport params length");
|
|
||||||
return NGX_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (p < end) {
|
|
||||||
|
|
||||||
p = ngx_quic_read_uint16(p, end, &id);
|
|
||||||
if (p == NULL) {
|
|
||||||
ngx_log_error(NGX_LOG_INFO, log, 0,
|
|
||||||
"failed to parse transport param id");
|
|
||||||
return NGX_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
p = ngx_quic_read_uint16(p, end, &len);
|
|
||||||
if (p == NULL) {
|
|
||||||
ngx_log_error(NGX_LOG_INFO, log, 0,
|
|
||||||
"failed to parse transport param id 0x%xi length", id);
|
|
||||||
return NGX_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = ngx_quic_parse_transport_param(p, p + len, id, tp);
|
|
||||||
|
|
||||||
if (rc == NGX_ERROR) {
|
|
||||||
ngx_log_error(NGX_LOG_INFO, log, 0,
|
|
||||||
"failed to parse transport param id 0x%xi data", id);
|
|
||||||
return NGX_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rc == NGX_DECLINED) {
|
|
||||||
ngx_log_error(NGX_LOG_INFO, log, 0,
|
|
||||||
"unknown transport param id 0x%xi, skipped", id);
|
|
||||||
}
|
|
||||||
|
|
||||||
p += len;
|
|
||||||
};
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
uint64_t id, len;
|
|
||||||
|
|
||||||
while (p < end) {
|
while (p < end) {
|
||||||
p = ngx_quic_parse_int(p, end, &id);
|
p = ngx_quic_parse_int(p, end, &id);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
@ -1530,11 +1470,8 @@ ngx_quic_parse_transport_params(u_char *p, u_char *end, ngx_quic_tp_t *tp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
p += len;
|
p += len;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (p != end) {
|
if (p != end) {
|
||||||
ngx_log_error(NGX_LOG_INFO, log, 0,
|
ngx_log_error(NGX_LOG_INFO, log, 0,
|
||||||
"trailing garbage in transport parameters: %ui bytes",
|
"trailing garbage in transport parameters: %ui bytes",
|
||||||
@ -1542,7 +1479,6 @@ ngx_quic_parse_transport_params(u_char *p, u_char *end, ngx_quic_tp_t *tp,
|
|||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, log, 0,
|
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, log, 0,
|
||||||
"client transport parameters parsed successfully");
|
"client transport parameters parsed successfully");
|
||||||
|
|
||||||
@ -1641,22 +1577,6 @@ ngx_quic_create_transport_params(u_char *pos, u_char *end, ngx_quic_tp_t *tp)
|
|||||||
u_char *p;
|
u_char *p;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
#if (NGX_QUIC_DRAFT_VERSION < 27)
|
|
||||||
|
|
||||||
/* older drafts with static transport parameters encoding */
|
|
||||||
|
|
||||||
#define ngx_quic_tp_len(id, value) \
|
|
||||||
4 + ngx_quic_varint_len(value)
|
|
||||||
|
|
||||||
#define ngx_quic_tp_vint(id, value) \
|
|
||||||
do { \
|
|
||||||
p = ngx_quic_write_uint16(p, id); \
|
|
||||||
p = ngx_quic_write_uint16(p, ngx_quic_varint_len(value)); \
|
|
||||||
ngx_quic_build_int(&p, value); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
/* recent drafts with variable integer transport parameters encoding */
|
/* recent drafts with variable integer transport parameters encoding */
|
||||||
|
|
||||||
#define ngx_quic_tp_len(id, value) \
|
#define ngx_quic_tp_len(id, value) \
|
||||||
@ -1671,8 +1591,6 @@ ngx_quic_create_transport_params(u_char *pos, u_char *end, ngx_quic_tp_t *tp)
|
|||||||
ngx_quic_build_int(&p, value); \
|
ngx_quic_build_int(&p, value); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
p = pos;
|
p = pos;
|
||||||
|
|
||||||
len = ngx_quic_tp_len(NGX_QUIC_TP_ACTIVE_CONNECTION_ID_LIMIT,
|
len = ngx_quic_tp_len(NGX_QUIC_TP_ACTIVE_CONNECTION_ID_LIMIT,
|
||||||
@ -1699,17 +1617,9 @@ ngx_quic_create_transport_params(u_char *pos, u_char *end, ngx_quic_tp_t *tp)
|
|||||||
tp->max_idle_timeout);
|
tp->max_idle_timeout);
|
||||||
|
|
||||||
if (pos == NULL) {
|
if (pos == NULL) {
|
||||||
#if (NGX_QUIC_DRAFT_VERSION < 27)
|
|
||||||
len += 2;
|
|
||||||
#endif
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (NGX_QUIC_DRAFT_VERSION < 27)
|
|
||||||
/* TLS extension length */
|
|
||||||
p = ngx_quic_write_uint16(p, len);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ngx_quic_tp_vint(NGX_QUIC_TP_ACTIVE_CONNECTION_ID_LIMIT,
|
ngx_quic_tp_vint(NGX_QUIC_TP_ACTIVE_CONNECTION_ID_LIMIT,
|
||||||
tp->active_connection_id_limit);
|
tp->active_connection_id_limit);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user