Skip to content
This repository was archived by the owner on Aug 11, 2020. It is now read-only.

Commit 8816ff0

Browse files
committed
...
1 parent ddc38e1 commit 8816ff0

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

src/node_quic_crypto.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -890,8 +890,8 @@ void InitializeTLS(QuicSession* session, SSL* ssl) {
890890
SSL_set_verify(ssl, SSL_VERIFY_NONE, crypto::VerifyCallback);
891891
SSL_set_quic_early_data_enabled(ssl, 1);
892892

893-
if (session->env()->options()->trace_tls)
894-
session->EnableTrace();
893+
// if (session->env()->options()->trace_tls)
894+
// session->EnableTrace();
895895

896896
switch (session->Side()) {
897897
case NGTCP2_CRYPTO_SIDE_CLIENT: {
@@ -903,6 +903,8 @@ void InitializeTLS(QuicSession* session, SSL* ssl) {
903903
break;
904904
}
905905
case NGTCP2_CRYPTO_SIDE_SERVER: {
906+
if (session->env()->options()->trace_tls)
907+
session->EnableTrace();
906908
SSL_set_accept_state(ssl);
907909
if (session->IsOptionSet(QUICSERVERSESSION_OPTION_REQUEST_CERT)) {
908910
int verify_mode = SSL_VERIFY_PEER;

src/node_quic_session.cc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ void QuicSession::HandleError() {
593593
// determines that the TLS Handshake is done. The only thing we
594594
// need to do at this point is let the javascript side know.
595595
void QuicSession::HandshakeCompleted() {
596+
Debug(this, "Handshake is completed");
596597
session_stats_.handshake_completed_at = uv_hrtime();
597598

598599
HandleScope scope(env()->isolate());
@@ -1433,12 +1434,6 @@ void QuicSession::SendPendingData() {
14331434
}
14341435
}
14351436

1436-
// Notifies the ngtcp2_conn that the TLS handshake is completed.
1437-
void QuicSession::SetHandshakeCompleted() {
1438-
DCHECK(!IsFlagSet(QUICSESSION_FLAG_DESTROYED));
1439-
ngtcp2_conn_handshake_completed(Connection());
1440-
}
1441-
14421437
void QuicSession::SetLocalAddress(const ngtcp2_addr* addr) {
14431438
DCHECK(!IsFlagSet(QUICSESSION_FLAG_DESTROYED));
14441439
ngtcp2_conn_set_local_addr(Connection(), addr);

src/node_quic_session.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,6 @@ class QuicSession : public AsyncWrap,
476476
void RemoveConnectionID(const ngtcp2_cid* cid);
477477
void ScheduleRetransmit();
478478
bool SendPacket(const char* diagnostic_label = nullptr);
479-
void SetHandshakeCompleted();
480479
void SetLocalAddress(const ngtcp2_addr* addr);
481480
void StreamClose(int64_t stream_id, uint64_t app_error_code);
482481
void StreamOpen(int64_t stream_id);

test/parallel/test-quic-client-server.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ server.on('session', common.mustCall((session) => {
142142
session.on('secure', common.mustCall((servername, alpn, cipher) => {
143143
// Should not error and should return true... also shouldn't
144144
// cause anything else to fail.
145-
setImmediate(() => {
146-
assert(session.updateKey());
145+
146+
assert(session.updateKey());
147147

148148
debug('QuicServerSession TLS Handshake Complete');
149149
debug(' Server name: %s', servername);
@@ -153,8 +153,11 @@ setImmediate(() => {
153153
assert.strictEqual(servername, kServerName);
154154
assert.strictEqual(session.alpnProtocol, alpn);
155155

156-
console.log(session.getPeerCertificate());
157-
// assert.strictEqual(session.getPeerCertificate().subject.CN, 'agent1');
156+
// TODO(@jasnell): Temporarily disable. Accessing the client
157+
// certificate is currently broken with ngtcp2 and ngtcp2_crypto.
158+
// See: https://github.com/ngtcp2/ngtcp2/issues/156
159+
//
160+
// assert.strictEqual(session.getPeerCertificate().subject.CN, 'agent1');
158161

159162
// debug('QuicServerSession client is %sauthenticated',
160163
// session.authenticated ? '' : 'not ');
@@ -169,7 +172,6 @@ setImmediate(() => {
169172
uni.on('finish', common.mustCall());
170173
uni.on('close', common.mustCall());
171174
uni.on('end', common.mustCall());
172-
})
173175
}));
174176

175177
session.on('stream', common.mustCall((stream) => {
@@ -253,6 +255,8 @@ server.on('ready', common.mustCall(() => {
253255
assert.strictEqual(response.toString(), 'hello');
254256
}));
255257

258+
// TODO(@jasnell): Temporarily disabled while being fixed
259+
//
256260
// req.on('sessionTicket', common.mustCall((id, ticket, params) => {
257261
// debug('Session ticket received');
258262
// assert(id instanceof Buffer);
@@ -273,7 +277,7 @@ server.on('ready', common.mustCall(() => {
273277
assert.strictEqual(alpn, kALPN);
274278
assert.strictEqual(req.alpnProtocol, kALPN);
275279
assert(req.ephemeralKeyInfo);
276-
assert(req.getPeerCertificate());
280+
assert.strictEqual(req.getPeerCertificate().subject.CN, 'agent1');
277281

278282
debug('Client, min handshake ack: %f',
279283
req.handshakeAckHistogram.min);

0 commit comments

Comments
 (0)