Mercurial > hg > nginx
diff src/event/ngx_event_quic_transport.c @ 8273:cb75f194f1f0 quic
Implemented sending HANDSHAKE_DONE frame after handshake.
This makes it possible to switch to draft 27 by default.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Tue, 24 Mar 2020 11:59:14 +0300 |
parents | c9c3a73df6e8 |
children | 19660929e8ff |
line wrap: on
line diff
--- a/src/event/ngx_event_quic_transport.c Mon Mar 23 20:48:34 2020 +0300 +++ b/src/event/ngx_event_quic_transport.c Tue Mar 24 11:59:14 2020 +0300 @@ -66,6 +66,7 @@ static size_t ngx_quic_create_ack(u_char *p, ngx_quic_ack_frame_t *ack); static size_t ngx_quic_create_crypto(u_char *p, ngx_quic_crypto_frame_t *crypto); +static size_t ngx_quic_create_hs_done(u_char *p); static size_t ngx_quic_create_stream(u_char *p, ngx_quic_stream_frame_t *sf); static size_t ngx_quic_create_max_streams(u_char *p, ngx_quic_max_streams_frame_t *ms); @@ -882,14 +883,18 @@ break; - /* TODO: implement parsing for all frames below */ + case NGX_QUIC_FT_HANDSHAKE_DONE: + /* only sent by server, not by client */ + goto not_allowed; + case NGX_QUIC_FT_NEW_TOKEN: - case NGX_QUIC_FT_HANDSHAKE_DONE: if (!ngx_quic_short_pkt(flags)) { goto not_allowed; } + /* TODO: implement */ + ngx_log_error(NGX_LOG_ERR, pkt->log, 0, "unimplemented frame type 0x%xi in packet", f->type); @@ -1065,6 +1070,9 @@ case NGX_QUIC_FT_CRYPTO: return ngx_quic_create_crypto(p, &f->u.crypto); + case NGX_QUIC_FT_HANDSHAKE_DONE: + return ngx_quic_create_hs_done(p); + case NGX_QUIC_FT_STREAM0: case NGX_QUIC_FT_STREAM1: case NGX_QUIC_FT_STREAM2: @@ -1148,6 +1156,23 @@ static size_t +ngx_quic_create_hs_done(u_char *p) +{ + u_char *start; + + if (p == NULL) { + return ngx_quic_varint_len(NGX_QUIC_FT_HANDSHAKE_DONE); + } + + start = p; + + ngx_quic_build_int(&p, NGX_QUIC_FT_HANDSHAKE_DONE); + + return p - start; +} + + +static size_t ngx_quic_create_stream(u_char *p, ngx_quic_stream_frame_t *sf) { size_t len;