@@ -682,7 +682,6 @@ class QUICConnection extends EventTarget {
682
682
// If short frame
683
683
if ( header . ty === 5 ) {
684
684
this . shortReceived = true ;
685
- this . conn . sendAckEliciting ( ) ;
686
685
}
687
686
}
688
687
@@ -845,34 +844,39 @@ class QUICConnection extends EventTarget {
845
844
sendInfo . to . host ,
846
845
) ;
847
846
this . logger . debug ( `sent ${ sendLength } bytes` ) ;
848
- }
849
- // Handling custom TLS verification, this must be done after the following conditions.
850
- // 1. Connection established.
851
- // 2. Certs available.
852
- // 3. Sent after connection has established.
853
- if (
854
- ! this . customVerified &&
855
- this . conn . isEstablished ( ) &&
856
- this . conn . peerCertChain ( ) != null
857
- ) {
858
- this . customVerified = true ;
859
- const peerCerts = this . conn . peerCertChain ( ) ;
860
- if ( peerCerts == null ) never ( ) ;
861
- const peerCertsPem = peerCerts . map ( ( c ) => utils . certificateDERToPEM ( c ) ) ;
862
- // Dispatching certs available event
863
- // this.dispatchEvent(new events.QUICConnectionRemoteCertEvent()); TODO
864
- try {
865
- if ( this . verifyCallback != null ) this . verifyCallback ( peerCertsPem ) ;
866
- this . conn . sendAckEliciting ( ) ;
867
- } catch ( e ) {
868
- // Force the connection to end.
869
- // Error 304 indicates cert chain failed verification.
870
- // Error 372 indicates cert chain was missing.
871
- this . conn . close (
872
- false ,
873
- 304 ,
874
- Buffer . from ( `Custom TLSFail: ${ e . message } ` ) ,
847
+
848
+ // Handling custom TLS verification, this must be done after the following conditions.
849
+ // 1. Connection established.
850
+ // 2. Certs available.
851
+ // 3. Sent after connection has established.
852
+ if (
853
+ ! this . customVerified &&
854
+ this . conn . isEstablished ( ) &&
855
+ this . conn . peerCertChain ( ) != null
856
+ ) {
857
+ this . customVerified = true ;
858
+ const peerCerts = this . conn . peerCertChain ( ) ;
859
+ if ( peerCerts == null ) never ( ) ;
860
+ const peerCertsPem = peerCerts . map ( ( c ) =>
861
+ utils . certificateDERToPEM ( c ) ,
875
862
) ;
863
+ try {
864
+ if ( this . verifyCallback != null ) this . verifyCallback ( peerCertsPem ) ;
865
+ this . logger . warn ( 'TLS verification succeeded' ) ;
866
+ this . conn . sendAckEliciting ( ) ;
867
+ } catch ( e ) {
868
+ // Force the connection to end.
869
+ // Error 304 indicates cert chain failed verification.
870
+ // Error 372 indicates cert chain was missing.
871
+ this . logger . warn (
872
+ `TLS fail due to [${ e . message } ], closing connection` ,
873
+ ) ;
874
+ this . conn . close (
875
+ false ,
876
+ 304 ,
877
+ Buffer . from ( `Custom TLSFail: ${ e . message } ` ) ,
878
+ ) ;
879
+ }
876
880
}
877
881
}
878
882
0 commit comments