Mercurial > hg > nginx
comparison src/event/ngx_event_quic_transport.c @ 8250:8f9cb6d66662 quic
Fixed parsing of CONNECTION CLOSE2 frames.
The "frame_type" field is not passed in case of 0x1d frame.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Fri, 20 Mar 2020 15:14:00 +0300 |
parents | 3f4b407fa0b8 |
children | c217a907ce42 |
comparison
equal
deleted
inserted
replaced
8249:3f4b407fa0b8 | 8250:8f9cb6d66662 |
---|---|
622 break; | 622 break; |
623 | 623 |
624 case NGX_QUIC_FT_CONNECTION_CLOSE: | 624 case NGX_QUIC_FT_CONNECTION_CLOSE: |
625 case NGX_QUIC_FT_CONNECTION_CLOSE2: | 625 case NGX_QUIC_FT_CONNECTION_CLOSE2: |
626 | 626 |
627 p = ngx_quic_parse_int_multi(p, end, &f->u.close.error_code, | 627 p = ngx_quic_parse_int(p, end, &f->u.close.error_code); |
628 &f->u.close.frame_type, | 628 if (p == NULL) { |
629 &f->u.close.reason.len, NULL); | 629 ngx_log_error(NGX_LOG_ERR, pkt->log, 0, |
630 if (p == NULL) { | 630 "failed to parse close connection frame error code"); |
631 ngx_log_error(NGX_LOG_ERR, pkt->log, 0, | 631 return NGX_ERROR; |
632 "failed to parse close connection frame"); | 632 } |
633 | |
634 if (f->type == NGX_QUIC_FT_CONNECTION_CLOSE) { | |
635 p = ngx_quic_parse_int(p, end, &f->u.close.frame_type); | |
636 ngx_log_error(NGX_LOG_ERR, pkt->log, 0, | |
637 "failed to parse close connection frame type"); | |
638 return NGX_ERROR; | |
639 } | |
640 | |
641 p = ngx_quic_parse_int(p, end, &f->u.close.reason.len); | |
642 if (p == NULL) { | |
643 ngx_log_error(NGX_LOG_ERR, pkt->log, 0, | |
644 "failed to parse close reason length"); | |
633 return NGX_ERROR; | 645 return NGX_ERROR; |
634 } | 646 } |
635 | 647 |
636 p = ngx_quic_read_bytes(p, end, f->u.close.reason.len, | 648 p = ngx_quic_read_bytes(p, end, f->u.close.reason.len, |
637 &f->u.close.reason.data); | 649 &f->u.close.reason.data); |
655 ngx_quic_error_text(f->u.close.error_code), | 667 ngx_quic_error_text(f->u.close.error_code), |
656 f->u.close.error_code, f->u.close.frame_type, | 668 f->u.close.error_code, f->u.close.frame_type, |
657 &f->u.close.reason); | 669 &f->u.close.reason); |
658 } else { | 670 } else { |
659 | 671 |
660 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, pkt->log, 0, | 672 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0, |
661 "CONN.CLOSE2: { (0x%xi) type=0x%xi reason '%V'}", | 673 "CONN.CLOSE2: { (0x%xi) reason '%V'}", |
662 f->u.close.error_code, f->u.close.frame_type, | 674 f->u.close.error_code, &f->u.close.reason); |
663 &f->u.close.reason); | |
664 } | 675 } |
665 | 676 |
666 break; | 677 break; |
667 | 678 |
668 case NGX_QUIC_FT_STREAM0: | 679 case NGX_QUIC_FT_STREAM0: |