@@ -148,6 +148,10 @@ function handleRequest(harEntryMap, request, options) {
148148 socket . on ( "connect" , ( ) => {
149149 entry . _timestamps . connect = process . hrtime ( ) ;
150150 } ) ;
151+
152+ socket . on ( "secureConnect" , ( ) => {
153+ entry . _timestamps . secureConnect = process . hrtime ( ) ;
154+ } ) ;
151155 } ) ;
152156
153157 request . on ( "finish" , ( ) => {
@@ -468,8 +472,19 @@ function withHar(baseFetch, defaults = {}) {
468472 0.01 // Minimum value, see above.
469473 ) ;
470474 entry . timings . dns = getDuration ( time . socket , time . lookup ) ;
471- entry . timings . connect = getDuration ( time . lookup , time . connect ) ;
472- entry . timings . send = getDuration ( time . connect , time . sent ) ;
475+ entry . timings . connect = getDuration (
476+ time . lookup ,
477+ // For backwards compatibility with HAR 1.1, the `connect` timing
478+ // includes `ssl` instead of being mutually exclusive.
479+ time . secureConnect || time . connect
480+ ) ;
481+ if ( time . secureConnect ) {
482+ entry . timings . ssl = getDuration ( time . connect , time . secureConnect ) ;
483+ }
484+ entry . timings . send = getDuration (
485+ time . secureConnect || time . connect ,
486+ time . sent
487+ ) ;
473488 entry . timings . wait = Math . max (
474489 // Seems like it might be possible to receive a response before the
475490 // request fires its `finish` event. This is just a hunch and it would
0 commit comments