# HG changeset patch # User Sergey Kandaurov # Date 1591028204 -10800 # Node ID c206233d9c29f807804ab463e2e7bfc4e943b0b7 # Parent 2bf17a829ddcf7e1dd35f7c03bd63ea8c165b9d1 Fixed transport parameters on a new connection with a valid token. Previously, the retry transport parameter was sent regardless. diff --git a/src/event/ngx_event_quic.c b/src/event/ngx_event_quic.c --- a/src/event/ngx_event_quic.c +++ b/src/event/ngx_event_quic.c @@ -652,7 +652,9 @@ ngx_quic_new_connection(ngx_connection_t return NGX_ERROR; } +#if (NGX_QUIC_DRAFT_VERSION >= 28) qc->tp.original_dcid = c->quic->odcid; +#endif qc->tp.initial_scid = c->quic->dcid; qc->scid.len = pkt->scid.len; @@ -796,6 +798,9 @@ ngx_quic_retry(ngx_connection_t *c) } c->quic->token = token; +#if (NGX_QUIC_DRAFT_VERSION < 28) + c->quic->tp.original_dcid = c->quic->odcid; +#endif c->quic->tp.retry_scid = c->quic->dcid; c->quic->in_retry = 1; diff --git a/src/event/ngx_event_quic_transport.c b/src/event/ngx_event_quic_transport.c --- a/src/event/ngx_event_quic_transport.c +++ b/src/event/ngx_event_quic_transport.c @@ -1673,15 +1673,15 @@ ngx_quic_create_transport_params(u_char #if (NGX_QUIC_DRAFT_VERSION >= 28) len += ngx_quic_tp_strlen(NGX_QUIC_TP_ORIGINAL_DCID, tp->original_dcid); len += ngx_quic_tp_strlen(NGX_QUIC_TP_INITIAL_SCID, tp->initial_scid); -#endif - if (tp->retry) { -#if (NGX_QUIC_DRAFT_VERSION >= 28) + if (tp->retry_scid.len) { len += ngx_quic_tp_strlen(NGX_QUIC_TP_RETRY_SCID, tp->retry_scid); + } #else + if (tp->original_dcid.len) { len += ngx_quic_tp_strlen(NGX_QUIC_TP_ORIGINAL_DCID, tp->original_dcid); + } #endif - } if (pos == NULL) { return len; @@ -1714,15 +1714,15 @@ ngx_quic_create_transport_params(u_char #if (NGX_QUIC_DRAFT_VERSION >= 28) ngx_quic_tp_str(NGX_QUIC_TP_ORIGINAL_DCID, tp->original_dcid); ngx_quic_tp_str(NGX_QUIC_TP_INITIAL_SCID, tp->initial_scid); -#endif - if (tp->retry) { -#if (NGX_QUIC_DRAFT_VERSION >= 28) + if (tp->retry_scid.len) { ngx_quic_tp_str(NGX_QUIC_TP_RETRY_SCID, tp->retry_scid); + } #else + if (tp->original_dcid.len) { ngx_quic_tp_str(NGX_QUIC_TP_ORIGINAL_DCID, tp->original_dcid); + } #endif - } return p - pos; }