File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,11 @@ export interface RequestOptions {
8282 */
8383 lookupOptions ?: { servers ?: string [ ] } ;
8484
85+ /**
86+ * A path to a file where TLS key logging information should be written.
87+ */
88+ keyLogFile ?: string ;
89+
8590 /**
8691 * An abort signal, which can be used to cancel the in-process request if
8792 * required.
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import {
2222 RequestOptions ,
2323 RULE_PARAM_REF_KEY
2424} from './client-types' ;
25+ import * as fs from '../util/fs' ;
2526
2627export class HttpClient {
2728
@@ -102,6 +103,12 @@ export class HttpClient {
102103 } )
103104 } ) ;
104105
106+ if ( options . keyLogFile ) {
107+ request . on ( 'socket' , ( socket ) => {
108+ socket . on ( 'keylog' , ( line ) => fs . appendOrCreateFile ( options . keyLogFile ! , line ) ) ;
109+ } ) ;
110+ }
111+
105112 options . abortSignal ?. addEventListener ( 'abort' , ( ) => {
106113 // In older Node versions, this seems to be required to _actually_ abort the request:
107114 request . abort ( ) ;
You can’t perform that action at this time.
0 commit comments