comparison src/event/ngx_event_quic.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 7f0981be07c4
children ee53bfd8f9ed
comparison
equal deleted inserted replaced
8272:7f0981be07c4 8273:cb75f194f1f0
962 962
963 static ngx_int_t 963 static ngx_int_t
964 ngx_quic_handle_crypto_frame(ngx_connection_t *c, ngx_quic_header_t *pkt, 964 ngx_quic_handle_crypto_frame(ngx_connection_t *c, ngx_quic_header_t *pkt,
965 ngx_quic_crypto_frame_t *f) 965 ngx_quic_crypto_frame_t *f)
966 { 966 {
967 int sslerr; 967 int sslerr;
968 ssize_t n; 968 ssize_t n;
969 ngx_ssl_conn_t *ssl_conn; 969 ngx_ssl_conn_t *ssl_conn;
970 ngx_quic_frame_t *frame;
970 971
971 if (f->offset != 0x0) { 972 if (f->offset != 0x0) {
972 ngx_log_error(NGX_LOG_INFO, c->log, 0, 973 ngx_log_error(NGX_LOG_INFO, c->log, 0,
973 "crypto frame with non-zero offset"); 974 "crypto frame with non-zero offset");
974 // TODO: add support for crypto frames spanning packets 975 // TODO: add support for crypto frames spanning packets
1010 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, 1011 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
1011 "quic ssl cipher: %s", SSL_get_cipher(ssl_conn)); 1012 "quic ssl cipher: %s", SSL_get_cipher(ssl_conn));
1012 1013
1013 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, 1014 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0,
1014 "handshake completed successfully"); 1015 "handshake completed successfully");
1016
1017 frame = ngx_pcalloc(c->pool, sizeof(ngx_quic_frame_t));
1018 if (frame == NULL) {
1019 return NGX_ERROR;
1020 }
1021
1022 /* 12.4 Frames and frame types, figure 8 */
1023 frame->level = ssl_encryption_application;
1024 frame->type = NGX_QUIC_FT_HANDSHAKE_DONE;
1025 ngx_sprintf(frame->info, "HANDSHAKE DONE on handshake completed");
1026 ngx_quic_queue_frame(c->quic, frame);
1015 } 1027 }
1016 1028
1017 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, 1029 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0,
1018 "SSL_quic_read_level: %d, SSL_quic_write_level: %d", 1030 "SSL_quic_read_level: %d, SSL_quic_write_level: %d",
1019 (int) SSL_quic_read_level(ssl_conn), 1031 (int) SSL_quic_read_level(ssl_conn),